Class: BetaBuilder::DeploymentStrategies::HockeyApp

Inherits:
Strategy
  • Object
show all
Defined in:
lib/beta_builder/deployment_strategies/hockeyapp.rb

Constant Summary collapse

ENDPOINT =
"https://rink.hockeyapp.net/api/2/apps"

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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/beta_builder/deployment_strategies/hockeyapp.rb', line 6

def deploy

  payload = {
    :ipa => File.new(@configuration.ipa_path, 'rb'),
    :notify => "1",
    :status => "2"
  }
    
  puts "Uploading build to HockeyApp..."
    
  if @configuration.dry_run 
    puts '** Dry Run - No action here! **'
    return
  end
    
  begin
    response = RestClient.post(ENDPOINT, payload, {:accept => :json, :"X-HockeyAppToken"=> @configuration.api_token})
  rescue => e
    response = e.response
  end
    
  if (response.code == 201) || (response.code == 200)
    puts "Upload complete."
  else
    puts "Upload failed. (#{JSON.parse(response)})"
  end
end