TestFlightExporter 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63e970e8a2b5334d2df6bcdc542ab38b8214075b
4
- data.tar.gz: 48da93bec74cd46805875559ea924cfb372d303f
3
+ metadata.gz: 58e49943cdcd3495dd08f0e3bafbd05dfe93e1b5
4
+ data.tar.gz: 0cbc459eba012e0c4d6e65d67664edc1d29c122a
5
5
  SHA512:
6
- metadata.gz: 0cee61c44ba82a4eab587422c267b0ace78542f0ff823d65a3af7637d2cd0219ccaf72519ccfeedfa1a9037d5c3eef6ecacdaf4abc259d62e05120d9f633dd03
7
- data.tar.gz: 9049c4ede595d6d12f8bb2a1adfc9278ea024adddf29888925a8fd700dc9db126d015b203ef79447fc5d0f42c2c4f02eb60c33f9242201e64887c35d4bdc629f
6
+ metadata.gz: f9e6c5d02bbdb97978968a3517c5cdb6490ae5598d4651f14be155ef84ba44257a769bf2aa41a55ea8fe9b59109e3558bc2806ab7c790ca7725342a6cd4b1caa
7
+ data.tar.gz: 114d0d7a42dae44298370ce615e76b36dd49815fe0df7136e93797c87a6d6fdf184d198da3e5ccafa9829858170ee2477c92e91976ffdf1026ea3a9efb6ddd83
data/README.md CHANGED
@@ -43,6 +43,18 @@ To get a list of available options, execute:
43
43
 
44
44
  $ tfexporter hockeyapp --help
45
45
 
46
+ ### DeployGate integration
47
+
48
+ Since version 0.2.2 TestFlight exporter supports the upload of your downloaded binaries on DeployGate platform.
49
+ Execute the following command in your terminal:
50
+
51
+ $ tfexporter deploygate --username [YOUR_USERNAME] --token [YOUR_API_TOKEN] --input [YOUR_BINARIES_PATH]
52
+
53
+
54
+ To get a list of available options, execute:
55
+
56
+ $ tfexporter deploygate --help
57
+
46
58
  ## How does this thing work?
47
59
 
48
60
  TestFlight doesn't provide any API to perform such task like exporting your .ipa's. TestFlight Exporter uses [mechanize](https://github.com/sparklemotion/mechanize) to automatically find and follow the download links on the TestFlight website.
data/bin/tfexporter CHANGED
@@ -7,6 +7,7 @@ require 'highline'
7
7
  require_relative '../lib/testflight_exporter/version'
8
8
  require_relative '../lib/testflight_exporter'
9
9
  require_relative '../lib/hockeyapp_uploader'
10
+ require_relative '../lib/deploygate_uploader'
10
11
 
11
12
  HighLine.track_eof = false
12
13
 
@@ -55,6 +56,20 @@ class TestFlightExporterApplication
55
56
  end
56
57
  end
57
58
 
59
+ command :deploygate do |c|
60
+ c.syntax = 'tfexporter deploygate'
61
+ c.description = 'Upload your binaries to DeployGate platform (API TOKEN and USERNAME required).'
62
+ c.option '--token STRING', String, 'Your DeployGate token'
63
+ c.option '--input FOLDER', String, 'Your binaries folder'
64
+ c.option '--username STRING', String, "Your deploygate username"
65
+
66
+ c.action do |args, options|
67
+ ENV['VERBOSE_MODE'] = 'true' if options.verbose
68
+
69
+ TestFlightExporter::DeployGateUploader.run(options)
70
+ end
71
+ end
72
+
58
73
  default_command :help
59
74
 
60
75
  run!
@@ -0,0 +1,91 @@
1
+ # TODO: Workaround, since deploygate.rb from shenzhen includes the code for commander
2
+ def command(_param)
3
+ end
4
+
5
+ module TestFlightExporter
6
+
7
+ class DeployGateUploader
8
+ DEPLOYGATE_URL_BASE = 'https://deploygate.com'
9
+
10
+ def self.run(params)
11
+ Helper.exit_with_error "Invalid user. Use --username to specify a valid username" if params.username.nil?
12
+ Helper.exit_with_error "Invalid API token. Use --token to specify your DeployGate API token" if params.token.nil?
13
+ Helper.exit_with_error "Invalid input folder. Use --input to specify an input folder" if params.input.nil?
14
+
15
+ username = params.username
16
+ token = params.token
17
+ directory = params.input
18
+
19
+ require 'shenzhen'
20
+ require 'shenzhen/plugins/deploygate'
21
+
22
+
23
+ Helper.log.info 'Starting with ipa upload to DeployGate... this could take some time ⏳'.green
24
+
25
+
26
+ client = Shenzhen::Plugins::DeployGate::Client.new(
27
+ token,
28
+ username
29
+ )
30
+
31
+ number_of_builds = 0
32
+
33
+ Dir.glob("#{directory}/**/*.ipa") { |filename|
34
+
35
+ Helper.log.debug "Starting with #{filename} upload to DeployGate...".magenta
36
+
37
+ notes = filename.gsub(/.ipa/,'.txt')
38
+
39
+ # Available options: https://deploygate.com/docs/api
40
+ options = nil
41
+ File.open(notes) do |file|
42
+ options = { message: File.read(file) }
43
+ end
44
+
45
+ response = client.upload_build(filename, options)
46
+ if parse_response(response)
47
+ Helper.log.debug"Public Download URL: #{@url_success}".white if @url_success
48
+ Helper.log.debug "Build successfully uploaded to DeployGate!".green
49
+ number_of_builds = number_of_builds + 1
50
+ else
51
+ Helper.exit_with_error 'Error when trying to upload ipa to DeployGate'.red
52
+ end
53
+ }
54
+ Helper.log.info "Uploaded #{number_of_builds} binaries on DeployGate platform!".blue
55
+
56
+ end
57
+
58
+ def self.parse_response(response)
59
+ if response.body && response.body.key?('error')
60
+ unless response.body['error']
61
+ res = response.body['results']
62
+ url = DEPLOYGATE_URL_BASE + res['path']
63
+
64
+ @url_success = url
65
+ else
66
+ Helper.log.error "Error uploading to DeployGate: #{response.body['message']}".red
67
+ help_message(response)
68
+ return
69
+ end
70
+ else
71
+ Helper.exit_with_error "Error uploading to DeployGate: #{response.body}".red
72
+ end
73
+ true
74
+ end
75
+ private_class_method :parse_response
76
+
77
+ def self.help_message(response)
78
+ message =
79
+ case response.body['message']
80
+ when 'you are not authenticated'
81
+ 'Invalid API Token specified.'
82
+ when 'application create error: permit'
83
+ 'Access denied: May be trying to upload to wrong user or updating app you join as a tester?'
84
+ when 'application create error: limit'
85
+ 'Plan limit: You have reached to the limit of current plan or your plan was expired.'
86
+ end
87
+ Helper.log.error message.red if message
88
+ end
89
+ private_class_method :help_message
90
+ end
91
+ end
@@ -20,7 +20,7 @@ module TestFlightExporter
20
20
  @username = options.username
21
21
  @password = options.password
22
22
  @team = options.team
23
- @path = options.output_folder
23
+ @path = options.output
24
24
  @max = options.max
25
25
  @username = ask("Enter your TestFlight username: ") { |q| q.echo = true } if @username.nil?
26
26
  @password = ask("Enter your TestFlight password: ") { |q| q.echo = "*" } if @password.nil?
@@ -1,3 +1,3 @@
1
1
  module TestFlightExporter
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TestFlightExporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Milano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -123,6 +123,7 @@ files:
123
123
  - Rakefile
124
124
  - assets/tw_logo.png
125
125
  - bin/tfexporter
126
+ - lib/deploygate_uploader.rb
126
127
  - lib/helpers.rb
127
128
  - lib/hockeyapp_uploader.rb
128
129
  - lib/testflight_exporter.rb