xcjobs 0.0.1 → 0.0.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: 091108d90cf5ed6a1cec28b8bec082b7aab8ccfd
4
- data.tar.gz: 919b0dae45768817875b8450ab5a2546f1af9048
3
+ metadata.gz: b5962d4c76d0cc02c6c62f205d5b1a23afca67f5
4
+ data.tar.gz: d6e04486413d5516d1ea83d91f225651a9a26c97
5
5
  SHA512:
6
- metadata.gz: 7372e441dbdf4f86b2eddc7a49bb985d260c008b23cf108ed1b3bdd07af32288c545eb132b6f49bfc7c93193bb20f1e3c5bd3ea2ba75a5abc1e326262e1097bc
7
- data.tar.gz: a8a54a041606803fbe4f5f685ec9ef8c5ce3a023660376242ec06938003e6d42741867475138e68444ab0c0b14dec9fd8a709254397308be59b6363be745028f
6
+ metadata.gz: 151273faa341ac14b9810a399bd865b7215ffddd95310610c1a6c29deb229e16e9bd1367aeb15c2098ea80c7c524332e76022d52394793b663cb54399a0e2983
7
+ data.tar.gz: 87b7bcd910a8f5edf3899912883e3736a002f3356ca72034b68cd40cc84fdeda28e6d93650ad13eaf6c6839e5ade97ca9c73bf4f55ca9699253378e32a7443f0
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # XCJobs [![Build Status](https://travis-ci.org/kishikawakatsumi/xcjobs.svg?branch=master)](https://travis-ci.org/kishikawakatsumi/xcjobs) [![Coverage Status](https://img.shields.io/coveralls/kishikawakatsumi/xcjobs.svg)](https://coveralls.io/r/kishikawakatsumi/xcjobs?branch=master)
1
+ # XCJobs
2
+ [![Gem Version](https://badge.fury.io/rb/xcjobs.svg)](http://badge.fury.io/rb/xcjobs) [![Build Status](https://travis-ci.org/kishikawakatsumi/xcjobs.svg?branch=master)](https://travis-ci.org/kishikawakatsumi/xcjobs) [![Coverage Status](https://img.shields.io/coveralls/kishikawakatsumi/xcjobs.svg)](https://coveralls.io/r/kishikawakatsumi/xcjobs?branch=master) [![Code Climate](https://codeclimate.com/github/kishikawakatsumi/xcjobs/badges/gpa.svg)](https://codeclimate.com/github/kishikawakatsumi/xcjobs) [![Dependency Status](https://gemnasium.com/kishikawakatsumi/xcjobs.svg)](https://gemnasium.com/kishikawakatsumi/xcjobs)
3
+
2
4
 
3
5
  Support the automation of release process of iOS/OSX apps with CI
4
6
 
@@ -191,7 +193,7 @@ source 'https://rubygems.org'
191
193
  gem 'rake'
192
194
  gem 'cocoapods'
193
195
  gem 'xcpretty'
194
- gem 'xcjobs', :github => 'kishikawakatsumi/xcjobs'
196
+ gem 'xcjobs'
195
197
  ```
196
198
 
197
199
  ```yaml
@@ -104,5 +104,35 @@ module XCJobs
104
104
  end
105
105
  end
106
106
  end
107
+
108
+ class ITC < Rake::TaskLib
109
+ include Rake::DSL if defined?(Rake::DSL)
110
+ include Distribute
111
+
112
+ attr_accessor :file
113
+ attr_accessor :username
114
+ attr_accessor :password
115
+ attr_accessor :altool
116
+
117
+ def initialize(name=:export)
118
+ yield self if block_given?
119
+ define
120
+ end
121
+
122
+ def altool
123
+ @altool || '/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool'
124
+ end
125
+
126
+ private
127
+
128
+ def define
129
+ namespace :distribute do
130
+ desc 'upload ipa to iTunes Connect'
131
+ task :itc do
132
+ sh %["#{altool}" --upload-app --file "#{file}" --username #{username} --password #{password}]
133
+ end
134
+ end
135
+ end
136
+ end
107
137
  end
108
138
  end
@@ -1,4 +1,4 @@
1
- require "rake/tasklib"
1
+ require 'rake/tasklib'
2
2
 
3
3
  module XCJobs
4
4
  module InfoPlist
@@ -19,14 +19,6 @@ module XCJobs
19
19
  set(key, value)
20
20
  end
21
21
 
22
- def build_version
23
- self['CFBundleVersion']
24
- end
25
-
26
- def build_version=(revision)
27
- self['CFBundleVersion'] = revision
28
- end
29
-
30
22
  def marketing_version
31
23
  self['CFBundleShortVersionString']
32
24
  end
@@ -35,6 +27,14 @@ module XCJobs
35
27
  self['CFBundleShortVersionString'] = version
36
28
  end
37
29
 
30
+ def build_version
31
+ self['CFBundleVersion']
32
+ end
33
+
34
+ def build_version=(revision)
35
+ self['CFBundleVersion'] = revision
36
+ end
37
+
38
38
  def bump_marketing_version_segment(segment_index)
39
39
  segments = Gem::Version.new(marketing_version).segments
40
40
  segments[segment_index] = segments[segment_index].to_i + 1
@@ -53,6 +53,7 @@ module XCJobs
53
53
  module InfoPlist
54
54
  class Version < Rake::TaskLib
55
55
  include Rake::DSL if defined?(Rake::DSL)
56
+ include InfoPlist
56
57
 
57
58
  def initialize()
58
59
  yield self if block_given?
@@ -69,45 +70,45 @@ module XCJobs
69
70
 
70
71
  def define
71
72
  namespace :version do
72
- desc "Print the current version"
73
+ desc 'Print the current version'
73
74
  task :current do
74
75
  puts InfoPlist.marketing_and_build_version
75
76
  end
76
77
 
77
- desc "Sets build version to last git commit hash"
78
+ desc 'Sets build version to last git commit hash'
78
79
  task :set_build_version do
79
- rev = `git rev-parse --short HEAD`.strip
80
+ rev = %x[git rev-parse --short HEAD].strip
80
81
  puts "Setting build version to: #{rev}"
81
82
  InfoPlist.build_version = rev
82
83
  end
83
84
 
84
- desc "Sets build version to number of commits"
85
+ desc 'Sets build version to number of commits'
85
86
  task :set_build_number do
86
- rev = `git rev-list --count HEAD`.strip
87
+ rev = %x[git rev-list --count HEAD].strip
87
88
  puts "Setting build version to: #{rev}"
88
89
  InfoPlist.build_version = rev
89
90
  end
90
91
 
91
92
  namespace :bump do
92
- desc "Bump patch version (0.0.X)"
93
+ desc 'Bump patch version (0.0.X)'
93
94
  task :patch do
94
95
  InfoPlist.bump_marketing_version_segment(2)
95
96
  end
96
97
 
97
- desc "Bump minor version (0.X.0)"
98
+ desc 'Bump minor version (0.X.0)'
98
99
  task :minor do
99
100
  InfoPlist.bump_marketing_version_segment(1)
100
101
  end
101
102
 
102
- desc "Bump major version (X.0.0)"
103
+ desc 'Bump major version (X.0.0)'
103
104
  task :major do
104
105
  InfoPlist.bump_marketing_version_segment(0)
105
106
  end
106
107
  end
107
108
  end
108
109
 
109
- desc "Print the current version"
110
- task :version => "version:current"
110
+ desc 'Print the current version'
111
+ task :version => 'version:current'
111
112
  end
112
113
  end
113
114
  end
@@ -1,3 +1,3 @@
1
1
  module XCJobs
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'rake/tasklib'
2
2
  require 'rake/clean'
3
+ require 'open3'
3
4
 
4
5
  module XCJobs
5
6
  class Xcodebuild < Rake::TaskLib
@@ -70,7 +71,11 @@ module XCJobs
70
71
  def run(cmd)
71
72
  @before_action.call if @before_action
72
73
 
73
- puts cmd.join(" ")
74
+ if @formatter
75
+ puts (cmd + ['|', @formatter]).join(" ")
76
+ else
77
+ puts cmd.join(" ")
78
+ end
74
79
 
75
80
  if @formatter
76
81
  Open3.pipeline_r(cmd, [@formatter]) do |stdout, wait_thrs|
@@ -184,7 +189,7 @@ module XCJobs
184
189
  end
185
190
 
186
191
  class Archive < Xcodebuild
187
- attr_accessor :archivePath
192
+ attr_accessor :archive_path
188
193
 
189
194
  def initialize(name = :archive)
190
195
  super
@@ -216,25 +221,25 @@ module XCJobs
216
221
  end
217
222
  end
218
223
 
219
- def archivePath
220
- @archivePath || (build_dir && scheme ? File.join(build_dir, scheme) : nil)
224
+ def archive_path
225
+ @archive_path || (build_dir && scheme ? File.join(build_dir, scheme) : nil)
221
226
  end
222
227
 
223
228
  def options
224
229
  super.tap do |opts|
225
- opts.concat(['-archivePath', archivePath]) if archivePath
230
+ opts.concat(['-archivePath', archive_path]) if archive_path
226
231
  end
227
232
  end
228
233
  end
229
234
 
230
235
  class Export < Xcodebuild
231
- attr_accessor :archivePath
232
- attr_accessor :exportFormat
233
- attr_accessor :exportPath
234
- attr_accessor :exportProvisioningProfile
235
- attr_accessor :exportSigningIdentity
236
- attr_accessor :exportInstallerIdentity
237
- attr_accessor :exportWithOriginalSigningIdentity
236
+ attr_accessor :archive_path
237
+ attr_accessor :export_format
238
+ attr_accessor :export_path
239
+ attr_accessor :export_provisioning_profile
240
+ attr_accessor :export_signing_identity
241
+ attr_accessor :export_installer_identity
242
+ attr_accessor :export_with_original_signing_identity
238
243
 
239
244
  def initialize(name = :export)
240
245
  super
@@ -253,23 +258,23 @@ module XCJobs
253
258
  end
254
259
  end
255
260
 
256
- def archivePath
257
- @archivePath || (build_dir && scheme ? File.join(build_dir, scheme) : nil)
261
+ def archive_path
262
+ @archive_path || (build_dir && scheme ? File.join(build_dir, scheme) : nil)
258
263
  end
259
264
 
260
- def exportFormat
261
- @exportFormat || 'IPA'
265
+ def export_format
266
+ @export_format || 'IPA'
262
267
  end
263
268
 
264
269
  def options
265
270
  [].tap do |opts|
266
- opts.concat(['-archivePath', archivePath]) if archivePath
267
- opts.concat(['-exportFormat', exportFormat]) if exportFormat
268
- opts.concat(['-exportPath', exportPath]) if exportPath
269
- opts.concat(['-exportProvisioningProfile', exportProvisioningProfile]) if exportProvisioningProfile
270
- opts.concat(['-exportSigningIdentity', exportSigningIdentity]) if exportSigningIdentity
271
- opts.concat(['-exportInstallerIdentity', exportInstallerIdentity]) if exportInstallerIdentity
272
- opts.concat(['-exportWithOriginalSigningIdentity']) if exportWithOriginalSigningIdentity
271
+ opts.concat(['-archivePath', archive_path]) if archive_path
272
+ opts.concat(['-exportFormat', export_format]) if export_format
273
+ opts.concat(['-exportPath', export_path]) if export_path
274
+ opts.concat(['-exportProvisioningProfile', export_provisioning_profile]) if export_provisioning_profile
275
+ opts.concat(['-exportSigningIdentity', export_signing_identity]) if export_signing_identity
276
+ opts.concat(['-exportInstallerIdentity', export_installer_identity]) if export_installer_identity
277
+ opts.concat(['-exportWithOriginalSigningIdentity']) if export_with_original_signing_identity
273
278
  end
274
279
  end
275
280
  end
data/lib/xcjobs.rb CHANGED
@@ -2,4 +2,4 @@ require "xcjobs/version"
2
2
  require "xcjobs/xcodebuild"
3
3
  require "xcjobs/certificate"
4
4
  require "xcjobs/distribute"
5
- require "xcjobs/infoplist"
5
+ require "xcjobs/info_plist"
data/spec/Info.plist ADDED
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>com.kishikawakatsumi.$(PRODUCT_NAME:rfc1034identifier)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>APPL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>3.2.6</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>5413</string>
23
+ <key>LSRequiresIPhoneOS</key>
24
+ <true/>
25
+ <key>UILaunchStoryboardName</key>
26
+ <string>LaunchScreen</string>
27
+ <key>UIMainStoryboardFile</key>
28
+ <string>Main</string>
29
+ <key>UIRequiredDeviceCapabilities</key>
30
+ <array>
31
+ <string>armv7</string>
32
+ </array>
33
+ <key>UISupportedInterfaceOrientations</key>
34
+ <array>
35
+ <string>UIInterfaceOrientationPortrait</string>
36
+ <string>UIInterfaceOrientationLandscapeLeft</string>
37
+ <string>UIInterfaceOrientationLandscapeRight</string>
38
+ </array>
39
+ <key>UISupportedInterfaceOrientations~ipad</key>
40
+ <array>
41
+ <string>UIInterfaceOrientationPortrait</string>
42
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
43
+ <string>UIInterfaceOrientationLandscapeLeft</string>
44
+ <string>UIInterfaceOrientationLandscapeRight</string>
45
+ </array>
46
+ </dict>
47
+ </plist>
@@ -1,7 +1,14 @@
1
1
  require 'spec_helper'
2
+ require 'date'
2
3
 
3
4
  describe XCJobs::Distribute do
4
5
  before(:each) do
6
+ @commands = []
7
+
8
+ allow_any_instance_of(FileUtils).to receive(:sh) do |object, command|
9
+ @commands << command
10
+ end
11
+
5
12
  allow_any_instance_of(XCJobs::Distribute).to receive(:upload) do |object, url, form_data|
6
13
  @url = url
7
14
  @form_data = form_data
@@ -131,4 +138,51 @@ describe XCJobs::Distribute do
131
138
  end
132
139
  end
133
140
  end
141
+
142
+ describe XCJobs::Distribute::ITC do
143
+ describe 'define upload ipa task' do
144
+ let(:credentials) do
145
+ { username: 'kishikawakatsumi',
146
+ password:'password1234',
147
+ }
148
+ end
149
+
150
+ let(:file) do
151
+ File.join('build', 'Example.ipa')
152
+ end
153
+
154
+ let(:altool) { '/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool' }
155
+
156
+ let!(:task) do
157
+ XCJobs::Distribute::ITC.new do |t|
158
+ t.username = credentials['username']
159
+ t.password = credentials['password']
160
+ t.file = file
161
+ end
162
+ end
163
+
164
+ it 'configures the username' do
165
+ expect(task.username).to eq credentials['username']
166
+ end
167
+
168
+ it 'configures the password' do
169
+ expect(task.password).to eq credentials['password']
170
+ end
171
+
172
+ it 'configures the file path' do
173
+ expect(task.file).to eq file
174
+ end
175
+
176
+ describe 'tasks' do
177
+ describe 'distribute:itc' do
178
+ subject { Rake.application['distribute:itc'] }
179
+
180
+ it 'executes the appropriate commands' do
181
+ subject.invoke
182
+ expect(@commands).to eq [%["#{altool}" --upload-app --file "#{file}" --username #{credentials['username']} --password #{credentials['password']}]]
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
134
188
  end
@@ -0,0 +1,94 @@
1
+ require 'spec_helper'
2
+
3
+ describe XCJobs::InfoPlist do
4
+ before(:each) do
5
+ if ENV['CI']
6
+ allow_any_instance_of(XCJobs::InfoPlist).to receive(:marketing_version).and_return('3.2.6')
7
+ allow_any_instance_of(XCJobs::InfoPlist).to receive(:build_version).and_return('5413')
8
+ end
9
+
10
+ allow_any_instance_of(XCJobs::InfoPlist).to receive(:marketing_version=) do |object, arg|
11
+ @marketing_version = arg
12
+ end
13
+
14
+ allow_any_instance_of(XCJobs::InfoPlist).to receive(:build_version=) do |object, arg|
15
+ @build_version = arg
16
+ end
17
+
18
+ Rake.application = rake
19
+ end
20
+
21
+ let(:rake) { Rake::Application.new }
22
+
23
+ describe 'test reading Info.plist' do
24
+ let(:path) do
25
+ File.join('spec', 'Info.plist')
26
+ end
27
+
28
+ let(:marketing_version) { '3.2.6' }
29
+ let(:build_version) { '5413' }
30
+
31
+ let!(:task) do
32
+ XCJobs::InfoPlist::Version.new do |t|
33
+ t.path = path
34
+ end
35
+ end
36
+
37
+ it 'configures the Info.plist file path' do
38
+ expect(task.path).to eq path
39
+ end
40
+
41
+ it 'configures the marketing_version' do
42
+ expect(task.marketing_version).to eq marketing_version
43
+ end
44
+
45
+ it 'configures the build_version' do
46
+ expect(task.build_version).to eq build_version
47
+ end
48
+
49
+ describe 'test bumping patch' do
50
+ subject { Rake.application['version:bump:patch'] }
51
+
52
+ it 'executes the appropriate commands' do
53
+ subject.invoke
54
+ expect(@marketing_version).to eq '3.2.7'
55
+ end
56
+ end
57
+
58
+ describe 'test bumping minor' do
59
+ subject { Rake.application['version:bump:minor'] }
60
+
61
+ it 'executes the appropriate commands' do
62
+ subject.invoke
63
+ expect(@marketing_version).to eq '3.3.0'
64
+ end
65
+ end
66
+
67
+ describe 'test bumping major' do
68
+ subject { Rake.application['version:bump:major'] }
69
+
70
+ it 'executes the appropriate commands' do
71
+ subject.invoke
72
+ expect(@marketing_version).to eq '4.0.0'
73
+ end
74
+ end
75
+
76
+ describe 'test update build number' do
77
+ subject { Rake.application['version:set_build_version'] }
78
+
79
+ it 'executes the appropriate commands' do
80
+ subject.invoke
81
+ expect(@build_version).to eq %x[git rev-parse --short HEAD].strip
82
+ end
83
+ end
84
+
85
+ describe 'test update build number' do
86
+ subject { Rake.application['version:set_build_number'] }
87
+
88
+ it 'executes the appropriate commands' do
89
+ subject.invoke
90
+ expect(@build_version).to eq %x[git rev-list --count HEAD].strip
91
+ end
92
+ end
93
+ end
94
+ 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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - kishikawa katsumi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-24 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,11 +83,13 @@ files:
83
83
  - lib/xcjobs.rb
84
84
  - lib/xcjobs/certificate.rb
85
85
  - lib/xcjobs/distribute.rb
86
- - lib/xcjobs/infoplist.rb
86
+ - lib/xcjobs/info_plist.rb
87
87
  - lib/xcjobs/version.rb
88
88
  - lib/xcjobs/xcodebuild.rb
89
+ - spec/Info.plist
89
90
  - spec/certificate_spec.rb
90
91
  - spec/distribute_spec.rb
92
+ - spec/info_plist_spec.rb
91
93
  - spec/profiles/adhoc.mobileprovision
92
94
  - spec/profiles/development.mobileprovision
93
95
  - spec/profiles/distribution.mobileprovision
@@ -120,8 +122,10 @@ signing_key:
120
122
  specification_version: 4
121
123
  summary: Support the automation of release process of iOS/OSX apps with CI
122
124
  test_files:
125
+ - spec/Info.plist
123
126
  - spec/certificate_spec.rb
124
127
  - spec/distribute_spec.rb
128
+ - spec/info_plist_spec.rb
125
129
  - spec/profiles/adhoc.mobileprovision
126
130
  - spec/profiles/development.mobileprovision
127
131
  - spec/profiles/distribution.mobileprovision