Class: BetaBuilder::DeploymentStrategies::TestFlight

Inherits:
Strategy
  • Object
show all
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



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/beta_builder/deployment_strategies/testflight.rb', line 19

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
  }
  puts "Uploading build to TestFlight..."
  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
  
  begin
    response = RestClient.post(ENDPOINT, payload, :accept => :json)
  rescue => e
    response = e.response
  end
  
  if (response.code == 201) || (response.code == 200)
    puts "Upload complete."
  else
    puts "Upload failed. (#{response})"
  end
end

#extended_configuration_for_strategyObject



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

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