Class: Defgen::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/defgen/cli.rb

Instance Method Summary collapse

Instance Method Details

#parseObject



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
# File 'lib/defgen/cli.rb', line 16

def parse
  path = Dir['*.xcodeproj'].first
  
  if path.nil?
    puts('.xcodeproj file not found')
    puts
    help
    exit 1 
  end
  
  unless File.exist? options[:filename]      
    puts('no Defaultfile found')
    puts
    help
    exit 1
  end
  
  proj = XcodeprojAdapter.new(Xcodeproj::Project.new(path), path)
  
  defaultfile = DefaultfileBuilder.build { |builder|
    builder.project_settings = proj
    builder.parser           = DefaultfileParser
    builder.defaultfile      = File.open(options[:filename]).read
  }
  
  Installer.install(path, defaultfile, proj)
end

#stubsObject



8
9
10
# File 'lib/defgen/cli.rb', line 8

def stubs
  TemplateGenerator.create_stubs
end