Class: XcodeBuilder::DeploymentStrategies::HockeyApp

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

Constant Summary collapse

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

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
# File 'lib/xcode_builder/deployment_strategies/hockeyapp.rb', line 21

def deploy
  release_notes = get_notes
  payload = {
    :api_token          => @configuration.api_token,
    :ipa               => File.new(@configuration.ipa_path, 'rb'),
    :notes              => release_notes,
    :status             => 2,
    :teams => (@configuration.teams || []).join(","),
  }
  
  print "Uploading build to HockeyApp..."        
  
  statusCode = 0
  begin
    response = RestClient.post(ENDPOINT, payload, :accept => :json, :'X-HockeyAppToken' => @configuration.api_token)
    statusCode = response.code
  rescue => e
    puts "HockeyApp 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/hockeyapp.rb', line 13

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