xcodebuilder 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61f2c186bfa641c9e2eadf057e6a7748d6dc669b
4
- data.tar.gz: 13834c56ca7c3acc454974334bda8bfc11c6365e
3
+ metadata.gz: b2884ecb86de6f30765001abd365acc4d99aba99
4
+ data.tar.gz: 134ac9259f1d7d47b96acc4e8af1c6f478997b6b
5
5
  SHA512:
6
- metadata.gz: dbab4c92062bcfe006f978bf24e70b17a5c38c0fdd540cc39ec44d65b6f2f30391390c1e2e70db91f27bf725b424940b42961c4b9833e88442139a5a3b8e5c43
7
- data.tar.gz: 89cbc68cef52955205d738af1dbdb36ed728bf080366d84301a1144583bbdb7bc6447cf0b9fdad3bbc381b9067c37290a1b7309c384bee99b228628a99f0b161
6
+ metadata.gz: af6ae39c60c829533d5e6be8cf146615ac90b67f4da258e11678e076d1fa5452c0b1a48bd99cbec59ce681fefea963c408c7e1a6493b18415b89225d1156dc2b
7
+ data.tar.gz: abb6ab02babab4fc030cb03cefa21dc585a957a68a19fbb45327f0c8eec2a0ab66b80c392530c32669b781daec1c2213484c1aab62921cdc870021e0f450a239
data/lib/xcode_builder.rb CHANGED
@@ -28,7 +28,8 @@ module XcodeBuilder
28
28
  :xcodebuild_extra_args => nil,
29
29
  :xcrun_extra_args => nil,
30
30
  :timestamp_build => nil,
31
- :pod_repo_sources => nil
31
+ :pod_repo_sources => nil,
32
+ :watch_app => false
32
33
  )
33
34
  @namespace = namespace
34
35
  yield @configuration if block_given?
@@ -70,9 +71,9 @@ module XcodeBuilder
70
71
  # update the long version number with the date
71
72
  @configuration.timestamp_plist if @configuration.timestamp_build
72
73
 
73
- print "Building Project..."
74
- success = xcodebuild @configuration.build_arguments, "build"
75
- raise "** BUILD FAILED **" unless success
74
+ # print "Building Project..."
75
+ # success = xcodebuild @configuration.build_arguments, "archive"
76
+ # raise "** BUILD FAILED **" unless success
76
77
  puts "Done"
77
78
  end
78
79
 
@@ -80,37 +81,68 @@ module XcodeBuilder
80
81
  def package
81
82
  build
82
83
 
83
- print "Packaging and Signing..."
84
- if (@configuration.signing_identity != nil) then
85
- puts ""
86
- print "Signing identity: #{@configuration.signing_identity}"
87
- end
88
-
84
+ puts "Packaging and Signing..."
89
85
  # trash and create the dist IPA path if needed
90
86
  FileUtils.rm_rf @configuration.package_destination_path unless !File.exists? @configuration.package_destination_path
91
87
  FileUtils.mkdir_p @configuration.package_destination_path
92
88
 
93
89
  # Construct the IPA and Sign it
94
90
  cmd = []
95
- cmd << "/usr/bin/xcrun"
96
- cmd << "-sdk iphoneos"
97
- cmd << "PackageApplication"
98
- cmd << "'#{@configuration.built_app_path}'"
99
- cmd << "-o '#{@configuration.ipa_path}'"
100
- cmd << "--sign '#{@configuration.signing_identity}'" unless @configuration.signing_identity == nil
101
-
102
- if @configuration.xcrun_extra_args then
103
- cmd.concat @configuration.xcrun_extra_args if @configuration.xcrun_extra_args.is_a? Array
104
- cmd << @configuration.xcrun_extra_args if @configuration.xcrun_extra_args.is_a? String
105
- end
91
+ cmd << "-exportArchive"
92
+ cmd << "-exportFormat"
93
+ cmd << "ipa"
94
+ cmd << "-exportWithOriginalSigningIdentity"
95
+ cmd << "-archivePath"
96
+ cmd << "'#{File.expand_path @configuration.xcarchive_path}'"
97
+ cmd << "-exportPath"
98
+ cmd << "'#{File.expand_path @configuration.ipa_path}'"
99
+
100
+ # puts "Running #{cmd.join(" ")}" if @configuration.verbose
101
+ # cmd << "2>&1 /dev/null"
102
+ # cmd = cmd.join(" ")
103
+ # system(cmd)
104
+ xcodebuild cmd, ""
105
+ puts "Done."
106
106
 
107
- puts "Running #{cmd.join(" ")}" if @configuration.verbose
108
- cmd << "2>&1 /dev/null"
109
- cmd = cmd.join(" ")
110
- system(cmd)
107
+ if @configuration.watch_app then
108
+ reinject_wk_stub_in_ipa
109
+ end
111
110
 
111
+ end
112
+
113
+ def reinject_wk_stub_in_ipa
114
+ puts ""
115
+ print "Reinject WK support into signed IPA..."
116
+ # create a tmp folder
117
+ tmp_folder = @configuration.package_destination_path + "tmp"
118
+ FileUtils.mkdir_p tmp_folder
119
+
120
+ # copy the ipa to it
121
+ FileUtils.cp "#{File.expand_path @configuration.ipa_path}", tmp_folder
122
+
123
+ # evaluate this here because this is based on pwd
124
+ full_ipa_path = @configuration.ipa_path
125
+ # keep track of current folder so can cd back to it and cd to tmp folder
126
+ current_folder = `pwd`.gsub("\n", "")
127
+ Dir.chdir tmp_folder
128
+
129
+ # unzip ipa and get rid of it
130
+ `unzip '#{@configuration.ipa_name}'`
131
+ FileUtils.rm @configuration.ipa_name
132
+
133
+ # now reinject the shiznit in
134
+ FileUtils.mkdir "WatchKitSupport"
135
+ #get the xcode path
136
+ base = `xcode-select --print-path`.gsub("\n", "")
137
+ wk_path = "#{base}/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/*"
138
+ FileUtils.cp_r Dir.glob(wk_path), "WatchKitSupport"
139
+
140
+ # now zip the fucker
141
+ `zip -r '#{full_ipa_path}' *`
142
+ Dir.chdir current_folder
143
+ FileUtils.rm_rf tmp_folder
144
+ print " Done."
112
145
  puts ""
113
- puts "Done."
114
146
  end
115
147
 
116
148
  def deploy
@@ -22,6 +22,8 @@ module XcodeBuilder
22
22
  end
23
23
 
24
24
  args << "-sdk iphoneos"
25
+
26
+ args << "-archivePath #{File.expand_path xcarchive_path}"
25
27
 
26
28
  args << "-configuration '#{configuration}'"
27
29
  args << "BUILD_DIR=\"#{File.expand_path build_dir}\""
@@ -135,6 +137,10 @@ module XcodeBuilder
135
137
  File.join("#{build_dir}", "#{configuration}-iphoneos", "#{app_file_name}")
136
138
  end
137
139
 
140
+ def xcarchive_path
141
+ File.join("#{build_dir}", "#{configuration}.xcarchive")
142
+ end
143
+
138
144
  def ipa_path
139
145
  File.join(File.expand_path(package_destination_path), ipa_name)
140
146
  end
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.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Larivain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: CFPropertyList