Class: Thrust::IOS::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/thrust/ios/deploy.rb

Instance Method Summary collapse

Constructor Details

#initialize(out, x_code_tools, agv_tool, git, testflight, thrust_config, deployment_config, deployment_target) ⇒ Deploy

Returns a new instance of Deploy.



4
5
6
7
8
9
10
11
12
13
# File 'lib/thrust/ios/deploy.rb', line 4

def initialize(out, x_code_tools, agv_tool, git, testflight, thrust_config, deployment_config, deployment_target)
  @out = out
  @x_code_tools = x_code_tools
  @agv_tool = agv_tool
  @git = git
  @testflight = testflight
  @thrust_config = thrust_config
  @deployment_config = deployment_config
  @deployment_target = deployment_target
end

Instance Method Details

#runObject



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
52
# File 'lib/thrust/ios/deploy.rb', line 15

def run
  @git.ensure_clean

  begin
    @git.checkout_tag(@deployment_config.tag) if @deployment_config.tag

    if @deployment_config.versioning_method != 'none'
      if @deployment_config.versioning_method == 'commits'
        @agv_tool.change_build_number(@git.commit_count, nil, @thrust_config.app_config.path_to_xcodeproj)
      elsif @deployment_config.versioning_method == 'timestamp-sha'
        @agv_tool.change_build_number(@git.current_commit, Time.now.utc.strftime('%y%m%d%H%M'), @thrust_config.app_config.path_to_xcodeproj)
      else
        @agv_tool.change_build_number(@git.current_commit, nil, @thrust_config.app_config.path_to_xcodeproj)
      end
    end

    app_name = @thrust_config.app_config.app_name
    target = @deployment_config.ios_target || app_name

    ipa_file = @x_code_tools.cleanly_create_ipa(target, app_name, @thrust_config.app_config.ios_distribution_certificate, @deployment_config.ios_provisioning_search_query)

    dsym_path = "#{@x_code_tools.build_configuration_directory}/#{app_name}.app.dSYM"
    dsym_path = nil unless File.exist?(dsym_path)

    autogenerate_notes = @deployment_config.note_generation_method == 'autotag'
    @testflight.upload(ipa_file, @deployment_config.notify, @deployment_config.distribution_list, autogenerate_notes, @deployment_target, dsym_path)

    @git.create_tag(@deployment_target)
    @git.reset
  rescue Exception => e
    @out.puts "\n\n"
    @out.puts e.message.red
    @out.puts "\n\n"

    @git.reset
    exit 1
  end
end