xcjobs 0.0.7 → 0.0.8

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: e6b499b7d8707eaf6a61042e33d345dc207c2697
4
- data.tar.gz: a80560d7918206203c7e66647b3ea66640fac2b7
3
+ metadata.gz: 76f457f4567b683a3bf3a2b6d1242a065319703e
4
+ data.tar.gz: 5667d8fc64b19fcd08a53d8628374fd1cd88e449
5
5
  SHA512:
6
- metadata.gz: db219848a537f19c8390a5cc61fed225334137b50d668c44918f40f6f44d312052c6178f497bdb398a54e042e44c72506b4d3cf97c55da84d89de34fb9dd61aa
7
- data.tar.gz: 09e96ba95bec3886b4d4b5d9b6c0b041a3ee0d23efa97d293e0ab9f23b584a0c72018b181a7f25f5e61cb2b95dedb419d0fbc369ffdc2d9cde57125a50cbaec0
6
+ metadata.gz: ad1e183858cf11f23d63c9ea3d4f1a3150935d8b3081cf482d68bf15b593dcd72b76a80faca87d7dfffe8bd1d12f944e8dba96b0c5bd35c7fcb2762bc528a181
7
+ data.tar.gz: 069934a3bf57309a10d06d440ba305592246a1d3fe9fa7b384ebcf7df2cd48e05e4d6333095fd70266196c524849c265555b214158669cbdf1ae66776ab3a68e
data/README.md CHANGED
@@ -110,19 +110,19 @@ $ bundle exec rake build:export
110
110
  xcodebuild -exportArchive -exportFormat IPA -archivePath build/Example.xcarchive -exportPath build/Example.ipa -exportProvisioningProfile Ad Hoc Provisioning Profile
111
111
  ```
112
112
 
113
- ### Distribute (Upload to TestFlight/Crittercism)
113
+ ### Distribute (Upload to Crittercism/TestFlight/DeployGate/HockeyApp)
114
114
 
115
115
  ```ruby
116
116
  XCJobs::Distribute::Crittercism.new do |t|
117
117
  t.app_id = 'xxx...'
118
- t.key = 'xxx...'
118
+ t.key = 'yyy...'
119
119
  t.dsym = File.join('build', 'dSYMs.zip')
120
120
  end
121
121
 
122
122
  XCJobs::Distribute::TestFlight.new do |t|
123
123
  t.file = File.join('build', "#{Example}.ipa")
124
124
  t.api_token = 'xxx...'
125
- t.team_token = 'xxx...'
125
+ t.team_token = 'yyy...'
126
126
  t.notify = true
127
127
  t.replace = true
128
128
  t.distribution_lists = 'Dev'
@@ -131,14 +131,36 @@ end
131
131
 
132
132
  XCJobs::Distribute::DeployGate.new do |t|
133
133
  t.owner_name = 'kishikawakatsumi'
134
- t.file = File.join('build', "#{Example}.ipa")
134
+ t.file = File.join('build', "#{Example}.ipa")
135
135
  t.token = 'xxx...'
136
136
  t.message = "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" # optional
137
- t.distribution_key = 'xxx...' # optional
137
+ t.distribution_key = 'yyy...' # optional
138
138
  t.release_note = '...' # optional
139
139
  t.disable_notify = false # optional
140
140
  t.visibility = 'public' # optional
141
141
  end
142
+
143
+ XCJobs::Distribute::Crashlytics.new do |t|
144
+ t.framework_path = '/path/to/Crashlytics.framework'
145
+ t.file = File.join('build', "#{Example}.ipa")
146
+ t.api_key = 'xxx...'
147
+ t.build_secret = 'yyy...'
148
+ t.notes = "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" # optional
149
+ t.notifications = true # optional
150
+ t.add_email('TestEmail@crashlytics.com')
151
+ t.add_email('AmazingTester@twitter.com')
152
+ t.add_group_alias('GroupAlias')
153
+ t.add_group_alias('GroupAlias2')
154
+ end
155
+
156
+ XCJobs::Distribute::HockeyApp.new do |t|
157
+ t.file = File.join('build', "#{Example}.ipa")
158
+ t.dsym = File.join('build', 'dSYMs.zip') # optional
159
+ t.token = 'xxx...'
160
+ t.identifier = 'xxx...'
161
+ t.notes = "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" # optional
162
+ t.notes_type = 1 # optional
163
+ end
142
164
  ```
143
165
 
144
166
  ```shell
@@ -147,6 +169,7 @@ $ rake -T
147
169
  rake distribute:crittercism # upload dSYMs to Crittercism
148
170
  rake distribute:testflight # upload IPA to TestFlight
149
171
  rake distribute:deploygate # upload IPA to DeployGate
172
+ rake distribute:hockeyapp # upload IPA & dSYMs to HockeyApp
150
173
  ```
151
174
 
152
175
  ### Install/Remove certificates (For Travis CI)
@@ -3,13 +3,14 @@ require 'open3'
3
3
 
4
4
  module XCJobs
5
5
  module Distribute
6
- def upload(url, form_data = {})
6
+ def upload(url, form_data = {}, header = {})
7
7
  @before_action.call if @before_action
8
8
 
9
9
  curl_options = ['curl', '-sSf', "#{url}"]
10
10
  form_fields = form_data.flat_map { |k, v| ['-F', "#{k}=#{v}"] }
11
- puts (curl_options + form_fields).join(' ')
12
- Open3.popen2e(*(curl_options + form_fields)) do |stdin, stdout_err, wait_thr|
11
+ header_fields = header.flat_map { |k, v| ['-H', "#{k}:#{v}"] }
12
+ puts (curl_options + form_fields + header_fields).join(' ')
13
+ Open3.popen2e(*(curl_options + form_fields + header_fields)) do |stdin, stdout_err, wait_thr|
13
14
  output = ''
14
15
  while line = stdout_err.gets
15
16
  puts line
@@ -107,7 +108,7 @@ module XCJobs
107
108
  def form_data
108
109
  {}.tap do |fields|
109
110
  fields[:token] = token if token
110
- fields[:file] = "@#{file}" if file
111
+ fields[:file] = "@#{file}" if file
111
112
  fields[:message] = message if message
112
113
  fields[:distribution_key] = distribution_key if distribution_key
113
114
  fields[:release_note] = release_note if release_note
@@ -117,6 +118,106 @@ module XCJobs
117
118
  end
118
119
  end
119
120
 
121
+ class Crashlytics < Rake::TaskLib
122
+ include Rake::DSL if defined?(Rake::DSL)
123
+ include Distribute
124
+
125
+ attr_accessor :framework_path
126
+ attr_accessor :file
127
+ attr_accessor :api_key
128
+ attr_accessor :build_secret
129
+ attr_accessor :notes
130
+ attr_accessor :notifications
131
+
132
+ def initialize()
133
+ @notifications = true
134
+ @emails = []
135
+ @group_aliases = []
136
+ yield self if block_given?
137
+ define
138
+ end
139
+
140
+ def add_email(email)
141
+ @emails << email
142
+ end
143
+
144
+ def add_group_alias(group_alias)
145
+ @group_aliases << group_alias
146
+ end
147
+
148
+ private
149
+
150
+ def define
151
+ namespace :distribute do
152
+ desc 'upload IPA to Beta by Crashlytics'
153
+ task :crashlytics do
154
+ @before_action.call if @before_action
155
+ sh *(["#{File.join(framework_path, 'submit')}"] + options)
156
+ @after_action.call('', SystemExit.new) if @after_action
157
+ end
158
+ end
159
+ end
160
+
161
+ def options
162
+ [].tap do |opts|
163
+ opts << api_key
164
+ opts << build_secret
165
+ opts.concat(['-ipaPath', file]) if file
166
+ opts.concat(['-notifications', 'NO']) unless notifications
167
+ opts.concat(['-emails', @emails.join(',')]) unless @emails.empty?
168
+ opts.concat(['-groupAliases', @group_aliases.join(',')]) unless @group_aliases.empty?
169
+ if notes
170
+ temp = Tempfile.new('release_notes.txt')
171
+ temp.puts(notes)
172
+ opts.concat(['-notesPath', temp.path])
173
+ end
174
+ end
175
+ end
176
+ end
177
+
178
+ class HockeyApp < Rake::TaskLib
179
+ include Rake::DSL if defined?(Rake::DSL)
180
+ include Distribute
181
+
182
+ attr_accessor :file
183
+ attr_accessor :dsym
184
+ attr_accessor :token
185
+ attr_accessor :identifier
186
+ attr_accessor :notes
187
+ attr_accessor :notes_type
188
+
189
+ def initialize()
190
+ yield self if block_given?
191
+ define
192
+ end
193
+
194
+ private
195
+
196
+ def define
197
+ namespace :distribute do
198
+ desc 'upload IPA & dSYMs to HockeyApp'
199
+ task :hockeyapp do
200
+ upload("https://rink.hockeyapp.net/api/2/apps/#{identifier}/app_versions/upload", form_data, header)
201
+ end
202
+ end
203
+ end
204
+
205
+ def form_data
206
+ {}.tap do |fields|
207
+ fields[:ipa] = "@#{file}" if file
208
+ fields[:dsym] = "@#{dsym}" if dsym
209
+ fields[:notes] = notes if notes
210
+ fields[:notes_type] = notes_type if notes_type
211
+ end
212
+ end
213
+
214
+ def header
215
+ {}.tap do |fields|
216
+ fields["X-HockeyAppToken"] = token if token
217
+ end
218
+ end
219
+ end
220
+
120
221
  class Crittercism < Rake::TaskLib
121
222
  include Rake::DSL if defined?(Rake::DSL)
122
223
  include Distribute
@@ -125,7 +226,7 @@ module XCJobs
125
226
  attr_accessor :dsym
126
227
  attr_accessor :key
127
228
 
128
- def initialize(name=:export)
229
+ def initialize()
129
230
  yield self if block_given?
130
231
  define
131
232
  end
@@ -158,7 +259,7 @@ module XCJobs
158
259
  attr_accessor :password
159
260
  attr_accessor :altool
160
261
 
161
- def initialize(name=:export)
262
+ def initialize()
162
263
  yield self if block_given?
163
264
  define
164
265
  end
@@ -173,10 +274,11 @@ module XCJobs
173
274
  namespace :distribute do
174
275
  desc 'upload ipa to iTunes Connect'
175
276
  task :itc do
176
- sh %["#{altool}" --upload-app --file "#{file}" --username #{username} --password #{password}]
277
+ sh *["#{altool}", '--upload-app', '--file', "#{file}", '--username', "#{username}", '--password', "#{password}"]
177
278
  end
178
279
  end
179
280
  end
180
281
  end
282
+
181
283
  end
182
284
  end
@@ -1,3 +1,3 @@
1
1
  module XCJobs
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -4,14 +4,18 @@ require 'date'
4
4
  describe XCJobs::Distribute do
5
5
  before(:each) do
6
6
  @commands = []
7
-
8
- allow_any_instance_of(FileUtils).to receive(:sh) do |object, command|
9
- @commands << command
7
+ allow_any_instance_of(FileUtils).to receive(:sh) do |object, command, param1, param2, param3, param4, param5, param6, param7, param8, param9|
8
+ [object, command, param1, param2, param3, param4, param5, param6, param7, param8, param9].each do |e|
9
+ if e.kind_of? String
10
+ @commands << "#{e}"
11
+ end
12
+ end
10
13
  end
11
14
 
12
- allow_any_instance_of(XCJobs::Distribute).to receive(:upload) do |object, url, form_data|
15
+ allow_any_instance_of(XCJobs::Distribute).to receive(:upload) do |object, url, form_data, header|
13
16
  @url = url
14
17
  @form_data = form_data
18
+ @header = header
15
19
  end
16
20
 
17
21
  Rake.application = rake
@@ -175,60 +179,68 @@ describe XCJobs::Distribute do
175
179
  end
176
180
  end
177
181
 
178
- describe XCJobs::Distribute::Crittercism do
179
- describe 'define upload dSYMs task' do
182
+ describe XCJobs::Distribute::Crashlytics do
183
+ describe 'define upload ipa task' do
184
+ let(:framework_path) { '/path/to/Crashlytics.framework' }
185
+
180
186
  let(:credentials) do
181
- { app_id: '123456789abcdefg12345678',
182
- key: 'abcdefghijklmnopqrstuvwxyz123456',
187
+ { api_key: 'abcde1234fghij75014d19d07e2a24f02d75e20',
188
+ build_secret: '12345abcdef1b40d0187e99c7707828419312f6778a2331fedab5bb6ffe',
183
189
  }
184
190
  end
185
191
 
186
- let(:dsym_file) do
187
- File.join('build', 'dSYMs.zip')
188
- end
192
+ let(:file) { File.join('build', 'Example.ipa') }
193
+
194
+ let(:notes) { "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" }
189
195
 
190
196
  let!(:task) do
191
- XCJobs::Distribute::Crittercism.new do |t|
192
- t.app_id = credentials[:app_id]
193
- t.key = credentials[:key]
194
- t.dsym = dsym_file
197
+ XCJobs::Distribute::Crashlytics.new do |t|
198
+ t.framework_path = framework_path
199
+ t.file = file
200
+ t.api_key = credentials[:api_key]
201
+ t.build_secret = credentials[:build_secret]
202
+ t.notifications = true # optional
195
203
  end
196
204
  end
197
205
 
198
- it 'configures the app_id' do
199
- expect(task.app_id).to eq credentials[:app_id]
206
+ it 'configures the framework path' do
207
+ expect(task.framework_path).to eq framework_path
200
208
  end
201
209
 
202
- it 'configures the key' do
203
- expect(task.key).to eq credentials[:key]
210
+ it 'configures the ipa file path' do
211
+ expect(task.file).to eq file
204
212
  end
205
213
 
206
- it 'configures the dsym file path' do
207
- expect(task.dsym).to eq dsym_file
214
+ it 'configures the api_key' do
215
+ expect(task.api_key).to eq credentials[:api_key]
216
+ end
217
+
218
+ it 'configures the build_secret' do
219
+ expect(task.build_secret).to eq credentials[:build_secret]
220
+ end
221
+
222
+ it 'configures the notifications' do
223
+ expect(task.notifications).to eq true
208
224
  end
209
225
 
210
226
  describe 'tasks' do
211
- describe 'distribute:crittercism' do
212
- subject { Rake.application['distribute:crittercism'] }
227
+ describe 'distribute:crashlytics' do
228
+ subject { Rake.application['distribute:crashlytics'] }
213
229
 
214
230
  it 'executes the appropriate commands' do
215
231
  subject.invoke
216
- expect(@url).to eq "https://api.crittercism.com/api_beta/dsym/#{credentials[:app_id]}"
217
- expect(@form_data).to eq({
218
- dsym: "@#{dsym_file}",
219
- key: credentials[:key],
220
- })
232
+ expect(@commands).to eq ["#{File.join(framework_path, 'submit')}", credentials[:api_key], credentials[:build_secret], '-ipaPath', "#{file}"]
221
233
  end
222
234
  end
223
235
  end
224
236
  end
225
237
  end
226
238
 
227
- describe XCJobs::Distribute::ITC do
228
- describe 'define upload ipa task' do
239
+ describe XCJobs::Distribute::HockeyApp do
240
+ describe 'define upload dSYMs task' do
229
241
  let(:credentials) do
230
- { username: 'kishikawakatsumi',
231
- password: 'password1234',
242
+ { token: '123456789abcdefg12345678',
243
+ identifier: 'abcdefghijklmnopqrstuvwxyz123456',
232
244
  }
233
245
  end
234
246
 
@@ -236,38 +248,163 @@ describe XCJobs::Distribute do
236
248
  File.join('build', 'Example.ipa')
237
249
  end
238
250
 
239
- let(:altool) { '/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool' }
251
+ let(:dsym_file) do
252
+ File.join('build', 'dSYMs.zip')
253
+ end
254
+
255
+ let(:notes) { "Uploaded: #{DateTime.now.strftime("%Y/%m/%d %H:%M:%S")}" }
240
256
 
241
257
  let!(:task) do
242
- XCJobs::Distribute::ITC.new do |t|
243
- t.username = credentials[:username]
244
- t.password = credentials[:password]
258
+ XCJobs::Distribute::HockeyApp.new do |t|
245
259
  t.file = file
260
+ t.dsym = dsym_file
261
+ t.token = credentials[:token]
262
+ t.identifier = credentials[:identifier]
263
+ t.notes = notes
264
+ t.notes_type = 1
246
265
  end
247
266
  end
248
267
 
249
- it 'configures the username' do
250
- expect(task.username).to eq credentials[:username]
268
+ it 'configures the file path' do
269
+ expect(task.file).to eq file
251
270
  end
252
271
 
253
- it 'configures the password' do
254
- expect(task.password).to eq credentials[:password]
272
+ it 'configures the dsym file path' do
273
+ expect(task.dsym).to eq dsym_file
255
274
  end
256
275
 
257
- it 'configures the file path' do
258
- expect(task.file).to eq file
276
+ it 'configures the token' do
277
+ expect(task.token).to eq credentials[:token]
278
+ end
279
+
280
+ it 'configures the identifier' do
281
+ expect(task.identifier).to eq credentials[:identifier]
282
+ end
283
+
284
+ it 'configures the notes' do
285
+ expect(task.notes).to eq notes
286
+ end
287
+
288
+ it 'configures the notes_type' do
289
+ expect(task.notes_type).to eq 1
259
290
  end
260
291
 
261
292
  describe 'tasks' do
262
- describe 'distribute:itc' do
263
- subject { Rake.application['distribute:itc'] }
293
+ describe 'distribute:hockeyapp' do
294
+ subject { Rake.application['distribute:hockeyapp'] }
264
295
 
265
296
  it 'executes the appropriate commands' do
266
297
  subject.invoke
267
- expect(@commands).to eq [%["#{altool}" --upload-app --file "#{file}" --username #{credentials[:username]} --password #{credentials[:password]}]]
298
+ expect(@url).to eq "https://rink.hockeyapp.net/api/2/apps/#{credentials[:identifier]}/app_versions/upload"
299
+ expect(@form_data).to eq({
300
+ ipa: "@#{file}",
301
+ dsym: "@#{dsym_file}",
302
+ notes: notes,
303
+ notes_type: 1,
304
+ })
305
+ expect(@header).to eq({
306
+ "X-HockeyAppToken" => credentials[:token]
307
+ })
268
308
  end
269
309
  end
270
310
  end
271
311
  end
312
+
313
+ describe XCJobs::Distribute::Crittercism do
314
+ describe 'define upload dSYMs task' do
315
+ let(:credentials) do
316
+ { app_id: '123456789abcdefg12345678',
317
+ key: 'abcdefghijklmnopqrstuvwxyz123456',
318
+ }
319
+ end
320
+
321
+ let(:dsym_file) do
322
+ File.join('build', 'dSYMs.zip')
323
+ end
324
+
325
+ let!(:task) do
326
+ XCJobs::Distribute::Crittercism.new do |t|
327
+ t.app_id = credentials[:app_id]
328
+ t.key = credentials[:key]
329
+ t.dsym = dsym_file
330
+ end
331
+ end
332
+
333
+ it 'configures the app_id' do
334
+ expect(task.app_id).to eq credentials[:app_id]
335
+ end
336
+
337
+ it 'configures the key' do
338
+ expect(task.key).to eq credentials[:key]
339
+ end
340
+
341
+ it 'configures the dsym file path' do
342
+ expect(task.dsym).to eq dsym_file
343
+ end
344
+
345
+ describe 'tasks' do
346
+ describe 'distribute:crittercism' do
347
+ subject { Rake.application['distribute:crittercism'] }
348
+
349
+ it 'executes the appropriate commands' do
350
+ subject.invoke
351
+ expect(@url).to eq "https://api.crittercism.com/api_beta/dsym/#{credentials[:app_id]}"
352
+ expect(@form_data).to eq({
353
+ dsym: "@#{dsym_file}",
354
+ key: credentials[:key],
355
+ })
356
+ end
357
+ end
358
+ end
359
+ end
360
+ end
361
+
362
+ describe XCJobs::Distribute::ITC do
363
+ describe 'define upload ipa task' do
364
+ let(:credentials) do
365
+ { username: 'kishikawakatsumi',
366
+ password: 'password1234',
367
+ }
368
+ end
369
+
370
+ let(:file) do
371
+ File.join('build', 'Example.ipa')
372
+ end
373
+
374
+ let(:altool) { '/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool' }
375
+
376
+ let!(:task) do
377
+ XCJobs::Distribute::ITC.new do |t|
378
+ t.username = credentials[:username]
379
+ t.password = credentials[:password]
380
+ t.file = file
381
+ end
382
+ end
383
+
384
+ it 'configures the username' do
385
+ expect(task.username).to eq credentials[:username]
386
+ end
387
+
388
+ it 'configures the password' do
389
+ expect(task.password).to eq credentials[:password]
390
+ end
391
+
392
+ it 'configures the file path' do
393
+ expect(task.file).to eq file
394
+ end
395
+
396
+ describe 'tasks' do
397
+ describe 'distribute:itc' do
398
+ subject { Rake.application['distribute:itc'] }
399
+
400
+ it 'executes the appropriate commands' do
401
+ subject.invoke
402
+ expect(@commands).to eq ["#{altool}", '--upload-app', '--file', "#{file}", '--username', "#{credentials[:username]}", '--password', "#{credentials[:password]}"]
403
+ end
404
+ end
405
+ end
406
+ end
407
+ end
408
+
272
409
  end
273
410
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcjobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - kishikawa katsumi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-08 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler