Class: Wox::TestFlight

Inherits:
Task
  • Object
show all
Includes:
Environment
Defined in:
lib/wox/test_flight.rb

Instance Attribute Summary

Attributes included from Environment

#environment

Instance Method Summary collapse

Methods included from Environment

#initialize

Methods inherited from Task

#run_command

Instance Method Details

#listsObject



9
10
11
# File 'lib/wox/test_flight.rb', line 9

def lists
  environment[:notify].respond_to?(:join) ? environment[:notify].join(",") : environment[:notify]
end

#notesObject



5
6
7
# File 'lib/wox/test_flight.rb', line 5

def notes
  environment[:notes].respond_to?(:call) ? environment[:notes].call : environment[:notes]
end

#publishObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/wox/test_flight.rb', line 13

def publish
  args = { 
    :file => "@#{environment.ipa_file}",
    :api_token => environment[:api_token],
    :team_token => environment[:team_token],
    :notes => notes
  }
  if environment[:notify]
    args[:notify] = "True"
    args[:distribution_lists] = lists
  end
  
  arg_string = args.map {|k,v| "-F #{k}='#{v}'"}.join(" ")
  
  puts "Uploading ipa to TestFlight"
  log_file = File.join environment[:build_dir], "testflight.log"
  run_command "curl --progress-bar #{arg_string} http://testflightapp.com/api/builds.json", :results => log_file
end