fastlane 1.2.3 → 1.3.0

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: fd3ec507f543216ab6994a08261f77f0ec8a1769
4
- data.tar.gz: 4aacd9764499f99369fdc58cafa1573880804c83
3
+ metadata.gz: cac5549eaf49e5cf8e11a96dbf3e2ffc7114d33c
4
+ data.tar.gz: dc206f2c9fc9256cbbcb41659f0c20e15609de31
5
5
  SHA512:
6
- metadata.gz: ff91b97fe644ef9c89145b6f514a6496f4b4391ab4dbcf84db3ed3739f863027ef9c5f29b3610d3597e8c864af63a13110a1cd3cff5e4b3270c09def262f7a59
7
- data.tar.gz: eaa790d5bf39b9592fc377842d2d8c2b3afc50998bd9d2965d0d9522e2db8a33d0e92d0a920908177de055ff6389c83263e9a24a0aeb9e3c7a30f317658cc60e
6
+ metadata.gz: fa3692f494fd08521731dde9533a3130010a7a32a39862dd345e50ab656f5bf6e6d5ae762cc968c69929d6a708d41685839a95ede9913a12e371c226e650ccdf
7
+ data.tar.gz: 15454ec54ca8062dbe512a908a675ce592872b212f7a357005899c92be30710c8c0d7a6592dccd17e6234effb15a9ef9ab1289cced12893ce8920bf8a0e50b5a
@@ -30,9 +30,9 @@ platform :ios do
30
30
 
31
31
  # increment_build_number
32
32
 
33
- ipa
33
+ ipa[[SCHEME]] # Build your app - more options available
34
34
 
35
- xctool
35
+ xctool # run the tests of your app
36
36
  end
37
37
 
38
38
  desc "Runs all the tests"
@@ -53,7 +53,7 @@ module Fastlane
53
53
 
54
54
  def self.author
55
55
  # So no one will ever forget your contribution to fastlane :) You are awesome btw!
56
- '[Your GitHub Name]'
56
+ '[Your GitHub/Twitter Name]'
57
57
  end
58
58
 
59
59
  def self.is_supported?(platform)
@@ -73,6 +73,10 @@ module Fastlane
73
73
  end
74
74
 
75
75
  def self.sh_no_action(command)
76
+ # Set the encoding first, the user might have set it wrong
77
+ Encoding.default_external = Encoding::UTF_8
78
+ Encoding.default_internal = Encoding::UTF_8
79
+
76
80
  command = command.join(' ') if command.is_a?(Array) # since it's an array of one element when running from the Fastfile
77
81
  Helper.log.info ['[SHELL COMMAND]', command.yellow].join(': ')
78
82
 
@@ -15,6 +15,7 @@ module Fastlane
15
15
 
16
16
  Dir.chdir(config[:deliver_file_path] || FastlaneFolder.path || Dir.pwd) do
17
17
  # This should be executed in the fastlane folder
18
+ return if Helper.is_test?
18
19
 
19
20
  Deliver::Deliverer.new(nil,
20
21
  force: config[:force],
@@ -16,7 +16,7 @@ module Fastlane
16
16
  # https://developer.apple.com/library/ios/qa/qa1827/_index.html
17
17
 
18
18
  begin
19
- folder = '.' #Current folder is the default folder
19
+ folder = params[:xcodeproj] ? File.join('.', params[:xcodeproj], '..') : '.'
20
20
 
21
21
  command_prefix = [
22
22
  'cd',
@@ -35,7 +35,7 @@ module Fastlane
35
35
  if Helper.test?
36
36
  version_array = [1,0,0]
37
37
  else
38
- raise "Your current version (#{current_version}) does not respect the format A.B.C" unless current_version.match(/\d.\d.\d/)
38
+ raise "Your current version (#{current_version}) does not respect the format A.B.C" unless current_version.match(/\d+.\d+.\d+/)
39
39
  version_array = current_version.split(".").map(&:to_i)
40
40
  end
41
41
 
@@ -107,7 +107,8 @@ module Fastlane
107
107
  verify_block: Proc.new do |value|
108
108
  raise "Please pass the path to the project, not the workspace".red if value.include?"workspace"
109
109
  raise "Could not find Xcode project".red unless File.exists?(value)
110
- end)
110
+ end,
111
+ optional: true)
111
112
  ]
112
113
  end
113
114
 
@@ -44,7 +44,7 @@ module Fastlane
44
44
  build_args = params_to_build_args(params)
45
45
 
46
46
  unless (params[:scheme] rescue nil)
47
- Helper.log.warn "You haven't specified a scheme. This might cause problems. If you can't see any outupt, please pass a `scheme`"
47
+ Helper.log.warn "You haven't specified a scheme. This might cause problems. If you can't see any output, please pass a `scheme`"
48
48
  end
49
49
 
50
50
  # If no dest directory given, default to current directory
@@ -59,19 +59,40 @@ module Fastlane
59
59
  # Joins args into space delimited string
60
60
  build_args = build_args.join(' ')
61
61
 
62
- command = "set -o pipefail && krausefx-ipa build #{build_args} --verbose | xcpretty"
62
+ core_command = "krausefx-ipa build #{build_args} --verbose | xcpretty"
63
+ command = "set -o pipefail && #{core_command}"
63
64
  Helper.log.debug command
64
- Actions.sh command
65
65
 
66
- # Finds absolute path of IPA and dSYM
67
- absolute_ipa_path = find_ipa_file(absolute_dest_directory)
68
- absolute_dsym_path = find_dsym_file(absolute_dest_directory)
69
-
70
- # Sets shared values to use after this action is performed
71
- Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path
72
- Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path
73
- ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver
74
- ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path
66
+ begin
67
+ Actions.sh command
68
+
69
+ # Finds absolute path of IPA and dSYM
70
+ absolute_ipa_path = find_ipa_file(absolute_dest_directory)
71
+ absolute_dsym_path = find_dsym_file(absolute_dest_directory)
72
+
73
+ # Sets shared values to use after this action is performed
74
+ Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = absolute_ipa_path
75
+ Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH] = absolute_dsym_path
76
+ ENV[SharedValues::IPA_OUTPUT_PATH.to_s] = absolute_ipa_path # for deliver
77
+ ENV[SharedValues::DSYM_OUTPUT_PATH.to_s] = absolute_dsym_path
78
+ rescue => ex
79
+ [
80
+ "-------------------------------------------------------",
81
+ "Original Error:",
82
+ " => " + ex.to_s,
83
+ "A build error occured. This can have many reasons, usually",
84
+ "it has something to do with code signing. The `ipa` action",
85
+ "uses `shenzhen` under the hood: https://github.com/nomad/shenzhen",
86
+ "The command that was used by fastlane:",
87
+ core_command,
88
+ "-------------------------------------------------------"
89
+ ].each do |txt|
90
+ Helper.log.error txt.yellow
91
+ end
92
+
93
+ # Raise a custom exception, as the the normal one is useless for the user
94
+ raise "A build error occured, this is usually related to code signing. Take a look at the error above".red
95
+ end
75
96
  end
76
97
 
77
98
  def self.params_to_build_args(config)
@@ -6,6 +6,8 @@ module Fastlane
6
6
  if params[:force] || params[:force] || Actions.lane_context[SharedValues::GIT_REPO_WAS_CLEAN_ON_START]
7
7
  paths = (params[:files] rescue nil)
8
8
 
9
+ return paths if Helper.is_test?
10
+
9
11
  if (paths || []).count == 0
10
12
  Actions.sh('git reset --hard HEAD')
11
13
  Actions.sh('git clean -qfdx')
@@ -40,6 +42,7 @@ module Fastlane
40
42
  env_name: "FL_RESET_GIT_FILES",
41
43
  description: "Array of files the changes should be discarded from. If not given, all files will be discarded",
42
44
  optional: true,
45
+ is_string: false,
43
46
  verify_block: Proc.new do |value|
44
47
  raise "Please pass an array only" unless value.kind_of?Array
45
48
  end),
@@ -21,7 +21,7 @@ module Fastlane
21
21
  ENV['SNAPSHOT_SKIP_OPEN_SUMMARY'] = "1" # it doesn't make sense to show the HTML page here
22
22
 
23
23
  begin
24
- Dir.chdir(FastlaneFolder.path) do
24
+ Dir.chdir(params[:snapshot_file_path] || FastlaneFolder.path) do
25
25
  Snapshot::SnapshotConfig.shared_instance
26
26
  Snapshot::Runner.new.work(clean: clean)
27
27
 
@@ -49,7 +49,14 @@ module Fastlane
49
49
  env_name: "FL_SNAPSHOT_VERBOSE",
50
50
  description: "Print out the UI Automation output",
51
51
  is_string: false,
52
- default_value: false)
52
+ default_value: false),
53
+ FastlaneCore::ConfigItem.new(key: :snapshot_file_path,
54
+ env_name: "FL_SNAPSHOT_CONFIG_PATH",
55
+ description: "Specify a path to the directory containing the Snapfile",
56
+ default_value: FastlaneFolder.path || Dir.pwd, # defaults to fastlane folder
57
+ verify_block: Proc.new do |value|
58
+ raise "Couldn't find folder '#{value}'. Make sure to pass the path to the directory not the file!".red unless File.directory?(value)
59
+ end)
53
60
  ]
54
61
  end
55
62
 
@@ -0,0 +1,119 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+
5
+ end
6
+
7
+ class UpdateProjectProvisioningAction < Action
8
+ ROOT_CERTIFICATE_URL = "http://www.apple.com/appleca/AppleIncRootCertificate.cer"
9
+ def self.run(params)
10
+
11
+ # assign folder from parameter or search for xcodeproj file
12
+ folder = params[:xcodeproj] || Dir["*.xcodeproj"].first
13
+
14
+ # validate folder
15
+ folder = File.join(folder, "project.pbxproj")
16
+ raise "Could not find path to project config '#{folder}'. Pass the path to your project (not workspace)!".red unless File.exists?(folder)
17
+
18
+ # download certificate
19
+ if not File.exists?(params[:certificate])
20
+ Helper.log.info("Downloading root certificate from (#{ROOT_CERTIFICATE_URL}) to path '#{params[:certificate]}'")
21
+ require 'open-uri'
22
+ File.open(params[:certificate], "w") do |file|
23
+ file.write(open(ROOT_CERTIFICATE_URL, "rb").read)
24
+ end
25
+ end
26
+
27
+ # parsing mobileprovision file
28
+ Helper.log.info("Parsing mobile provisioning profile from '#{params[:profile]}'")
29
+ profile = File.read(params[:profile])
30
+ p7 = OpenSSL::PKCS7.new(profile)
31
+ store = OpenSSL::X509::Store.new
32
+ cert = OpenSSL::X509::Certificate.new(File.read(params[:certificate]))
33
+ store.add_cert(cert)
34
+ verification = p7.verify([cert], store)
35
+ data = Plist::parse_xml(p7.data)
36
+
37
+ filter = params[:build_configuration_filter]
38
+
39
+ # manipulate project file
40
+ Helper.log.info("Going to update project '#{folder}' with UUID".green)
41
+ require 'pbxplorer'
42
+
43
+ project_file = XCProjectFile.new(folder)
44
+ project_file.project.targets.each do |target|
45
+ if filter
46
+ if target['productName'].match(filter) or target['productType'].match(filter)
47
+ Helper.log.info "Updating target #{target['productName']}...".green
48
+ else
49
+ Helper.log.info "Skipping target #{target['productName']} as it doesn't match the filter '#{filter}'".yellow
50
+ next
51
+ end
52
+ else
53
+ Helper.log.info "Updating target #{target['productName']}...".green
54
+ end
55
+
56
+ target.build_configuration_list.build_configurations.each do |build_configuration|
57
+ build_configuration["buildSettings"]["PROVISIONING_PROFILE"] = data["UUID"]
58
+ build_configuration["buildSettings"]["CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]"] = "$(SDKROOT)/ResourceRules.plist"
59
+ end
60
+ end
61
+
62
+ project_file.save
63
+
64
+ # complete
65
+ Helper.log.info("Successfully updated project settings in'#{params[:xcodeproj]}'".green)
66
+ end
67
+
68
+ def self.description
69
+ "Update projects code signing settings from your profisioning profile"
70
+ end
71
+
72
+ def self.details
73
+ [
74
+ "This action retrieves a provisioning profile UUID from a provisioning profile (.mobileprovision) to set",
75
+ "up the xcode projects' code signing settings in *.xcodeproj/project.pbxproj",
76
+ "",
77
+ "The `build_configuration_filter` value can be used to only update code signing for one target",
78
+ "Example Usage is the WatchKit Extension or WatchKit App, where you need separate provisioning profiles",
79
+ "Example: `update_project_provisioning(xcodeproj: \"..\", build_configuration_filter: \".*WatchKit App.*\")"
80
+ ].join("\n")
81
+ end
82
+
83
+ def self.available_options
84
+ [
85
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
86
+ env_name: "FL_PROJECT_PROVISIONING_PROJECT_PATH",
87
+ description: "Path to your Xcode project",
88
+ optional: true,
89
+ verify_block: Proc.new do |value|
90
+ raise "Path to xcode project is invalid".red unless File.exists?(value)
91
+ end),
92
+ FastlaneCore::ConfigItem.new(key: :profile,
93
+ env_name: "FL_PROJECT_PROVISIONING_PROFILE_FILE",
94
+ description: "Path to provisioning profile (.mobileprovision)",
95
+ default_value: Actions.lane_context[SharedValues::SIGH_PROFILE_PATH],
96
+ verify_block: Proc.new do |value|
97
+ raise "Path to provisioning profile is invalid".red unless File.exists?(value)
98
+ end),
99
+ FastlaneCore::ConfigItem.new(key: :build_configuration_filter,
100
+ env_name: "FL_PROJECT_PROVISIONING_PROFILE_FILTER",
101
+ description: "A filter for the target name. Use a standard regex",
102
+ optional: true),
103
+ FastlaneCore::ConfigItem.new(key: :certificate,
104
+ env_name: "FL_PROJECT_PROVISIONING_CERTIFICATE_PATH",
105
+ description: "Path to apple root certificate",
106
+ default_value: "/tmp/AppleIncRootCertificate.cer")
107
+ ]
108
+ end
109
+
110
+ def self.author
111
+ "tobiasstrebitzer"
112
+ end
113
+
114
+ def self.is_supported?(platform)
115
+ platform == :ios
116
+ end
117
+ end
118
+ end
119
+ end
@@ -2,6 +2,7 @@ module Fastlane
2
2
  class FastlaneFolder
3
3
  FOLDER_NAME = 'fastlane'
4
4
 
5
+ # Path to the fastlane folder containing the Fastfile and other configuration files
5
6
  def self.path
6
7
  return "./#{FOLDER_NAME}/" if File.directory?("./#{FOLDER_NAME}/")
7
8
  return "./.#{FOLDER_NAME}/" if File.directory?("./.#{FOLDER_NAME}/") # hidden folder
@@ -10,9 +11,10 @@ module Fastlane
10
11
  nil
11
12
  end
12
13
 
14
+ # Does a fastlane configuration already exist?
13
15
  def self.setup?
14
16
  return false unless path
15
- File.exist?(path)
17
+ File.exist?(File.join(path, "Fastfile"))
16
18
  end
17
19
 
18
20
  def self.create_folder!(path = nil)
@@ -3,7 +3,10 @@
3
3
  module Fastlane
4
4
  class Setup
5
5
  def run
6
- raise "Fastlane already set up at path #{folder}".yellow if (FastlaneFolder.setup? and not Helper.is_test?)
6
+ if (FastlaneFolder.setup? and not Helper.is_test?)
7
+ Helper.log.info "Fastlane already set up at path #{folder}".yellow
8
+ return
9
+ end
7
10
 
8
11
  show_infos
9
12
  response = agree('Do you want to get started? This will move your Deliverfile and Snapfile (if they exist) (y/n)'.yellow, true)
@@ -63,8 +66,10 @@ module Fastlane
63
66
  def generate_app_metadata
64
67
  Helper.log.info '------------------------------'
65
68
  Helper.log.info 'To not re-enter your username and app identifier every time you run one of the fastlane tools or fastlane, these will be stored from now on.'.green
69
+
66
70
  app_identifier = ask('App Identifier (com.krausefx.app): '.yellow)
67
71
  apple_id = ask('Your Apple ID (fastlane@krausefx.com): '.yellow)
72
+
68
73
  template = File.read("#{Helper.gem_path('fastlane')}/lib/assets/AppfileTemplate")
69
74
  template.gsub!('[[APP_IDENTIFIER]]', app_identifier)
70
75
  template.gsub!('[[APPLE_ID]]', apple_id)
@@ -117,6 +122,14 @@ module Fastlane
117
122
  def generate_fastfile
118
123
  template = File.read("#{Helper.gem_path('fastlane')}/lib/assets/FastfileTemplate")
119
124
 
125
+ scheme = ask("Optional: The scheme name of your app. If you don't need one, just click enter: ").to_s.strip
126
+ if scheme.length > 0
127
+ template.gsub!('[[SCHEME]]', "(scheme: \"#{scheme}\")")
128
+ else
129
+ template.gsub!('[[SCHEME]]', "")
130
+ end
131
+
132
+
120
133
  template.gsub!('deliver', '# deliver') unless @tools[:deliver]
121
134
  template.gsub!('snapshot', '# snapshot') unless @tools[:snapshot]
122
135
  template.gsub!('sigh', '# sigh') unless @tools[:sigh]
@@ -1,3 +1,3 @@
1
1
  module Fastlane
2
- VERSION = '1.2.3'
2
+ VERSION = '1.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.3.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: 2015-05-20 00:00:00.000000000 Z
11
+ date: 2015-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
138
  version: 1.4.5
139
+ - !ruby/object:Gem::Dependency
140
+ name: pbxplorer
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: 1.0.0
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: 1.0.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: fastlane_core
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -198,56 +212,56 @@ dependencies:
198
212
  requirements:
199
213
  - - '>='
200
214
  - !ruby/object:Gem::Version
201
- version: 0.5.5
215
+ version: 0.6.1
202
216
  type: :runtime
203
217
  prerelease: false
204
218
  version_requirements: !ruby/object:Gem::Requirement
205
219
  requirements:
206
220
  - - '>='
207
221
  - !ruby/object:Gem::Version
208
- version: 0.5.5
222
+ version: 0.6.1
209
223
  - !ruby/object:Gem::Dependency
210
- name: sigh
224
+ name: cert
211
225
  requirement: !ruby/object:Gem::Requirement
212
226
  requirements:
213
227
  - - '>='
214
228
  - !ruby/object:Gem::Version
215
- version: 0.5.1
229
+ version: 0.2.1
216
230
  type: :runtime
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
234
  - - '>='
221
235
  - !ruby/object:Gem::Version
222
- version: 0.5.1
236
+ version: 0.2.1
223
237
  - !ruby/object:Gem::Dependency
224
- name: produce
238
+ name: sigh
225
239
  requirement: !ruby/object:Gem::Requirement
226
240
  requirements:
227
241
  - - '>='
228
242
  - !ruby/object:Gem::Version
229
- version: 0.2.1
243
+ version: 0.5.2
230
244
  type: :runtime
231
245
  prerelease: false
232
246
  version_requirements: !ruby/object:Gem::Requirement
233
247
  requirements:
234
248
  - - '>='
235
249
  - !ruby/object:Gem::Version
236
- version: 0.2.1
250
+ version: 0.5.2
237
251
  - !ruby/object:Gem::Dependency
238
- name: cert
252
+ name: produce
239
253
  requirement: !ruby/object:Gem::Requirement
240
254
  requirements:
241
255
  - - '>='
242
256
  - !ruby/object:Gem::Version
243
- version: 0.2.0
257
+ version: 0.2.1
244
258
  type: :runtime
245
259
  prerelease: false
246
260
  version_requirements: !ruby/object:Gem::Requirement
247
261
  requirements:
248
262
  - - '>='
249
263
  - !ruby/object:Gem::Version
250
- version: 0.2.0
264
+ version: 0.2.1
251
265
  - !ruby/object:Gem::Dependency
252
266
  name: bundler
253
267
  requirement: !ruby/object:Gem::Requirement
@@ -426,6 +440,7 @@ files:
426
440
  - lib/fastlane/actions/typetalk.rb
427
441
  - lib/fastlane/actions/update_fastlane.rb
428
442
  - lib/fastlane/actions/update_project_code_signing.rb
443
+ - lib/fastlane/actions/update_project_provisioning.rb
429
444
  - lib/fastlane/actions/xcode_select.rb
430
445
  - lib/fastlane/actions/xcodebuild.rb
431
446
  - lib/fastlane/actions/xctool.rb