shenzhen 0.5.4 → 0.6.0

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: f833044608f4fcd81227646a34176daaeb1c6d08
4
- data.tar.gz: 8443853a16209f5259cd2461d3d33a656a892a27
3
+ metadata.gz: 9ebfc5a3bdab8ba1bccc7c1d93ff4c146dc66020
4
+ data.tar.gz: 8cb8638db47c593660ab11b0f325deed53ea858c
5
5
  SHA512:
6
- metadata.gz: b27879288458c6b3290b277e2f2c5b2dfe24d9d871d58319a1a5e0b24b7753a94684ce7ce8192273f839ba807bf8e2ce49d67f178c99f8afd032ead997ef7860
7
- data.tar.gz: a5067c805286831ceb0df9eabae770ea8aa0ceaf1ac86d190c7db62eebcb3b9610b26dc0fcbeff7c0509a76d035ff728744f14e5436f265f4776c8fe17caa411
6
+ metadata.gz: b853584db4fc708b4b2c834c031a50280af62e42370568b1286f1c6a59908e4feeb798bb273f0ff24b414e24c880a958378b6d5525ab9d1235ef4729aa13b354
7
+ data.tar.gz: 235d5a50b1cdddac4eefa5da37325a3deff3aea99abdfcac3054ae6a8ccc654c9a758ca945c3167ac1d5f5bdb7cd7720e1c94c0d54e0c425362baeb0ead84640
@@ -1,46 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shenzhen (0.5.4)
4
+ shenzhen (0.6.0)
5
5
  aws-sdk (~> 1.0)
6
6
  commander (~> 4.1)
7
7
  dotenv (~> 0.7)
8
- faraday (~> 0.8)
8
+ faraday (~> 0.8.9)
9
9
  faraday_middleware (~> 0.9)
10
10
  json (~> 1.8)
11
11
  net-sftp (~> 2.1.2)
12
+ plist (~> 3.1.0)
13
+ rubyzip (~> 1.1)
14
+ terminal-table (~> 1.4.5)
12
15
 
13
16
  GEM
14
17
  remote: https://rubygems.org/
15
18
  specs:
16
- aws-sdk (1.26.0)
19
+ aws-sdk (1.38.0)
17
20
  json (~> 1.4)
18
- nokogiri (>= 1.4.4, < 1.6.0)
21
+ nokogiri (>= 1.4.4)
19
22
  uuidtools (~> 2.1)
20
- commander (4.1.5)
23
+ commander (4.1.6)
21
24
  highline (~> 1.6.11)
22
25
  diff-lcs (1.2.5)
23
- dotenv (0.9.0)
24
- faraday (0.8.8)
26
+ dotenv (0.10.0)
27
+ faraday (0.8.9)
25
28
  multipart-post (~> 1.2.0)
26
29
  faraday_middleware (0.9.0)
27
30
  faraday (>= 0.7.4, < 0.9)
28
- highline (1.6.20)
31
+ highline (1.6.21)
29
32
  json (1.8.1)
33
+ mini_portile (0.5.3)
30
34
  multipart-post (1.2.0)
31
35
  net-sftp (2.1.2)
32
36
  net-ssh (>= 2.6.5)
33
- net-ssh (2.7.0)
34
- nokogiri (1.5.10)
35
- rake (10.1.0)
37
+ net-ssh (2.8.0)
38
+ nokogiri (1.6.1)
39
+ mini_portile (~> 0.5.0)
40
+ plist (3.1.0)
41
+ rake (10.2.1)
36
42
  rspec (2.14.1)
37
43
  rspec-core (~> 2.14.0)
38
44
  rspec-expectations (~> 2.14.0)
39
45
  rspec-mocks (~> 2.14.0)
40
- rspec-core (2.14.7)
41
- rspec-expectations (2.14.4)
46
+ rspec-core (2.14.8)
47
+ rspec-expectations (2.14.5)
42
48
  diff-lcs (>= 1.1.3, < 2.0)
43
- rspec-mocks (2.14.4)
49
+ rspec-mocks (2.14.6)
50
+ rubyzip (1.1.2)
51
+ terminal-table (1.4.5)
44
52
  uuidtools (2.1.4)
45
53
 
46
54
  PLATFORMS
data/README.md CHANGED
@@ -49,7 +49,7 @@ Shenzhen adds the `ipa` command to your PATH:
49
49
 
50
50
  #### HockeyApp Distribution
51
51
 
52
- $ ipa distribute:hockeyapp -t API_TOKEN
52
+ $ ipa distribute:hockeyapp --token API_TOKEN
53
53
 
54
54
  > Shenzhen will load credentials from the environment variable `HOCKEYAPP_API_TOKEN` unless otherwise specified.
55
55
 
data/bin/ipa CHANGED
@@ -4,6 +4,7 @@ require 'dotenv'
4
4
  Dotenv.load
5
5
 
6
6
  require 'commander/import'
7
+ require 'terminal-table'
7
8
 
8
9
  $:.push File.expand_path("../../lib", __FILE__)
9
10
  require 'shenzhen'
@@ -7,4 +7,4 @@ require 'plugins/s3'
7
7
 
8
8
  require 'commands/build'
9
9
  require 'commands/distribute'
10
-
10
+ require 'commands/info'
@@ -0,0 +1,63 @@
1
+ require 'plist'
2
+ require 'tempfile'
3
+ require 'zip'
4
+
5
+ command :info do |c|
6
+ c.syntax = 'ipa info [options]'
7
+ c.summary = 'Show mobile provisioning information about an .ipa file'
8
+ c.description = ''
9
+
10
+ c.action do |args, options|
11
+ say_error "`security` command not found in $PATH" and abort if `which security` == ""
12
+
13
+ determine_file! unless @file = args.pop
14
+ say_error "Missing or unspecified .ipa file" and abort unless @file and ::File.exist?(@file)
15
+
16
+ Zip::File.open(@file) do |zipfile|
17
+ entry = zipfile.find_entry("Payload/#{File.basename(@file)}.app/embedded.mobileprovision")
18
+ say_error "Embedded mobile provisioning file not found in #{@file}" and abort unless entry
19
+
20
+ tempfile = Tempfile.new(::File.basename(entry.name))
21
+ begin
22
+ zipfile.extract(entry, tempfile.path)
23
+ plist = Plist::parse_xml(`security cms -D -i #{tempfile.path}`)
24
+
25
+ table = Terminal::Table.new do |t|
26
+ plist.each do |key, value|
27
+ next if key == "DeveloperCertificates"
28
+
29
+ columns = []
30
+ columns << key
31
+ columns << case value
32
+ when Hash
33
+ value.collect{|k, v| "#{k}: #{v}"}.join("\n")
34
+ else
35
+ value.to_s
36
+ end
37
+
38
+ t << columns
39
+ end
40
+ end
41
+
42
+ puts table
43
+
44
+ rescue => e
45
+ say_error e.message
46
+ ensure
47
+ tempfile.close and tempfile.unlink
48
+ end
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def determine_file!
55
+ files = Dir['*.ipa']
56
+ @file ||= case files.length
57
+ when 0 then nil
58
+ when 1 then files.first
59
+ else
60
+ @file = choose "Select an .ipa File:", *files
61
+ end
62
+ end
63
+ end
@@ -5,14 +5,14 @@ module Shenzhen::Plugins
5
5
  module FTP
6
6
  class Client
7
7
 
8
- def initialize(host, user, password)
9
- @host, @user, @password = host, user, password
8
+ def initialize(host, port, user, password)
9
+ @host, @port, @user, @password = host, port, user, password
10
10
  end
11
11
 
12
12
  def upload(ipa, options = {})
13
13
  connection = Net::FTP.new
14
14
  connection.passive = true
15
- connection.connect(@host)
15
+ connection.connect(@host, @port)
16
16
 
17
17
  path = expand_path_with_substitutions_from_ipa_plist(ipa, options[:path])
18
18
 
@@ -43,15 +43,13 @@ module Shenzhen::Plugins
43
43
  private
44
44
 
45
45
  def expand_path_with_substitutions_from_ipa_plist(ipa, path)
46
- components = []
47
-
48
46
  substitutions = path.scan(/\{CFBundle[^}]+\}/)
49
47
  return path if substitutions.empty?
50
48
 
51
49
  Dir.mktmpdir do |dir|
52
50
  system "unzip -q #{ipa} -d #{dir} 2> /dev/null"
53
51
 
54
- plist = Dir["#{dir}/**/Info.plist"].last
52
+ plist = Dir["#{dir}/**/*.app/Info.plist"].last
55
53
 
56
54
  substitutions.uniq.each do |substitution|
57
55
  key = substitution[1...-1]
@@ -69,20 +67,31 @@ module Shenzhen::Plugins
69
67
  module SFTP
70
68
  class Client < Shenzhen::Plugins::FTP::Client
71
69
  def upload(ipa, options = {})
72
- session = Net::SSH.start(@host, @user, :password => @password)
70
+ session = Net::SSH.start(@host, @user, :password => @password, :port => @port)
73
71
  connection = Net::SFTP::Session.new(session).connect!
74
72
 
75
73
  path = expand_path_with_substitutions_from_ipa_plist(ipa, options[:path])
76
74
 
77
75
  begin
78
- connection.mkdir! path if options[:mkdir]
79
- connection.upload! ipa, "#{path}/#{File.basename(ipa)}"
80
- connection.upload! options[:dsym], "#{path}/#{File.basename(options[:dsym])}" if options[:dsym]
76
+ connection.stat!(path) do |response|
77
+ connection.mkdir! path if options[:mkdir] and not response.ok?
78
+
79
+ connection.upload! ipa, determine_file_path(File.basename(ipa), path)
80
+ connection.upload! options[:dsym], determine_file_path(File.basename(options[:dsym]), path) if options[:dsym]
81
+ end
81
82
  ensure
82
83
  connection.close_channel
83
84
  session.shutdown!
84
85
  end
85
86
  end
87
+
88
+ def determine_file_path(file_name, path)
89
+ if path.empty?
90
+ file_name
91
+ else
92
+ "#{path}/#{file_name}"
93
+ end
94
+ end
86
95
  end
87
96
  end
88
97
  end
@@ -99,7 +108,8 @@ command :'distribute:ftp' do |c|
99
108
  c.option '-h', '--host HOST', "FTP host"
100
109
  c.option '-u', '--user USER', "FTP user"
101
110
  c.option '-p', '--password PASS', "FTP password"
102
- c.option '-P', '--path PATH', "FTP path. Values from Info.plist will be substituded for keys wrapped in {} \n\t\t eg. \"/path/to/folder/{CFBundleVersion}/\" could be evaluated as \"/path/to/folder/1.0.0/\""
111
+ c.option '-P', '--path PATH', "FTP path. Values from Info.plist will be substituted for keys wrapped in {} \n\t\t e.g. \"/path/to/folder/{CFBundleVersion}/\" would be evaluated as \"/path/to/folder/1.0.0/\""
112
+ c.option '--port PORT', "FTP port"
103
113
  c.option '--protocol [PROTOCOL]', [:ftp, :sftp], "Protocol to use (ftp, sftp)"
104
114
  c.option '--[no-]mkdir', "Create directories on FTP if they don't already exist"
105
115
 
@@ -115,6 +125,8 @@ command :'distribute:ftp' do |c|
115
125
  determine_host! unless @host = options.host
116
126
  say_error "Missing FTP host" and abort unless @host
117
127
 
128
+ determine_port!(options.protocol) unless @port = options.port
129
+
118
130
  determine_user! unless @user = options.user
119
131
  say_error "Missing FTP user" and abort unless @user
120
132
 
@@ -125,9 +137,9 @@ command :'distribute:ftp' do |c|
125
137
 
126
138
  client = case options.protocol
127
139
  when :sftp
128
- Shenzhen::Plugins::SFTP::Client.new(@host, @user, @password)
140
+ Shenzhen::Plugins::SFTP::Client.new(@host, @port, @user, @password)
129
141
  else
130
- Shenzhen::Plugins::FTP::Client.new(@host, @user, @password)
142
+ Shenzhen::Plugins::FTP::Client.new(@host, @port, @user, @password)
131
143
  end
132
144
 
133
145
  begin
@@ -144,6 +156,15 @@ command :'distribute:ftp' do |c|
144
156
  @host ||= ask "FTP Host:"
145
157
  end
146
158
 
159
+ def determine_port!(protocol)
160
+ @port = case protocol
161
+ when :sftp
162
+ Net::SSH::Transport::Session::DEFAULT_PORT
163
+ else
164
+ Net::FTP::FTP_PORT
165
+ end
166
+ end
167
+
147
168
  def determine_user!
148
169
  @user ||= ask "Username:"
149
170
  end
@@ -81,9 +81,9 @@ command :'distribute:hockeyapp' do |c|
81
81
  parameters[:dsym_filename] = @dsym if @dsym
82
82
  parameters[:mandatory] = "1" if options.mandatory
83
83
  parameters[:release_type] = case options.release
84
- when "beta", "0"
84
+ when :beta
85
85
  "0"
86
- when "live", "1"
86
+ when :live
87
87
  "1"
88
88
  else
89
89
  "2"
@@ -30,8 +30,6 @@ module Shenzhen::Plugins
30
30
  private
31
31
 
32
32
  def expand_path_with_substitutions_from_ipa_plist(ipa, path)
33
- components = []
34
-
35
33
  substitutions = path.scan(/\{CFBundle[^}]+\}/)
36
34
  return path if substitutions.empty?
37
35
 
@@ -83,7 +83,7 @@ command :'distribute:testflight' do |c|
83
83
  when 200...300
84
84
  say_ok "Build successfully uploaded to TestFlight"
85
85
  else
86
- say_error "Error uploading to TestFlight: #{response.body}"
86
+ say_error "Error uploading to TestFlight: #{response.body}" and abort
87
87
  end
88
88
  end
89
89
 
@@ -1,3 +1,3 @@
1
1
  module Shenzhen
2
- VERSION = '0.5.4'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -7,19 +7,22 @@ Gem::Specification.new do |s|
7
7
  s.name = "shenzhen"
8
8
  s.authors = ["Mattt Thompson"]
9
9
  s.email = "m@mattt.me"
10
- s.homepage = "http://github.com/mattt/shenzhen"
10
+ s.homepage = "http://nomad-cli.com"
11
11
  s.version = Shenzhen::VERSION
12
12
  s.platform = Gem::Platform::RUBY
13
13
  s.summary = "Shenzhen"
14
14
  s.description = "CLI for Building & Distributing iOS Apps (.ipa Files)"
15
15
 
16
16
  s.add_dependency "commander", "~> 4.1"
17
+ s.add_dependency "terminal-table", "~> 1.4.5"
17
18
  s.add_dependency "json", "~> 1.8"
18
- s.add_dependency "faraday", "~> 0.8"
19
+ s.add_dependency "faraday", "~> 0.8.9"
19
20
  s.add_dependency "faraday_middleware", "~> 0.9"
20
21
  s.add_dependency "dotenv", "~> 0.7"
21
22
  s.add_dependency "aws-sdk", "~> 1.0"
22
23
  s.add_dependency "net-sftp", "~> 2.1.2"
24
+ s.add_dependency "plist", "~> 3.1.0"
25
+ s.add_dependency "rubyzip", "~> 1.1"
23
26
 
24
27
  s.add_development_dependency "rspec"
25
28
  s.add_development_dependency "rake"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shenzhen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattt Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: terminal-table
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.5
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: json
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +58,14 @@ dependencies:
44
58
  requirements:
45
59
  - - ~>
46
60
  - !ruby/object:Gem::Version
47
- version: '0.8'
61
+ version: 0.8.9
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ~>
53
67
  - !ruby/object:Gem::Version
54
- version: '0.8'
68
+ version: 0.8.9
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: faraday_middleware
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +122,34 @@ dependencies:
108
122
  - - ~>
109
123
  - !ruby/object:Gem::Version
110
124
  version: 2.1.2
125
+ - !ruby/object:Gem::Dependency
126
+ name: plist
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 3.1.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: 3.1.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubyzip
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: '1.1'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '1.1'
111
153
  - !ruby/object:Gem::Dependency
112
154
  name: rspec
113
155
  requirement: !ruby/object:Gem::Requirement
@@ -148,6 +190,7 @@ files:
148
190
  - ./lib/shenzhen/agvtool.rb
149
191
  - ./lib/shenzhen/commands/build.rb
150
192
  - ./lib/shenzhen/commands/distribute.rb
193
+ - ./lib/shenzhen/commands/info.rb
151
194
  - ./lib/shenzhen/commands.rb
152
195
  - ./lib/shenzhen/plistbuddy.rb
153
196
  - ./lib/shenzhen/plugins/ftp.rb
@@ -162,7 +205,7 @@ files:
162
205
  - ./README.md
163
206
  - ./shenzhen.gemspec
164
207
  - bin/ipa
165
- homepage: http://github.com/mattt/shenzhen
208
+ homepage: http://nomad-cli.com
166
209
  licenses: []
167
210
  metadata: {}
168
211
  post_install_message: