Class: Kick

Inherits:
Object
  • Object
show all
Defined in:
lib/kick.rb

Instance Method Summary collapse

Constructor Details

#initializeKick

Returns a new instance of Kick.



7
8
9
10
11
12
13
14
# File 'lib/kick.rb', line 7

def initialize
  file = File.join(Dir.pwd, 'kick.spec')
  @build_settings = OpenStruct.new(YAML.load_file(file))
  puts @build_settings
  @base_name = @build_settings.base_name
  @provisioning_profile_in_developer_program_name = @build_settings.provisioning_profile_name
  @provisioning_profile_name = @provisioning_profile_in_developer_program_name.gsub(/ /, '_')
end

Instance Method Details

#buildObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/kick.rb', line 33

def build

  self.clean
  self.update_mobileprovision

  computer_name = %x[scutil --get ComputerName].strip
  puts "computer_name: #{computer_name}"
  code_signing_identity = @build_settings.code_signing_identity[computer_name]
  scheme = @build_settings.scheme

  command_build = "ipa build -m #{@provisioning_profile_name}.mobileprovision -i \"#{code_signing_identity}\" -s \"#{scheme}\" --verbose"

  puts command_build

  system(command_build)
  puts 'build completed'

  self.info

end

#cleanObject



16
17
18
19
20
# File 'lib/kick.rb', line 16

def clean
  system("rm #{@base_name}.ipa")
  system("rm #{@base_name}.app.dSYM.zip")
  system("rm #{@provisioning_profile_name}.mobileprovision")
end

#dist(distribution_list = nil, custom_notes = nil) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/kick.rb', line 54

def dist(distribution_list=nil, custom_notes=nil)

  self.build

  notes = custom_notes || @build_settings.notes
  api_token = @build_settings.api_token
  team_token = @build_settings.team_token
  if distribution_list == nil
    distribution_list = @build_settings.distribution_list
  end

  command_deploy = "ipa distribute:testflight -a #{api_token} -T #{team_token} -m '#{notes}' -l #{distribution_list} --notify --verbose"

  system(command_deploy)

  puts 'deploy completed'

  self.info
  self.clean

end

#infoObject



28
29
30
31
# File 'lib/kick.rb', line 28

def info
  command_info = "ipa info #{@base_name}.ipa"
  system(command_info)
end

#update_mobileprovisionObject



22
23
24
25
26
# File 'lib/kick.rb', line 22

def update_mobileprovision
  developer_portal_team_id = @build_settings.developer_portal_team_id
  command_info = "ios profiles:download \"#{@provisioning_profile_in_developer_program_name}\" --team #{developer_portal_team_id}"
  system(command_info)
end