Class: XcodeBuilder::DeploymentStrategies::TestFlight

Inherits:
Strategy
  • Object
show all
Includes:
FileUtils, Rake::DSL
Defined in:
lib/xcode_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 XcodeBuilder::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
# File 'lib/xcode_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
  }
  
  print "Uploading build to TestFlight..."        
  
  statusCode = 0
  begin
    response = RestClient.post(ENDPOINT, payload, :accept => :json)
    statusCode = response.code
  rescue => e
    puts "TestFlight upload failed with exception:\n#{e}Response\n#{e.response}"
  end
  
  if (statusCode == 201) || (statusCode == 200)
    puts "Done."

  end
end

#extended_configuration_for_strategyObject



13
14
15
16
17
18
19
# File 'lib/xcode_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