xcodebuilder 0.0.14 → 0.0.15
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.
- data/lib/xcode_builder.rb +9 -52
- data/lib/xcode_builder/configuration.rb +66 -0
- data/lib/xcode_builder/release_strategies/git.rb +13 -3
- metadata +3 -3
data/lib/xcode_builder.rb
CHANGED
@@ -175,6 +175,7 @@ module XcodeBuilder
|
|
175
175
|
|
176
176
|
# back to working directory
|
177
177
|
Dir.chdir current_dir
|
178
|
+
puts "Done."
|
178
179
|
end
|
179
180
|
|
180
181
|
# desc "Packages the final artifact (IPA + dSYM)"
|
@@ -196,7 +197,6 @@ module XcodeBuilder
|
|
196
197
|
system cmd.join " "
|
197
198
|
|
198
199
|
# delete all the artifacts but the .app. which will be needed by the automation builds
|
199
|
-
puts "the paaaaath #{@configuration.dsym_name}"
|
200
200
|
FileUtils.rm_rf @configuration.dsym_name unless !File.exists? @configuration.dsym_name
|
201
201
|
FileUtils.rm_rf @configuration.ipa_name unless !File.exists? @configuration.ipa_name
|
202
202
|
|
@@ -216,16 +216,18 @@ module XcodeBuilder
|
|
216
216
|
pod_dry_run
|
217
217
|
|
218
218
|
# tag source as needed
|
219
|
-
@configuration.release_strategy
|
219
|
+
if @configuration.release_strategy != nil then
|
220
|
+
@configuration.release_strategy.tag_current_version
|
221
|
+
end
|
220
222
|
|
221
223
|
# and push pod pod
|
222
224
|
push_pod
|
223
225
|
|
224
|
-
#
|
225
|
-
if
|
226
|
-
# and push appropriately
|
226
|
+
# ask release strategy to bump the release number
|
227
|
+
if @configuration.release_strategy != nil then
|
227
228
|
@configuration.release_strategy.prepare_for_next_pod_release
|
228
229
|
end
|
230
|
+
puts "Pod successfully released"
|
229
231
|
end
|
230
232
|
|
231
233
|
# runs a pod dry run before tagging
|
@@ -251,26 +253,6 @@ module XcodeBuilder
|
|
251
253
|
puts "Done."
|
252
254
|
end
|
253
255
|
|
254
|
-
def increment_pod_and_plist_number
|
255
|
-
old_build_number = @configuration.build_number
|
256
|
-
if !prepare_for_next_release then
|
257
|
-
return false
|
258
|
-
end
|
259
|
-
|
260
|
-
# bump the spec version and save it
|
261
|
-
spec_content = File.open(@configuration.podspec_file, "r").read
|
262
|
-
old_version = "version = '#{old_build_number}'"
|
263
|
-
new_version = "version = '#{@configuration.build_number}'"
|
264
|
-
|
265
|
-
spec_content = spec_content.sub old_version, new_version
|
266
|
-
|
267
|
-
File.open(@configuration.podspec_file, "w") {|f|
|
268
|
-
f.write spec_content
|
269
|
-
}
|
270
|
-
|
271
|
-
true
|
272
|
-
end
|
273
|
-
|
274
256
|
def deploy
|
275
257
|
package
|
276
258
|
@configuration.deployment_strategy.deploy
|
@@ -290,35 +272,10 @@ module XcodeBuilder
|
|
290
272
|
@configuration.release_strategy.tag_current_version
|
291
273
|
end
|
292
274
|
|
293
|
-
if
|
275
|
+
if @configuration.release_strategy != nil then
|
294
276
|
@configuration.release_strategy.prepare_for_next_release
|
295
277
|
end
|
296
|
-
|
297
|
-
|
298
|
-
def prepare_for_next_release
|
299
|
-
if !@configuration.increment_plist_version then
|
300
|
-
return false
|
301
|
-
end
|
302
|
-
|
303
|
-
next_build_number = @configuration.next_build_number
|
304
|
-
if next_build_number == nil then
|
305
|
-
return false
|
306
|
-
end
|
307
|
-
|
308
|
-
print "Updating #{@configuration.info_plist} to version #{next_build_number}"
|
309
|
-
|
310
|
-
# read the plist and extract data
|
311
|
-
plist = CFPropertyList::List.new(:file => @configuration.info_plist_path)
|
312
|
-
data = CFPropertyList.native_types(plist.value)
|
313
|
-
|
314
|
-
# re inject new version number into the data
|
315
|
-
data["CFBundleVersion"] = next_build_number
|
316
|
-
|
317
|
-
# recreate the plist and save it
|
318
|
-
plist.value = CFPropertyList.guess(data)
|
319
|
-
plist.save(@configuration.info_plist_path, CFPropertyList::List::FORMAT_XML)
|
320
|
-
puts "Done"
|
321
|
-
return true
|
278
|
+
puts "App successfully released"
|
322
279
|
end
|
323
280
|
end
|
324
281
|
end
|
@@ -60,6 +60,12 @@ module XcodeBuilder
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def build_number
|
63
|
+
# we have a podspec file, so try to get the version out of that
|
64
|
+
if (podspec_file != nil) && (File.exists? podspec_file) then
|
65
|
+
# get hte version out of the pod file
|
66
|
+
return build_number_from_podspec
|
67
|
+
end
|
68
|
+
|
63
69
|
# no plist is found, return a nil version
|
64
70
|
if (info_plist_path == nil) || (!File.exists? info_plist_path) then
|
65
71
|
return nil
|
@@ -71,6 +77,18 @@ module XcodeBuilder
|
|
71
77
|
data["CFBundleVersion"]
|
72
78
|
end
|
73
79
|
|
80
|
+
def build_number_from_podspec
|
81
|
+
file = File.open(podspec_file, "r")
|
82
|
+
begin
|
83
|
+
version_line = file.gets
|
84
|
+
end while version_line.eql? "\n"
|
85
|
+
|
86
|
+
if match = version_line.match(/\s*version\s*=\s*["'](.*)["']\s*/i)
|
87
|
+
version = match.captures
|
88
|
+
end
|
89
|
+
return version[0]
|
90
|
+
end
|
91
|
+
|
74
92
|
def next_build_number
|
75
93
|
# if we don't have a current version, we don't have a next version :)
|
76
94
|
if build_number == nil then
|
@@ -84,6 +102,54 @@ module XcodeBuilder
|
|
84
102
|
version_components.join "."
|
85
103
|
end
|
86
104
|
|
105
|
+
def increment_pod_number
|
106
|
+
if !increment_plist_version then
|
107
|
+
return false
|
108
|
+
end
|
109
|
+
|
110
|
+
if podspec_file == nil then
|
111
|
+
return false
|
112
|
+
end
|
113
|
+
|
114
|
+
# keep the old build number around
|
115
|
+
old_build_number = build_number
|
116
|
+
|
117
|
+
# bump the spec version and save it
|
118
|
+
spec_content = File.open(podspec_file, "r").read
|
119
|
+
old_version = "version = '#{old_build_number}'"
|
120
|
+
new_version = "version = '#{next_build_number}'"
|
121
|
+
|
122
|
+
spec_content = spec_content.sub old_version, new_version
|
123
|
+
|
124
|
+
File.open(podspec_file, "w") {|f|
|
125
|
+
f.write spec_content
|
126
|
+
}
|
127
|
+
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
def increment_plist_number
|
132
|
+
if !increment_plist_version then
|
133
|
+
puts "increment is false"
|
134
|
+
return false
|
135
|
+
end
|
136
|
+
|
137
|
+
if info_plist == nil then
|
138
|
+
return false
|
139
|
+
end
|
140
|
+
|
141
|
+
# read the plist and extract data
|
142
|
+
plist = CFPropertyList::List.new(:file => info_plist_path)
|
143
|
+
data = CFPropertyList.native_types(plist.value)
|
144
|
+
|
145
|
+
# re inject new version number into the data
|
146
|
+
data["CFBundleVersion"] = next_build_number
|
147
|
+
|
148
|
+
# recreate the plist and save it
|
149
|
+
plist.value = CFPropertyList.guess(data)
|
150
|
+
plist.save(info_plist_path, CFPropertyList::List::FORMAT_XML)
|
151
|
+
end
|
152
|
+
|
87
153
|
def built_app_long_version_suffix
|
88
154
|
if build_number == nil then
|
89
155
|
""
|
@@ -54,21 +54,31 @@ module XcodeBuilder
|
|
54
54
|
|
55
55
|
def prepare_for_next_pod_release
|
56
56
|
build_number = @configuration.build_number
|
57
|
+
next_build_number = @configuration.next_build_number
|
58
|
+
|
57
59
|
raise "build number cannot be empty on release" unless (build_number != nil) && (!build_number.empty?)
|
58
60
|
|
61
|
+
# increment the build number
|
62
|
+
@configuration.increment_pod_number
|
63
|
+
|
64
|
+
# commit
|
59
65
|
print "Committing #{@configuration.info_plist} and #{@configuration.podspec_file} with version #{build_number}"
|
60
|
-
|
61
66
|
stage_files [@configuration.info_plist, @configuration.podspec_file]
|
62
|
-
commit_and_push_with_message "Preparing for next pod release..."
|
67
|
+
commit_and_push_with_message "Preparing for next pod release #{next_build_number}..."
|
63
68
|
|
64
69
|
puts "Done"
|
65
70
|
end
|
66
71
|
|
67
72
|
def prepare_for_next_release
|
68
73
|
build_number = @configuration.build_number
|
74
|
+
next_build_number = @configuration.next_build_number
|
75
|
+
|
69
76
|
raise "build number cannot be empty on release" unless (build_number != nil) && (!build_number.empty?)
|
70
77
|
|
71
|
-
|
78
|
+
# increment the build number
|
79
|
+
@configuration.increment_plist_number
|
80
|
+
|
81
|
+
print "Committing #{@configuration.info_plist} with version #{next_build_number}"
|
72
82
|
|
73
83
|
stage_files [@configuration.info_plist]
|
74
84
|
commit_and_push_with_message "[Xcodebuilder] Releasing build #{build_number}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodebuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 15
|
10
|
+
version: 0.0.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Olivier Larivain
|