Class: LaneKit::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/lanekit.rb,
lib/lanekit/new.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



53
54
55
# File 'lib/lanekit/new.rb', line 53

def self.source_root
  File.dirname('./')
end

Instance Method Details

#new(app_path, bundle_id = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/lanekit/new.rb', line 9

def new(app_path, bundle_id=nil)
  app_path = app_path.strip
  @app_path = app_path
  @bundle_id = bundle_id

  @app_name = LaneKit::derive_app_name(app_path)
  validate_message = LaneKit.validate_app_name(@app_name)
  if validate_message
    puts "***error: #{validate_message}"
    return
  end

  @app_path_full = File.expand_path app_path
  if File.exists?(@app_path_full)
    puts "Can't create a new LaneKit app in an existing folder: #{@app_path_full}"
    return
  end
  
  if @bundle_id != nil
    validate_message = LaneKit.validate_bundle_id(@bundle_id)
    if validate_message
      puts "***error: #{validate_message}"
      return
    end
  end
  
  if !LaneKit.gem_available?('cocoapods')
    puts "The Ruby gem cocoapods is not installed. This gem is required by LaneKit.\nInstall command: gem install cocoapods"
    return
  end

  @project_path = File.join @app_path_full, @app_name
  @ios_template_name = "lanekit-ios-project"
  @ios_version = '6.0'
  @original_wd = Dir.pwd
    
  self.create_project
  self.add_gitignore
  self.change_filenames(@app_path_full, @app_name, @ios_template_name)
  self.change_bundle_id(@bundle_id) if @bundle_id != nil
  self.add_cocoapods
  self.clean_workspace
end

#versionObject



307
308
309
# File 'lib/lanekit.rb', line 307

def version
  puts "LaneKit #{VERSION}"
end