Class: Xcode::Deploy::Testflight
- Inherits:
-
Object
- Object
- Xcode::Deploy::Testflight
- Defined in:
- lib/xcode/deploy/testflight.rb
Constant Summary collapse
- @@defaults =
{}
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#builder ⇒ Object
Returns the value of attribute builder.
-
#lists ⇒ Object
Returns the value of attribute lists.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#notify ⇒ Object
Returns the value of attribute notify.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#team_token ⇒ Object
Returns the value of attribute team_token.
Class Method Summary collapse
Instance Method Summary collapse
- #deploy {|json| ... } ⇒ Object
-
#initialize(builder, options = {}) ⇒ Testflight
constructor
A new instance of Testflight.
Constructor Details
#initialize(builder, options = {}) ⇒ Testflight
Returns a new instance of Testflight.
13 14 15 16 17 18 19 20 21 |
# File 'lib/xcode/deploy/testflight.rb', line 13 def initialize(builder, ={}) @builder = builder @api_token = [:api_token]||@@defaults[:api_token] @team_token = [:team_token]||@@defaults[:team_token] @notify = .has_key?(:notify) ? [:notify] : true @notes = [:notes] @lists = [:lists]||[] @proxy = ENV['http_proxy'] || ENV['HTTP_PROXY'] end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def api_token @api_token end |
#builder ⇒ Object
Returns the value of attribute builder.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def builder @builder end |
#lists ⇒ Object
Returns the value of attribute lists.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def lists @lists end |
#notes ⇒ Object
Returns the value of attribute notes.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def notes @notes end |
#notify ⇒ Object
Returns the value of attribute notify.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def notify @notify end |
#proxy ⇒ Object
Returns the value of attribute proxy.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def proxy @proxy end |
#team_token ⇒ Object
Returns the value of attribute team_token.
6 7 8 |
# File 'lib/xcode/deploy/testflight.rb', line 6 def team_token @team_token end |
Class Method Details
.defaults(defaults = {}) ⇒ Object
9 10 11 |
# File 'lib/xcode/deploy/testflight.rb', line 9 def self.defaults(defaults={}) @@defaults = defaults end |
Instance Method Details
#deploy {|json| ... } ⇒ Object
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 57 58 59 60 61 62 |
# File 'lib/xcode/deploy/testflight.rb', line 23 def deploy puts "Uploading to Testflight..." # RestClient.proxy = @proxy || ENV['http_proxy'] || ENV['HTTP_PROXY'] # RestClient.log = '/tmp/restclient.log' # # response = RestClient.post('http://testflightapp.com/api/builds.json', # :file => File.new(builder.ipa_path), # :dsym => File.new(builder.dsym_zip_path), # :api_token => @api_token, # :team_token => @team_token, # :notes => @notes, # :notify => @notify ? 'True' : 'False', # :distribution_lists => @lists.join(',') # ) # # json = JSON.parse(response) # puts " + Done, got: #{json.inspect}" # json cmd = Xcode::Shell::Command.new 'curl' cmd << "--proxy #{@proxy}" unless @proxy.nil? or @proxy=='' cmd << "-X POST http://testflightapp.com/api/builds.json" cmd << "-F file=@\"#{@builder.ipa_path}\"" cmd << "-F dsym=@\"#{@builder.dsym_zip_path}\"" unless @builder.dsym_zip_path.nil? cmd << "-F api_token='#{@api_token}'" cmd << "-F team_token='#{@team_token}'" cmd << "-F notes=\"#{@notes}\"" unless @notes.nil? cmd << "-F notify=#{@notify ? 'True' : 'False'}" cmd << "-F distribution_lists='#{@lists.join(',')}'" unless @lists.count==0 response = cmd.execute json = MultiJson.load(response.join('')) puts " + Done, got: #{json.inspect}" yield(json) if block_given? json end |