TestFlightExporter 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49edec33f61589e8ddbd34846dcc1a8c351a1c4c
4
- data.tar.gz: 9c340d619172c7850d7defb61cb136f5a7adfc57
3
+ metadata.gz: 4b6794d5fb2bbfe704fce57b128127b0982207e9
4
+ data.tar.gz: a8fd5c3cdcf1c86b2503233478ee638f8fcfa657
5
5
  SHA512:
6
- metadata.gz: ce5af64550485ef21cc2a034c49ba53446f95f30afb939294537f830b227314071fafa247cbb2dfba249099f84a3aced03adeaa5ba66f23a724d9319812c69a4
7
- data.tar.gz: bf27ffeb9e4d71ddf831fa965208913c152159436c6fdbfc95175a0484b89f739530fac6e2878b065473b6061116c2476aa54d5a87bd655b8be8b68350fb616f
6
+ metadata.gz: b4f1ef0c295ab49ab8c8b431df19dbfcbe56a837e5e2f4f4fdce273abf480e969b42738abbf1edcdd54b3ca02ba0b1f0373a70ad30a1ccab7cbcacbad8997f52
7
+ data.tar.gz: 9017c54b3e1a08b6bc828340f17116249f4c2dfdfb8516defad876a267a273967cd451dd3df874a018b76e85ec1a6a2734a4b854ed1cba91e807ddda5abfeefb
data/bin/tfexporter CHANGED
@@ -6,6 +6,7 @@ require 'commander'
6
6
  require 'highline'
7
7
  require_relative '../lib/testflight_exporter/version'
8
8
  require_relative '../lib/testflight_exporter'
9
+ require_relative '../lib/hockeyapp_uploader'
9
10
 
10
11
  HighLine.track_eof = false
11
12
 
@@ -21,16 +22,16 @@ class TestFlightExporterApplication
21
22
  program :help_formatter, :compact
22
23
 
23
24
  global_option '--verbose'
24
- global_option '--username STRING', String, 'Your testflight account username'
25
- global_option '--password STRING', String, 'Your testflight account password'
26
- global_option '--output STRING', String, 'Path to your output folder where your binaries will be downloaded'
27
- global_option '--team STRING', String, 'Team name to process'
28
25
 
29
26
  always_trace!
30
27
 
31
- command :migrate do |c|
28
+ command :dump do |c|
32
29
  c.syntax = 'tfexporter migrate'
33
- c.description = 'Helps you setting up all requirements to run a migration.'
30
+ c.description = 'Download your binaries from TestFlightapp.com'
31
+ c.option '--username STRING', String, 'Your testflight account username'
32
+ c.option '--password STRING', String, 'Your testflight account password'
33
+ c.option '--output FOLDER', String, 'Path to your output folder where your binaries will be downloaded'
34
+ c.option '--team TEAM', String, 'TestFlight team name to process'
34
35
 
35
36
  c.action do |args, options|
36
37
  ENV['VERBOSE_MODE'] = 'true' if options.verbose
@@ -39,7 +40,21 @@ class TestFlightExporterApplication
39
40
  end
40
41
  end
41
42
 
42
- default_command :migrate
43
+ command :hockeyapp do |c|
44
+ c.syntax = 'tfexporter hockeyapp'
45
+ c.description = 'Upload your binaries to Hockeyapp platform (API TOKEN required).'
46
+ c.option '--token STRING', String, 'Your hockey app token'
47
+ c.option '--input FOLDER', String, 'Your binaries folder'
48
+ c.option '--teams TEAMS', "Comma separated list of team ID numbers to which this build will be restricted"
49
+
50
+ c.action do |args, options|
51
+ ENV['VERBOSE_MODE'] = 'true' if options.verbose
52
+
53
+ TestFlightExporter::HockeyAppUploader.new.run(options.token, options.input, options.teams)
54
+ end
55
+ end
56
+
57
+ default_command :help
43
58
 
44
59
  run!
45
60
  end
@@ -0,0 +1,63 @@
1
+ require 'fileutils'
2
+ require 'colored'
3
+
4
+
5
+ require_relative 'helpers'
6
+
7
+ # TODO: Workaround, since hockeyapp.rb from shenzhen includes the code for commander
8
+ def command(param)
9
+ end
10
+
11
+ module TestFlightExporter
12
+
13
+ include Helper
14
+
15
+ class HockeyAppUploader
16
+
17
+ def run (token = nil, directory=nil, teams=nil)
18
+ Helper.exit_with_error "Invalid API token. Use --token to specify your HockeyApp API token" if token.nil?
19
+ Helper.exit_with_error "Invalid input folder. Use --input to specify an input folder" if directory.nil?
20
+
21
+ require 'shenzhen'
22
+ require 'shenzhen/plugins/hockeyapp'
23
+
24
+ # Available options: http://support.hockeyapp.net/kb/api/api-versions#upload-version
25
+ options = {
26
+ status: 2
27
+ }
28
+
29
+ options.merge!(teams: teams) unless teams.nil?
30
+
31
+ Helper.log.info "Uploadind binaries to Hockeyapp platform... this could take some time.".blue
32
+
33
+ number_of_builds = 0
34
+
35
+ Dir.glob("#{directory}/**/*.ipa") { |filename|
36
+
37
+ Helper.log.debug "Starting with #{filename} upload to HockeyApp...".magenta
38
+
39
+ notes = filename.gsub(/.ipa/,'.txt')
40
+
41
+ File.open(notes) do |file|
42
+ options.merge!(notes: File.read(file))
43
+ end
44
+
45
+ client = Shenzhen::Plugins::HockeyApp::Client.new(token)
46
+ response = client.upload_build(filename, options)
47
+ case response.status
48
+ when 200...300
49
+ url = response.body['public_url']
50
+
51
+ Helper.log.debug"Public Download URL: #{url}".white if url
52
+ Helper.log.debug "Build successfully uploaded to HockeyApp!".green
53
+ number_of_builds = number_of_builds + 1
54
+ else
55
+ Helper.log.error "Error uploading to HockeyApp: #{response.body}"
56
+ Helper.exit_with_error "Error when trying to upload ipa to HockeyApp".red
57
+ end
58
+ }
59
+
60
+ Helper.log.info "Uploaded #{number_of_builds} binaries on Hockeyapp platform!".blue
61
+ end
62
+ end
63
+ end
@@ -1,3 +1,3 @@
1
1
  module TestFlightExporter
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.add_dependency 'highline', '~> 1.6' # user inputs (e.g. passwords)
21
21
  spec.add_dependency 'colored' # coloured terminal output
22
22
  spec.add_dependency 'commander', '~> 4.2' # CLI parser
23
+ spec.add_dependency 'shenzhen' # IPA Distribution
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.7"
25
26
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: TestFlightExporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Milano
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '4.2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: shenzhen
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -110,6 +124,7 @@ files:
110
124
  - assets/tw_logo.png
111
125
  - bin/tfexporter
112
126
  - lib/helpers.rb
127
+ - lib/hockeyapp_uploader.rb
113
128
  - lib/testflight_exporter.rb
114
129
  - lib/testflight_exporter/version.rb
115
130
  - testflight_exporter.gemspec