Class: BetaBuilder::DeploymentStrategies::TestFlight

Inherits:
Strategy
  • Object
show all
Includes:
FileUtils, Rake::DSL
Defined in:
lib/beta_builder/deployment_strategies/testflight.rb

Constant Summary collapse

ENDPOINT =
"https://testflightapp.com/api/builds.json"

Instance Method Summary collapse

Methods inherited from Strategy

#configure, #initialize, #prepare

Constructor Details

This class inherits a constructor from BetaBuilder::DeploymentStrategies::Strategy

Instance Method Details

#deployObject



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
53
54
55
56
# File 'lib/beta_builder/deployment_strategies/testflight.rb', line 21

def deploy
  release_notes = get_notes
  payload = {
    :api_token          => @configuration.api_token,
    :team_token         => @configuration.team_token,
    :file               => File.new(@configuration.ipa_path, 'rb'),
    :notes              => release_notes,
    :distribution_lists => (@configuration.distribution_lists || []).join(","),
    :notify             => @configuration.notify || false,
    :replace            => @configuration.replace || false
  }
  if @configuration.verbose
    puts "ipa path: #{@configuration.ipa_path}"
    puts "release notes: #{release_notes}"
  end
  
  if @configuration.dry_run 
    puts '** Dry Run - No action here! **'
    return
  end
  
  print "Uploading build to TestFlight..."        
  
  begin
    response = RestClient.post(ENDPOINT, payload, :accept => :json)
  rescue => e
    response = e.response
  end
  
  if (response.code == 201) || (response.code == 200)
    puts "Done."
  else
    puts "Failed."
    puts "#{response}"
  end
end

#extended_configuration_for_strategyObject



13
14
15
16
17
18
19
# File 'lib/beta_builder/deployment_strategies/testflight.rb', line 13

def extended_configuration_for_strategy
  proc do
    def generate_release_notes(&block)
      self.release_notes = block if block
    end
  end
end