xcodebuilder 0.0.23 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xcode_builder.rb +27 -144
- data/lib/xcode_builder/configuration.rb +16 -58
- data/lib/xcode_builder/deployment_strategies.rb +1 -3
- data/lib/xcode_builder/deployment_strategies/testflight.rb +0 -14
- data/lib/xcode_builder/release_strategies/git.rb +0 -15
- metadata +2 -4
- data/lib/xcode_builder/deployment_strategies/scp.rb +0 -104
- data/lib/xcode_builder/deployment_strategies/web.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d8a7a84bb6f92c9d1a93692976b0c6b47bfb0fa
|
4
|
+
data.tar.gz: d31c2f7eb8fa8ca3a1b47317d140225065b27a24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5efdae1ae7eda5d1d4460731a1fd0771bc48c23205723ca3542efba0204426864b6270ce6911e01cf9d2f465ae80bcd5e7d6c80537a6e59a51a629b1b00d178e
|
7
|
+
data.tar.gz: 297a0bb2b2e1fe5a5578f81c6f3388da46ecbaac8fa0cba52506874b087ff43df6ab80b2861c94939973adb90b20bbb316a31605a701d33bf109baef1f31ff28
|
data/lib/xcode_builder.rb
CHANGED
@@ -13,28 +13,20 @@ module XcodeBuilder
|
|
13
13
|
@configuration = Configuration.new(
|
14
14
|
:configuration => "Release",
|
15
15
|
:build_dir => "build",
|
16
|
-
:xcodebuild_extra_args => nil,
|
17
|
-
:xcrun_extra_args => nil,
|
18
16
|
:project_file_path => nil,
|
19
17
|
:workspace_file_path => nil,
|
20
|
-
:sdk => "iphoneos",
|
21
18
|
:scheme => nil,
|
22
19
|
:app_name => nil,
|
23
|
-
:app_extension => "app",
|
24
20
|
:signing_identity => nil,
|
25
21
|
:package_destination_path => "./pkg",
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:arch => nil,
|
29
|
-
:skip_clean => ENV.fetch('SKIPCLEAN', false),
|
30
|
-
:verbose => ENV.fetch('VERBOSE', false),
|
22
|
+
:skip_clean => false,
|
23
|
+
:verbose => false,
|
31
24
|
:info_plist => nil,
|
32
25
|
:scm => nil,
|
33
|
-
:tag_vcs => false,
|
34
|
-
:increment_plist_version => false,
|
35
26
|
:pod_repo => nil,
|
36
27
|
:podspec_file => nil,
|
37
|
-
:
|
28
|
+
:xcodebuild_extra_args => nil,
|
29
|
+
:xcrun_extra_args => nil,
|
38
30
|
)
|
39
31
|
@namespace = namespace
|
40
32
|
yield @configuration if block_given?
|
@@ -47,7 +39,7 @@ module XcodeBuilder
|
|
47
39
|
def xcodebuild(*args)
|
48
40
|
# we're using tee as we still want to see our build output on screen
|
49
41
|
cmd = []
|
50
|
-
cmd << "
|
42
|
+
cmd << "xcrun xcodebuild"
|
51
43
|
cmd.concat args
|
52
44
|
puts "Running: #{cmd.join(" ")}" if @configuration.verbose
|
53
45
|
cmd << "| xcpretty && exit ${PIPESTATUS[0]}"
|
@@ -68,6 +60,9 @@ module XcodeBuilder
|
|
68
60
|
def build
|
69
61
|
clean unless @configuration.skip_clean
|
70
62
|
|
63
|
+
# update the long version number with the date
|
64
|
+
@configuration.timestamp_plist
|
65
|
+
|
71
66
|
print "Building Project..."
|
72
67
|
success = xcodebuild @configuration.build_arguments, "build"
|
73
68
|
raise "** BUILD FAILED **" unless success
|
@@ -77,34 +72,13 @@ module XcodeBuilder
|
|
77
72
|
# desc "Package the release as a distributable archive"
|
78
73
|
def package
|
79
74
|
build
|
80
|
-
|
81
|
-
# so do that part only on iphoneos/macosx SDKs
|
82
|
-
#
|
83
|
-
if(@configuration.sdk.eql? "iphoneos") then
|
84
|
-
package_ios_app
|
85
|
-
package_dsym
|
86
|
-
package_artifact unless !@configuration.zip_artifacts
|
87
|
-
elsif (@configuration.sdk.eql? "macosx") then
|
88
|
-
package_macos_app
|
89
|
-
package_dsym
|
90
|
-
package_artifact unless !@configuration.zip_artifacts
|
91
|
-
else
|
92
|
-
package_simulator_app
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# desc "Builds an IPA from the built .app"
|
97
|
-
def package_ios_app
|
75
|
+
|
98
76
|
print "Packaging and Signing..."
|
99
77
|
if (@configuration.signing_identity != nil) then
|
100
78
|
puts ""
|
101
79
|
print "Signing identity: #{@configuration.signing_identity}"
|
102
80
|
end
|
103
|
-
|
104
|
-
puts ""
|
105
|
-
print "Provisioning profile: #{@configuration.provisioning_profile}"
|
106
|
-
end
|
107
|
-
raise "** PACKAGE FAILED ** No Signing Identity Found" unless @configuration.signing_identity
|
81
|
+
|
108
82
|
# trash and create the dist IPA path if needed
|
109
83
|
FileUtils.rm_rf @configuration.package_destination_path unless !File.exists? @configuration.package_destination_path
|
110
84
|
FileUtils.mkdir_p @configuration.package_destination_path
|
@@ -112,107 +86,41 @@ module XcodeBuilder
|
|
112
86
|
# Construct the IPA and Sign it
|
113
87
|
cmd = []
|
114
88
|
cmd << "/usr/bin/xcrun"
|
115
|
-
cmd << "-sdk
|
89
|
+
cmd << "-sdk iphoneos"
|
116
90
|
cmd << "PackageApplication"
|
117
91
|
cmd << "'#{@configuration.built_app_path}'"
|
118
92
|
cmd << "-o '#{@configuration.ipa_path}'"
|
119
93
|
cmd << "--sign '#{@configuration.signing_identity}'" unless @configuration.signing_identity == nil
|
120
|
-
|
94
|
+
|
121
95
|
if @configuration.xcrun_extra_args then
|
122
96
|
cmd.concat @configuration.xcrun_extra_args if @configuration.xcrun_extra_args.is_a? Array
|
123
97
|
cmd << @configuration.xcrun_extra_args if @configuration.xcrun_extra_args.is_a? String
|
124
98
|
end
|
125
|
-
puts "Running #{cmd.join(" ")}" if @configuration.verbose
|
126
|
-
cmd << "2>&1 /dev/null"
|
127
|
-
cmd = cmd.join(" ")
|
128
|
-
system(cmd)
|
129
|
-
|
130
|
-
# zip the dSYM over to the dist folder
|
131
|
-
puts "Done"
|
132
|
-
end
|
133
|
-
|
134
|
-
def package_macos_app
|
135
|
-
# clean the pkg folder: create it if it doesn't exist yet
|
136
|
-
FileUtils.mkdir_p "\"#{@configuration.package_destination_path}\"" unless File.exists? "\"#{@configuration.package_destination_path}\""
|
137
|
-
# and remove an existing app_bundle_path if it exists
|
138
|
-
FileUtils.rm_rf "\"#{@configuration.app_bundle_path}\"" unless !File.exists? "\"#{@configuration.app_bundle_path}\""
|
139
|
-
|
140
|
-
# now we can properly copy the app bundle path over.
|
141
|
-
FileUtils.cp_r "\"#{@configuration.built_app_path}\"", "\"#{@configuration.package_destination_path}\""
|
142
|
-
end
|
143
|
-
|
144
|
-
def package_simulator_app
|
145
|
-
# clean the pkg folder: create it if it doesn't exist yet
|
146
|
-
FileUtils.mkdir_p "\"#{@configuration.package_destination_path}\"" unless File.exists? "\"#{@configuration.package_destination_path}\""
|
147
|
-
# and remove an existing app_bundle_path if it exists
|
148
|
-
FileUtils.rm_rf "\"#{@configuration.app_bundle_path}\"" unless !File.exists? "\"#{@configuration.app_bundle_path}\""
|
149
|
-
|
150
|
-
# now we can properly copy the app bundle path over.
|
151
|
-
FileUtils.cp_r "\"#{@configuration.built_app_path}\"", "\"#{@configuration.package_destination_path}\""
|
152
|
-
end
|
153
|
-
|
154
|
-
# desc "Zips the dSYM to the package folder"
|
155
|
-
def package_dsym
|
156
|
-
return if @configuration.skip_dsym
|
157
|
-
print "Packaging dSYM..."
|
158
|
-
|
159
|
-
# copy the dSYM to the pkg destination
|
160
|
-
FileUtils.cp_r @configuration.built_dsym_path, @configuration.package_destination_path
|
161
99
|
|
162
|
-
# the version is pulled from a path relative location, so fetch BEFORE
|
163
|
-
# we Dir.chdir
|
164
|
-
dsym_name = @configuration.dsym_name
|
165
|
-
dsym_target_path = @configuration.dsym_path
|
166
|
-
|
167
|
-
# move to pkg destination and zip the dSYM
|
168
|
-
current_dir = Dir.pwd
|
169
|
-
Dir.chdir @configuration.package_destination_path
|
170
|
-
|
171
|
-
cmd = []
|
172
|
-
cmd << "zip"
|
173
|
-
cmd << "-r"
|
174
|
-
cmd << "\"#{dsym_target_path}\""
|
175
|
-
cmd << "\"#{@configuration.app_name}.#{@configuration.app_extension}.dSYM\""
|
176
|
-
|
177
100
|
puts "Running #{cmd.join(" ")}" if @configuration.verbose
|
178
101
|
cmd << "2>&1 /dev/null"
|
179
102
|
cmd = cmd.join(" ")
|
180
103
|
system(cmd)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
# back to working directory
|
185
|
-
Dir.chdir current_dir
|
104
|
+
|
105
|
+
puts ""
|
186
106
|
puts "Done."
|
187
107
|
end
|
188
108
|
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
Dir.chdir @configuration.package_destination_path
|
194
|
-
|
195
|
-
# zip final package
|
196
|
-
cmd = []
|
197
|
-
cmd << "zip"
|
198
|
-
cmd << "-r"
|
199
|
-
cmd << "\"#{@configuration.zipped_package_name}\""
|
200
|
-
cmd << "\"#{@configuration.dsym_name}\"" unless @configuration.skip_dsym
|
201
|
-
cmd << "\"#{@configuration.ipa_name}\"" unless !@configuration.sdk.eql? "iphoneos"
|
202
|
-
cmd << "\"#{@configuration.app_name}.#{@configuration.app_extension}\"" unless !@configuration.sdk.eql? "macosx"
|
203
|
-
cmd << "2>&1 /dev/null"
|
204
|
-
|
205
|
-
system cmd.join " "
|
206
|
-
|
207
|
-
# delete all the artifacts but the .app. which will be needed by the automation builds
|
208
|
-
FileUtils.rm_rf @configuration.dsym_name unless !File.exists? @configuration.dsym_name
|
209
|
-
FileUtils.rm_rf @configuration.ipa_name unless !File.exists? @configuration.ipa_name
|
109
|
+
def deploy
|
110
|
+
package
|
111
|
+
@configuration.deployment_strategy.deploy
|
112
|
+
end
|
210
113
|
|
211
|
-
|
212
|
-
|
114
|
+
def release
|
115
|
+
# deploy or package depending on configuration
|
116
|
+
if @configuration.deployment_strategy then
|
117
|
+
deploy
|
118
|
+
else
|
119
|
+
package
|
120
|
+
end
|
213
121
|
|
214
|
-
puts "
|
215
|
-
puts "
|
122
|
+
puts ""
|
123
|
+
puts "App successfully released"
|
216
124
|
end
|
217
125
|
|
218
126
|
# desc "For CocoaPod libraries: dry run, tags SCM, pushes to cocoapod and increments build number"
|
@@ -258,30 +166,5 @@ module XcodeBuilder
|
|
258
166
|
raise "** Pod push failed **" if !result
|
259
167
|
puts "Done."
|
260
168
|
end
|
261
|
-
|
262
|
-
def deploy
|
263
|
-
package
|
264
|
-
@configuration.deployment_strategy.deploy
|
265
|
-
end
|
266
|
-
|
267
|
-
def release
|
268
|
-
# deploy or package depending on configuration
|
269
|
-
if @configuration.deployment_strategy then
|
270
|
-
deploy
|
271
|
-
else
|
272
|
-
package
|
273
|
-
end
|
274
|
-
|
275
|
-
# tag first, then prepare for next release and
|
276
|
-
# commit the updated plist
|
277
|
-
if @configuration.tag_vcs then
|
278
|
-
@configuration.release_strategy.tag_current_version
|
279
|
-
end
|
280
|
-
|
281
|
-
if @configuration.release_strategy != nil then
|
282
|
-
@configuration.release_strategy.prepare_for_next_release
|
283
|
-
end
|
284
|
-
puts "App successfully released"
|
285
|
-
end
|
286
169
|
end
|
287
170
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'Date'
|
2
3
|
require File.dirname(__FILE__) + '/deployment_strategies'
|
3
4
|
require File.dirname(__FILE__) + '/release_strategies'
|
4
5
|
|
@@ -20,10 +21,10 @@ module XcodeBuilder
|
|
20
21
|
args << "-project '#{project_file_path}'" if project_file_path
|
21
22
|
end
|
22
23
|
|
23
|
-
args << "-sdk
|
24
|
+
args << "-sdk iphoneos"
|
24
25
|
|
25
26
|
args << "-configuration '#{configuration}'"
|
26
|
-
args << "BUILD_DIR=#{File.expand_path build_dir}"
|
27
|
+
args << "BUILD_DIR=#{File.expand_path build_dir}"
|
27
28
|
|
28
29
|
if xcodebuild_extra_args
|
29
30
|
args.concat xcodebuild_extra_args if xcodebuild_extra_args.is_a? Array
|
@@ -35,7 +36,7 @@ module XcodeBuilder
|
|
35
36
|
|
36
37
|
def app_file_name
|
37
38
|
raise ArgumentError, "app_name or target must be set in the BetaBuilder configuration block" if app_name.nil?
|
38
|
-
"#{app_name}
|
39
|
+
"#{app_name}.app"
|
39
40
|
end
|
40
41
|
|
41
42
|
def info_plist_path
|
@@ -46,19 +47,6 @@ module XcodeBuilder
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
|
-
def final_bundle_id
|
50
|
-
final_plist_path = "#{app_bundle_path}/Info.plist"
|
51
|
-
# no plist is found, return a nil version
|
52
|
-
if (final_plist_path == nil) || (!File.exists? final_plist_path) then
|
53
|
-
return nil
|
54
|
-
end
|
55
|
-
|
56
|
-
# read the plist and extract data
|
57
|
-
plist = CFPropertyList::List.new(:file => final_plist_path)
|
58
|
-
data = CFPropertyList.native_types(plist.value)
|
59
|
-
data["CFBundleIdentifier"]
|
60
|
-
end
|
61
|
-
|
62
50
|
def build_number
|
63
51
|
# we have a podspec file, so try to get the version out of that
|
64
52
|
if (podspec_file != nil) && (File.exists? podspec_file) then
|
@@ -74,7 +62,7 @@ module XcodeBuilder
|
|
74
62
|
# read the plist and extract data
|
75
63
|
plist = CFPropertyList::List.new(:file => info_plist_path)
|
76
64
|
data = CFPropertyList.native_types(plist.value)
|
77
|
-
data["
|
65
|
+
data["CFBundleShortVersionString"]
|
78
66
|
end
|
79
67
|
|
80
68
|
def build_number_from_podspec
|
@@ -128,11 +116,7 @@ module XcodeBuilder
|
|
128
116
|
true
|
129
117
|
end
|
130
118
|
|
131
|
-
def
|
132
|
-
if !increment_plist_version then
|
133
|
-
return false
|
134
|
-
end
|
135
|
-
|
119
|
+
def timestamp_plist
|
136
120
|
if info_plist == nil then
|
137
121
|
return false
|
138
122
|
end
|
@@ -142,13 +126,20 @@ module XcodeBuilder
|
|
142
126
|
data = CFPropertyList.native_types(plist.value)
|
143
127
|
|
144
128
|
# re inject new version number into the data
|
145
|
-
data["CFBundleVersion"] =
|
129
|
+
data["CFBundleVersion"] = DateTime.now.strftime("%Y-%m-%d %k:%M")
|
146
130
|
|
147
131
|
# recreate the plist and save it
|
148
132
|
plist.value = CFPropertyList.guess(data)
|
149
133
|
plist.save(info_plist_path, CFPropertyList::List::FORMAT_XML)
|
150
134
|
end
|
151
135
|
|
136
|
+
|
137
|
+
|
138
|
+
def ipa_name
|
139
|
+
prefix = app_name == nil ? target : app_name
|
140
|
+
"#{prefix}#{built_app_long_version_suffix}.ipa"
|
141
|
+
end
|
142
|
+
|
152
143
|
def built_app_long_version_suffix
|
153
144
|
if build_number == nil then
|
154
145
|
""
|
@@ -156,50 +147,17 @@ module XcodeBuilder
|
|
156
147
|
"-#{build_number}"
|
157
148
|
end
|
158
149
|
end
|
159
|
-
|
160
|
-
def ipa_name
|
161
|
-
prefix = app_name == nil ? target : app_name
|
162
|
-
"#{prefix}#{built_app_long_version_suffix}.ipa"
|
163
|
-
end
|
164
150
|
|
165
151
|
def built_app_path
|
166
|
-
|
167
|
-
if build_dir == :derived
|
168
|
-
File.join("#{derived_build_dir}", "#{configuration}#{sdk_extension}", "#{app_file_name}")
|
169
|
-
else
|
170
|
-
File.join("#{build_dir}", "#{configuration}#{sdk_extension}", "#{app_file_name}")
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
def built_dsym_path
|
175
|
-
"#{built_app_path}.dSYM"
|
176
|
-
end
|
177
|
-
|
178
|
-
def derived_build_dir
|
179
|
-
workspace_name = Pathname.new(workspace_file_path).basename.to_s.split(".")[0]
|
180
|
-
for dir in Dir[File.join(File.expand_path("~/Library/Developer/Xcode/DerivedData"), "#{workspace_name}-*")]
|
181
|
-
return "#{dir}/Build/Products" if File.read( File.join(dir, "info.plist") ).match workspace_file_path
|
182
|
-
end
|
183
|
-
end
|
184
|
-
|
185
|
-
def zipped_package_name
|
186
|
-
"#{app_name}#{built_app_long_version_suffix}.zip"
|
152
|
+
File.join("#{build_dir}", "#{configuration}-iphoneos", "#{app_file_name}")
|
187
153
|
end
|
188
154
|
|
189
155
|
def ipa_path
|
190
156
|
File.join(File.expand_path(package_destination_path), ipa_name)
|
191
157
|
end
|
192
158
|
|
193
|
-
def dsym_name
|
194
|
-
"#{app_name}#{built_app_long_version_suffix}.dSYM.zip"
|
195
|
-
end
|
196
|
-
|
197
|
-
def dsym_path
|
198
|
-
File.join(File.expand_path(package_destination_path), dsym_name)
|
199
|
-
end
|
200
|
-
|
201
159
|
def app_bundle_path
|
202
|
-
"#{package_destination_path}/#{app_name}
|
160
|
+
"#{package_destination_path}/#{app_name}.app"
|
203
161
|
end
|
204
162
|
|
205
163
|
def deploy_using(strategy_name, &block)
|
@@ -29,11 +29,9 @@ module XcodeBuilder
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def self.strategies
|
32
|
-
{:
|
32
|
+
{:testflight => TestFlight}
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
require File.dirname(__FILE__) + '/deployment_strategies/scp'
|
38
37
|
require File.dirname(__FILE__) + '/deployment_strategies/testflight'
|
39
|
-
require File.dirname(__FILE__) + '/deployment_strategies/web'
|
@@ -30,20 +30,6 @@ module XcodeBuilder
|
|
30
30
|
:replace => @configuration.replace || false
|
31
31
|
}
|
32
32
|
|
33
|
-
if @configuration.upload_dsym then
|
34
|
-
payload[:dsym] = File.new(@configuration.dsym_path, 'rb')
|
35
|
-
end
|
36
|
-
|
37
|
-
if @configuration.verbose
|
38
|
-
puts "ipa path: #{@configuration.ipa_path}"
|
39
|
-
puts "release notes: #{release_notes}"
|
40
|
-
end
|
41
|
-
|
42
|
-
if @configuration.dry_run
|
43
|
-
puts '** Dry Run - No action here! **'
|
44
|
-
return
|
45
|
-
end
|
46
|
-
|
47
33
|
print "Uploading build to TestFlight..."
|
48
34
|
|
49
35
|
statusCode = 0
|
@@ -76,22 +76,7 @@ module XcodeBuilder
|
|
76
76
|
puts "Done"
|
77
77
|
end
|
78
78
|
|
79
|
-
def prepare_for_next_release
|
80
|
-
build_number = @configuration.build_number
|
81
|
-
next_build_number = @configuration.next_build_number
|
82
|
-
|
83
|
-
raise "build number cannot be empty on release" unless (build_number != nil) && (!build_number.empty?)
|
84
|
-
|
85
|
-
# increment the build number
|
86
|
-
@configuration.increment_plist_number
|
87
|
-
|
88
|
-
print "Committing #{@configuration.info_plist} with version #{next_build_number}"
|
89
79
|
|
90
|
-
stage_files [@configuration.info_plist]
|
91
|
-
commit_and_push_with_message "[Xcodebuilder] Releasing build #{build_number}"
|
92
|
-
|
93
|
-
puts "Done"
|
94
|
-
end
|
95
80
|
|
96
81
|
def stage_files files
|
97
82
|
cmd = []
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodebuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Larivain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: CFPropertyList
|
@@ -109,9 +109,7 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- lib/xcode_builder/build_output_parser.rb
|
111
111
|
- lib/xcode_builder/configuration.rb
|
112
|
-
- lib/xcode_builder/deployment_strategies/scp.rb
|
113
112
|
- lib/xcode_builder/deployment_strategies/testflight.rb
|
114
|
-
- lib/xcode_builder/deployment_strategies/web.rb
|
115
113
|
- lib/xcode_builder/deployment_strategies.rb
|
116
114
|
- lib/xcode_builder/release_strategies/git.rb
|
117
115
|
- lib/xcode_builder/release_strategies.rb
|
@@ -1,104 +0,0 @@
|
|
1
|
-
module XcodeBuilder
|
2
|
-
module DeploymentStrategies
|
3
|
-
class SCP < Strategy
|
4
|
-
def extended_configuration_for_strategy
|
5
|
-
proc do
|
6
|
-
def deployment_url
|
7
|
-
File.join(deploy_to, ipa_name)
|
8
|
-
end
|
9
|
-
|
10
|
-
def manifest_url
|
11
|
-
File.join(deploy_to, "manifest.plist")
|
12
|
-
end
|
13
|
-
|
14
|
-
def remote_installation_path
|
15
|
-
File.join(remote_directory)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def prepare
|
21
|
-
plist = CFPropertyList::List.new(:file => "#{@configuration.built_app_path}/Info.plist")
|
22
|
-
plist_data = CFPropertyList.native_types(plist.value)
|
23
|
-
File.open("pkg/dist/manifest.plist", "w") do |io|
|
24
|
-
io << %{<?xml version="1.0" encoding="UTF-8"?>
|
25
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
26
|
-
<plist version="1.0">
|
27
|
-
<dict>
|
28
|
-
<key>items</key>
|
29
|
-
<array>
|
30
|
-
<dict>
|
31
|
-
<key>assets</key>
|
32
|
-
<array>
|
33
|
-
<dict>
|
34
|
-
<key>kind</key>
|
35
|
-
<string>software-package</string>
|
36
|
-
<key>url</key>
|
37
|
-
<string>#{@configuration.deployment_url}</string>
|
38
|
-
</dict>
|
39
|
-
</array>
|
40
|
-
<key>metadata</key>
|
41
|
-
<dict>
|
42
|
-
<key>bundle-identifier</key>
|
43
|
-
<string>#{plist_data['CFBundleIdentifier']}</string>
|
44
|
-
<key>bundle-version</key>
|
45
|
-
<string>#{plist_data['CFBundleVersion']}</string>
|
46
|
-
<key>kind</key>
|
47
|
-
<string>software</string>
|
48
|
-
<key>title</key>
|
49
|
-
<string>#{plist_data['CFBundleDisplayName']}</string>
|
50
|
-
</dict>
|
51
|
-
</dict>
|
52
|
-
</array>
|
53
|
-
</dict>
|
54
|
-
</plist>
|
55
|
-
}
|
56
|
-
end
|
57
|
-
File.open("pkg/dist/index.html", "w") do |io|
|
58
|
-
io << %{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
59
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
60
|
-
<head>
|
61
|
-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
62
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
|
63
|
-
<title>Beta Download</title>
|
64
|
-
<style type="text/css">
|
65
|
-
body {background:#fff;margin:0;padding:0;font-family:arial,helvetica,sans-serif;text-align:center;padding:10px;color:#333;font-size:16px;}
|
66
|
-
#container {width:300px;margin:0 auto;}
|
67
|
-
h1 {margin:0;padding:0;font-size:14px;}
|
68
|
-
p {font-size:13px;}
|
69
|
-
.link {background:#ecf5ff;border-top:1px solid #fff;border:1px solid #dfebf8;margin-top:.5em;padding:.3em;}
|
70
|
-
.link a {text-decoration:none;font-size:15px;display:block;color:#069;}
|
71
|
-
</style>
|
72
|
-
</head>
|
73
|
-
<body>
|
74
|
-
<div id="container">
|
75
|
-
<div class="link"><a href="itms-services://?action=download-manifest&url=#{@configuration.manifest_url}">Tap Here to Install<br />#{@configuration.target} #{plist_data['CFBundleVersion']}<br />On Your Device</a></div>
|
76
|
-
<p><strong>Link didn't work?</strong><br />
|
77
|
-
Make sure you're visiting this page on your device, not your computer.</p>
|
78
|
-
</div>
|
79
|
-
</body>
|
80
|
-
</html>
|
81
|
-
}
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def deploy
|
86
|
-
cmd = []
|
87
|
-
|
88
|
-
cmd.push "scp"
|
89
|
-
|
90
|
-
if @configuration.remote_port
|
91
|
-
cmd.push "-P #{@configuration.remote_port}"
|
92
|
-
end
|
93
|
-
|
94
|
-
cmd.push "pkg/dist/*"
|
95
|
-
cmd.push "#{@configuration.remote_host}:#{@configuration.remote_installation_path}"
|
96
|
-
|
97
|
-
cmd = cmd.join(" ")
|
98
|
-
|
99
|
-
puts "* Running `#{cmd}`"
|
100
|
-
system(cmd)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'rest_client'
|
2
|
-
require 'json'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module XcodeBuilder
|
6
|
-
module DeploymentStrategies
|
7
|
-
class Web < Strategy
|
8
|
-
|
9
|
-
def prepare
|
10
|
-
puts "Nothing to prepare!" if @configuration.verbose
|
11
|
-
end
|
12
|
-
|
13
|
-
def deploy
|
14
|
-
puts "Deploying to the web server : '#{@configuration.server_url}'"
|
15
|
-
|
16
|
-
payload = {
|
17
|
-
:ipa_file => File.new(@configuration.ipa_path, 'rb'),
|
18
|
-
}
|
19
|
-
statusCode = 0
|
20
|
-
begin
|
21
|
-
response = RestClient::Request.new(:method => :post, :url => "#{@configuration.server_url}", :user => "#{@configuration.server_user}", :password => "#{@configuration.server_password}", :payload => payload).execute
|
22
|
-
statusCode = response.code
|
23
|
-
rescue => e
|
24
|
-
puts "Web upload failed with exception:\n#{e}Response\n#{e.response}"
|
25
|
-
end
|
26
|
-
if (statusCode == 200) || (statusCode == 201)
|
27
|
-
puts "Web upload completed"
|
28
|
-
else
|
29
|
-
puts "Web upload failed"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|