fastlane_core 0.33.0 → 0.34.0

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: 02578f98b483a8ba6920f39779d71ba1ba03774c
4
- data.tar.gz: 487cd019f1800b5fcb2725ae2314a7a965323640
3
+ metadata.gz: 6c4e0e0dfd2c77a1169ff2dcb62cf7f353f71938
4
+ data.tar.gz: 5c439e39a2d28893b40eee0fde61967d11688783
5
5
  SHA512:
6
- metadata.gz: 8e62feb2d668f4209197e34000348ec2b2baf1ea98240528e53463d7dafc5e8feebbc251234993feaca37ff6c62a86f1fd1f02f53312c8b0d879ceb7f0bbb2f7
7
- data.tar.gz: 7bc72d09706072f4dde1b7990ab8428af297858bc030e580a6bab0a6cec09bebe46358a3aac03eac3298e553efdd0a29a81a0d2c1a3bcaed788fc9d2e365ee9a
6
+ metadata.gz: f3a670a6ab99b201705a0344cdcc589639050213b301acd6611f674960fe0d8d7b148f0777e31337a6d072c8fe60c61e3ad1ce2c2ecd1ca0131ce018e2451c73
7
+ data.tar.gz: 56c7324933a6ef4f17312a785f353b33d5388ef0bd58a27bfbc54cfea462c7280d1f6a510942cffd1552e2a97c8c0e543d791d3a023edba4a1f8373bdfdf7a51
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <package xmlns="http://apple.com/itunes/importer" version="software5.4">
3
3
  <software_assets apple_id="<%= @data[:apple_id] %>" app_platform="<%= @data[:platform] %>">
4
- <asset type="bundle">
4
+ <asset type="<%= @data[:archive_type] %>">
5
5
  <data_file>
6
6
  <size><%= @data[:file_size] %></size>
7
7
  <file_name><%= @data[:ipa_path] %></file_name>
data/lib/fastlane_core.rb CHANGED
@@ -10,6 +10,8 @@ require 'fastlane_core/cert_checker'
10
10
  require 'fastlane_core/ipa_file_analyser'
11
11
  require 'fastlane_core/itunes_transporter'
12
12
  require 'fastlane_core/provisioning_profile'
13
+ require 'fastlane_core/pkg_file_analyser'
14
+ require 'fastlane_core/pkg_upload_package_builder'
13
15
  require 'fastlane_core/command_executor'
14
16
  require 'fastlane_core/ipa_upload_package_builder'
15
17
  require 'fastlane_core/print_table'
@@ -20,6 +20,7 @@ module FastlaneCore
20
20
  file_size: File.size(ipa_path),
21
21
  ipa_path: File.basename(ipa_path), # this is only the base name as the ipa is inside the package
22
22
  md5: Digest::MD5.hexdigest(File.read(ipa_path)),
23
+ archive_type: "bundle",
23
24
  platform: (platform || "ios") # pass "appletvos" for Apple TV's IPA
24
25
  }
25
26
 
@@ -0,0 +1,42 @@
1
+ require 'rexml/document'
2
+
3
+ module FastlaneCore
4
+ class PkgFileAnalyser
5
+ def self.fetch_app_identifier(path)
6
+ xml = self.fetch_distribution_xml_file(path)
7
+ return xml.elements['installer-gui-script/product'].attributes['id'] if xml
8
+ return nil
9
+ end
10
+
11
+ # Fetches the app version from the given pkg file.
12
+ def self.fetch_app_version(path)
13
+ xml = self.fetch_distribution_xml_file(path)
14
+ return xml.elements['installer-gui-script/product'].attributes['version'] if xml
15
+ return nil
16
+ end
17
+
18
+ def self.fetch_distribution_xml_file(path)
19
+ Dir.mktmpdir do |dir|
20
+ Helper.backticks("xar -C #{dir} -xf #{path}")
21
+
22
+ Dir.foreach(dir) do |file|
23
+ next unless file.include? 'Distribution'
24
+
25
+ begin
26
+ content = File.open(File.join(dir, file))
27
+ xml = REXML::Document.new(content)
28
+
29
+ if xml.elements['installer-gui-script/product']
30
+ return xml
31
+ end
32
+ rescue => ex
33
+ Helper.log.error ex
34
+ Helper.log.error "Error parsing *.pkg distribution xml #{File.join(dir, file)}".red
35
+ end
36
+ end
37
+
38
+ nil
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,46 @@
1
+ require 'digest/md5'
2
+
3
+ module FastlaneCore
4
+ # Builds a package for the pkg ready to be uploaded with the iTunes Transporter
5
+ class PkgUploadPackageBuilder
6
+ METADATA_FILE_NAME = 'metadata.xml'
7
+
8
+ attr_accessor :package_path
9
+
10
+ def generate(app_id: nil, pkg_path: nil, package_path: nil)
11
+ self.package_path = File.join(package_path, "#{app_id}.itmsp")
12
+ FileUtils.rm_rf(self.package_path) if File.directory?(self.package_path)
13
+ FileUtils.mkdir_p self.package_path
14
+
15
+ lib_path = Helper.gem_path('fastlane_core')
16
+
17
+ pkg_path = copy_pkg(pkg_path)
18
+ @data = {
19
+ apple_id: app_id,
20
+ file_size: File.size(pkg_path),
21
+ ipa_path: File.basename(pkg_path), # this is only the base name as the ipa is inside the package
22
+ md5: Digest::MD5.hexdigest(File.read(pkg_path)),
23
+ archive_type: 'product-archive',
24
+ platform: 'osx'
25
+ }
26
+
27
+ xml_path = File.join(lib_path, 'lib/assets/XMLTemplate.xml.erb')
28
+ xml = ERB.new(File.read(xml_path)).result(binding) # http://www.rrn.dk/rubys-erb-templating-system
29
+
30
+ File.write(File.join(self.package_path, METADATA_FILE_NAME), xml)
31
+ Helper.log.info "Wrote XML data to '#{self.package_path}'".green if $verbose
32
+
33
+ package_path
34
+ end
35
+
36
+ private
37
+
38
+ def copy_pkg(pkg_path)
39
+ ipa_file_name = Digest::MD5.hexdigest(pkg_path)
40
+ resulting_path = File.join(self.package_path, "#{ipa_file_name}.pkg")
41
+ FileUtils.cp(pkg_path, resulting_path)
42
+
43
+ resulting_path
44
+ end
45
+ end
46
+ end
@@ -121,6 +121,20 @@ module FastlaneCore
121
121
  parsed_info.configurations
122
122
  end
123
123
 
124
+ # Returns bundle_id and sets the scheme for xcrun
125
+ def default_app_identifier
126
+ default_build_settings(key: "PRODUCT_BUNDLE_IDENTIFIER")
127
+ end
128
+
129
+ # Returns app name and sets the scheme for xcrun
130
+ def default_app_name
131
+ if is_workspace
132
+ return default_build_settings(key: "PRODUCT_NAME")
133
+ else
134
+ return app_name
135
+ end
136
+ end
137
+
124
138
  def app_name
125
139
  # WRAPPER_NAME: Example.app
126
140
  # WRAPPER_SUFFIX: .app
@@ -163,12 +177,11 @@ module FastlaneCore
163
177
  # Get the build settings for our project
164
178
  # this is used to properly get the DerivedData folder
165
179
  # @param [String] The key of which we want the value for (e.g. "PRODUCT_NAME")
166
- def build_settings(key: nil, optional: true, silent: false)
180
+ def build_settings(key: nil, optional: true)
167
181
  unless @build_settings
168
182
  # We also need to pass the workspace and scheme to this command
169
183
  command = "xcrun xcodebuild -showBuildSettings #{xcodebuild_parameters.join(' ')}"
170
- Helper.log.info command.yellow unless silent
171
- @build_settings = `#{command}`
184
+ @build_settings = Helper.backticks(command, print: false)
172
185
  end
173
186
 
174
187
  begin
@@ -184,6 +197,12 @@ module FastlaneCore
184
197
  nil
185
198
  end
186
199
 
200
+ # Returns the build settings and sets the default scheme to the options hash
201
+ def default_build_settings(key: nil, optional: true, silent: false)
202
+ options[:scheme] = schemes.first if is_workspace
203
+ build_settings(key: key, optional: optional, silent: silent)
204
+ end
205
+
187
206
  def raw_info(silent: false)
188
207
  # Examples:
189
208
 
@@ -24,7 +24,7 @@ module FastlaneCore
24
24
  def parse(path)
25
25
  require 'plist'
26
26
 
27
- plist = Plist.parse_xml(`security cms -D -i '#{path}'`)
27
+ plist = Plist.parse_xml(`security cms -D -i "#{path}"`)
28
28
  if (plist || []).count > 5
29
29
  plist
30
30
  else
@@ -106,6 +106,8 @@ module FastlaneCore
106
106
 
107
107
  # Pass an exception to this method to exit the program
108
108
  # using the given exception
109
+ # Use this method instead of user_error! if this error is
110
+ # unexpected, e.g. an invalid server response that shouldn't happen
109
111
  def crash!(_exception)
110
112
  not_implemented(__method__)
111
113
  end
@@ -115,6 +117,8 @@ module FastlaneCore
115
117
  # or invalid user credentials
116
118
  # This will show the error message, but doesn't show the full
117
119
  # stack trace
120
+ # Basically this should be used when you actively catch the error
121
+ # and want to show a nice error message to the user
118
122
  def user_error!(_error_message)
119
123
  not_implemented(__method__)
120
124
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.33.0"
2
+ VERSION = "0.34.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.33.0
4
+ version: 0.34.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -349,6 +349,8 @@ files:
349
349
  - lib/fastlane_core/itunes_search_api.rb
350
350
  - lib/fastlane_core/itunes_transporter.rb
351
351
  - lib/fastlane_core/languages.rb
352
+ - lib/fastlane_core/pkg_file_analyser.rb
353
+ - lib/fastlane_core/pkg_upload_package_builder.rb
352
354
  - lib/fastlane_core/print_table.rb
353
355
  - lib/fastlane_core/project.rb
354
356
  - lib/fastlane_core/provisioning_profile.rb
@@ -381,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
381
383
  version: '0'
382
384
  requirements: []
383
385
  rubyforge_project:
384
- rubygems_version: 2.4.5.1
386
+ rubygems_version: 2.4.5
385
387
  signing_key:
386
388
  specification_version: 4
387
389
  summary: Contains all shared code/dependencies of the fastlane.tools