Class: Cocoaout::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cocoaout/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



7
8
9
# File 'lib/cocoaout/command.rb', line 7

def config
  @config
end

Instance Method Details

#buildObject



30
31
32
33
34
# File 'lib/cocoaout/command.rb', line 30

def build
  load_cocoaout_file
  config_name = options[:configration_name] || "Release"
  self.build_project(config_name)
end

#cleanObject



58
59
60
61
62
63
64
65
66
# File 'lib/cocoaout/command.rb', line 58

def clean
  load_cocoaout_file
  output = `#{Cocoaout::xcode_build} clean -scheme #{Cocoaout::config.app_name}`
  if not $?.success?
    puts output and exit 0
  else
    puts "Clean successed."
  end
end

#deployObject



41
42
43
44
45
46
# File 'lib/cocoaout/command.rb', line 41

def deploy
  load_cocoaout_file
  config_name = options[:configration_name] || "Release"
  self.build_project(config_name)
  self.create_dmg_with_release(options[:output])
end

#init(app_name = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cocoaout/command.rb', line 14

def init(app_name = nil)
  puts "Generate Cocoaoutfile."
  
  @sdk = options[:sdk]
  @app_name = app_name || Dir.pwd.split("/").last
  @bg_file_name = options[:bg_file_name]
  
  create_file "Cocoaoutfile" do
    src = "#{__dir__}/templates/Cocoaoutfile.erb"
    ERB.new(File.read src).result binding
  end
end

#packageObject



51
52
53
54
55
# File 'lib/cocoaout/command.rb', line 51

def package
  load_cocoaout_file
  output = options[:output] || "~/Downloads/#{Cocoaout::config.app_name}.dmg"
  self.create_dmg_with_release(output)
end