fastlane 1.7.3 → 1.8.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: 3719594f0dc113b73b07509a43f5daa459c69879
4
- data.tar.gz: f5fede279421253290b123cae0e275e8f73adcfa
3
+ metadata.gz: c339ea21edfc2acca2f46b9a751d03795647c3f6
4
+ data.tar.gz: 9c35a144521c7f03f7a9c7fe5441026ed9882d59
5
5
  SHA512:
6
- metadata.gz: 2c0d4bf339f2ea29298e934611cb7be5a9cfda72c27a6b238dea39479889170f11f6fb332a5b5a0ddd67650ffcc3c321bb498c3190a20b2d1890aec7409d8044
7
- data.tar.gz: 2fa46225e0200c809dcfba03662958eb085a4c614a21b21ce0a48cf6c3d64360ccf211be4a84885ba2c59ca261058c8be074d1b180b4ce269e3490078903d27a
6
+ metadata.gz: cc15fe2094ff6748d3c9f9ba7fc029b60eb7faafe91b9f7c407a749232fed51ab25a852f6b69b746ae4b0b3cd296cc260aa9b4e291385a09c530369978a05beb
7
+ data.tar.gz: 4849594603cd554346c5ddc54d97a1365903df26f1a14507719ecd2434ae780c79515a7c8c88c5d0392f5bfffac7da8694bc63487d3abb972bbdd965499fcd06
data/README.md CHANGED
@@ -116,7 +116,7 @@ The setup assistant will create all the necessary files for you, using the exist
116
116
 
117
117
  For more details, please follow the [fastlane guide](https://github.com/KrauseFx/fastlane/blob/master/docs/Guide.md) or [documentation](https://github.com/KrauseFx/fastlane/blob/master/docs).
118
118
 
119
- There is also a [Japanese fastlane guide](http://qiita.com/gin0606/items/162d756dfda7b84e97d4) available.
119
+ There are also 2 Japanese fastlane guides available: [qiita](http://qiita.com/gin0606/items/162d756dfda7b84e97d4) and [mercari](http://tech.mercari.com/entry/2015/07/13/143000)
120
120
 
121
121
  ## Available commands
122
122
 
@@ -156,11 +156,13 @@ See how [Wikipedia](https://github.com/fastlane/examples#wikipedia-by-wikimedia-
156
156
 
157
157
  You can easily opt-out by adding `opt_out_usage` to your `Fastfile` or by setting the environment variable `FASTLANE_OPT_OUT_USAGE`.
158
158
 
159
+ To also disable update checks, set the `FASTLANE_SKIP_UPDATE_CHECK` variable.
160
+
159
161
  ## Credentials
160
- A detailed description about how ```fastlane``` stores your credentials is available on a [separate repo](https://github.com/KrauseFx/CredentialsManager).
162
+ A detailed description about how `fastlane` stores your credentials is available on a [separate repo](https://github.com/KrauseFx/CredentialsManager).
161
163
 
162
164
  ## Need help?
163
- - If there is a technical problem with ```fastlane```, [open an issue](https://github.com/KrauseFx/fastlane/issues/new).
165
+ - If there is a technical problem with `fastlane`, [open an issue](https://github.com/KrauseFx/fastlane/issues/new).
164
166
  - I'm available for contract work - drop me an email: fastlane@krausefx.com
165
167
 
166
168
  ## Special Thanks
data/bin/fastlane CHANGED
@@ -13,7 +13,10 @@ class FastlaneApplication
13
13
 
14
14
  def run
15
15
  program :version, Fastlane::VERSION
16
- program :description, "CLI for 'fastlane' - Connect all iOS deployment tools into one streamlined workflow.\n\nRun using fastlane [lane_name]"
16
+ program :description, [
17
+ "CLI for 'fastlane' - Connect all iOS deployment tools into one streamlined workflow.\n",
18
+ "\tRun using `fastlane [platform] [lane_name]`",
19
+ "\tTo pass values to the lanes use `fastlane [platform] [lane_name] key:value key2:value2`"].join("\n")
17
20
  program :help, 'Author', 'Felix Krause <fastlane@krausefx.com>'
18
21
  program :help, 'Website', 'https://fastlane.tools'
19
22
  program :help, 'GitHub', 'https://github.com/krausefx/fastlane'
@@ -28,15 +31,8 @@ class FastlaneApplication
28
31
 
29
32
  c.action do |args, _options|
30
33
  if Fastlane::FastlaneFolder.path
31
- platform = nil
32
- lane = args[1]
33
- if lane
34
- platform = args[0]
35
- else
36
- lane = args[0]
37
- end
38
-
39
- Fastlane::LaneManager.cruise_lane(platform, lane, _options.env)
34
+
35
+ Fastlane::CommandLineHandler.handle(args, _options)
40
36
  else
41
37
  create = agree('Could not find fastlane in current directory. Would you like to set it up? (y/n)'.yellow, true)
42
38
  Fastlane::Setup.new.run if create
data/lib/fastlane.rb CHANGED
@@ -12,6 +12,7 @@ require 'fastlane/action'
12
12
  require 'fastlane/action_collector'
13
13
  require 'fastlane/supported_platforms'
14
14
  require 'fastlane/configuration_helper'
15
+ require 'fastlane/command_line_handler'
15
16
 
16
17
  require 'fastlane_core'
17
18
 
@@ -3,14 +3,14 @@ module Fastlane
3
3
  HOST_URL = "https://fastlane-enhancer.herokuapp.com/"
4
4
 
5
5
  def did_launch_action(name)
6
- if is_official(name)
6
+ if is_official?(name)
7
7
  launches[name] ||= 0
8
8
  launches[name] += 1
9
9
  end
10
10
  end
11
11
 
12
12
  def did_raise_error(name)
13
- if is_official(name)
13
+ if is_official?(name)
14
14
  @error = name
15
15
  end
16
16
  end
@@ -18,31 +18,35 @@ module Fastlane
18
18
  # Sends the used actions
19
19
  # Example data => [:xcode_select, :deliver, :notify, :slack]
20
20
  def did_finish
21
- Thread.new do
22
- unless ENV["FASTLANE_OPT_OUT_USAGE"]
23
- begin
24
- unless did_show_message?
25
- Helper.log.debug("Sending Crash/Success information. More information on: https://github.com/fastlane/enhancer")
26
- Helper.log.debug("No personal/sensitive data is sent. Only sharing the following:")
27
- Helper.log.debug(launches)
28
- Helper.log.debug(@error) if @error
29
- Helper.log.debug("This information is used to fix failing actions and improve integrations that are often used.")
30
- Helper.log.debug("You can disable this by adding `opt_out_usage` to your Fastfile")
31
- end
21
+ unless ENV["FASTLANE_OPT_OUT_USAGE"]
22
+ begin
23
+ unless did_show_message?
24
+ Helper.log.debug("Sending Crash/Success information. More information on: https://github.com/fastlane/enhancer")
25
+ Helper.log.debug("No personal/sensitive data is sent. Only sharing the following:")
26
+ Helper.log.debug(launches)
27
+ Helper.log.debug(@error) if @error
28
+ Helper.log.debug("This information is used to fix failing actions and improve integrations that are often used.")
29
+ Helper.log.debug("You can disable this by adding `opt_out_usage` to your Fastfile")
30
+ end
32
31
 
33
- require 'excon'
34
- url = HOST_URL + '/did_launch?'
35
- url += URI.encode_www_form(
36
- steps: launches.to_json,
37
- error: @error
38
- )
32
+ require 'excon'
33
+ url = HOST_URL + '/did_launch?'
34
+ url += URI.encode_www_form(
35
+ steps: launches.to_json,
36
+ error: @error
37
+ )
39
38
 
40
- unless Helper.is_test? # don't send test data
41
- Excon.post(url)
39
+ unless Helper.is_test? # don't send test data
40
+ fork do
41
+ begin
42
+ Excon.post(url)
43
+ rescue
44
+ # we don't want to show a stack trace if something goes wrong
45
+ end
42
46
  end
43
- rescue
44
- # We don't care about connection errors
45
47
  end
48
+ rescue
49
+ # We don't care about connection errors
46
50
  end
47
51
  end
48
52
  end
@@ -51,7 +55,8 @@ module Fastlane
51
55
  @launches ||= {}
52
56
  end
53
57
 
54
- def is_official(name)
58
+ def is_official?(name)
59
+ return true if name == :lane_switch
55
60
  Actions.get_all_official_actions.include?name
56
61
  end
57
62
 
@@ -77,6 +77,7 @@ module Fastlane
77
77
  FastlaneCore::ConfigItem.new(key: :dsym,
78
78
  env_name: "FL_HOCKEY_DSYM",
79
79
  description: "Path to your DSYM file",
80
+ default_value: Actions.lane_context[SharedValues::DSYM_OUTPUT_PATH],
80
81
  optional: true,
81
82
  verify_block: Proc.new do |value|
82
83
  # validation is done in the action
@@ -7,6 +7,7 @@ module Fastlane
7
7
  command = "security import #{params[:certificate_path].shellescape} -k ~/Library/Keychains/#{params[:keychain_name].shellescape}"
8
8
  command << " -P #{params[:certificate_password].shellescape}" if params[:certificate_password]
9
9
  command << " -T /usr/bin/codesign"
10
+ command << " -T /usr/bin/security"
10
11
 
11
12
  Fastlane::Actions.sh command, log: false
12
13
  end
@@ -0,0 +1,44 @@
1
+ module Fastlane
2
+ class CommandLineHandler
3
+ # This method handles command line inputs and properly transforms them to a usable format
4
+ # @param [Array] args An array of all arguments (not options)
5
+ # @param [Array] args A hash of all options (e.g. --env NAME)
6
+ def self.handle(args, options)
7
+ lane_parameters = {} # the parameters we'll pass to the lane
8
+ platform_lane_info = [] # the part that's responsible for the lane/platform definition
9
+ args.each do |current|
10
+ if current.include?":" # that's a key/value which we want to pass to the lane
11
+ key, value = current.split(":")
12
+ raise "Please pass values like this: key:value" unless (key.length > 0 and value.length > 0)
13
+ value = convert_value(value)
14
+ Helper.log.debug "Using #{key}: #{value}".green
15
+ lane_parameters[key.to_sym] = value
16
+ else
17
+ platform_lane_info << current
18
+ end
19
+ end
20
+
21
+ platform = nil
22
+ lane = platform_lane_info[1]
23
+ if lane
24
+ platform = platform_lane_info[0]
25
+ else
26
+ lane = platform_lane_info[0]
27
+ end
28
+
29
+ dot_env = options.env rescue nil # we don't really care about this option in tests
30
+
31
+ Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters, dot_env)
32
+ end
33
+
34
+ private
35
+ # Conert into the right data type
36
+ def self.convert_value(value)
37
+ return true if (value == 'true' or value == 'yes')
38
+ return false if (value == 'false' || value == 'no')
39
+
40
+ # Default case:
41
+ return value
42
+ end
43
+ end
44
+ end
@@ -68,62 +68,81 @@ module Fastlane
68
68
  @runner.set_error(@current_platform, block)
69
69
  end
70
70
 
71
+ def try_switch_to_lane(new_lane, parameters)
72
+ current_platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
73
+ block = @runner.blocks.fetch(current_platform, {}).fetch(new_lane, nil)
74
+ platform_nil = (block == nil) # used for the output
75
+ block ||= @runner.blocks.fetch(nil, {}).fetch(new_lane, nil) # fallback to general lane for multiple platforms
76
+ if block
77
+ pretty = [new_lane]
78
+ pretty = [current_platform, new_lane] unless platform_nil
79
+ Helper.log.info "Cruising over to lane '#{pretty.join(' ')}' 🚖".green
80
+ collector.did_launch_action(:lane_switch)
81
+ result = block.call(parameters.first || {}) # to always pass a hash
82
+ original_lane = Actions.lane_context[Actions::SharedValues::LANE_NAME]
83
+ Helper.log.info "Cruising back to lane '#{original_lane}' 🚘".green
84
+ return result
85
+ else
86
+ # No action and no lane, raising an exception now
87
+ raise "Could not find action or lane '#{new_lane}'. Check out the README for more details: https://github.com/KrauseFx/fastlane".red
88
+ end
89
+ end
90
+
91
+ def execute_action(method_sym, class_ref, arguments)
92
+ collector.did_launch_action(method_sym)
93
+
94
+ step_name = class_ref.step_text rescue nil
95
+ step_name = method_sym.to_s unless step_name
96
+
97
+ verify_supported_os(method_sym, class_ref)
98
+
99
+ Helper.log_alert("Step: " + step_name)
100
+
101
+ begin
102
+ Dir.chdir('..') do # go up from the fastlane folder, to the project folder
103
+ Actions.execute_action(method_sym) do
104
+ # arguments is an array by default, containing an hash with the actual parameters
105
+ # Since we usually just need the passed hash, we'll just use the first object if there is only one
106
+ if arguments.count == 0
107
+ arguments = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hash
108
+ elsif arguments.count == 1 and arguments.first.kind_of?Hash
109
+ arguments = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed
110
+ elsif not class_ref.available_options
111
+ # This action does not use the new action format
112
+ # Just passing the arguments to this method
113
+ else
114
+ raise "You have to pass the options for '#{method_sym}' in a different way. Please check out the current documentation on GitHub!".red
115
+ end
116
+
117
+ class_ref.run(arguments)
118
+ end
119
+ end
120
+ rescue => ex
121
+ collector.did_raise_error(method_sym)
122
+ raise ex
123
+ end
124
+ end
125
+
71
126
  # Is used to look if the method is implemented as an action
72
127
  def method_missing(method_sym, *arguments, &_block)
73
128
  # First, check if there is a predefined method in the actions folder
74
-
75
129
  class_name = method_sym.to_s.fastlane_class + 'Action'
76
130
  class_ref = nil
77
131
  begin
78
132
  class_ref = Fastlane::Actions.const_get(class_name)
133
+ if class_ref && class_ref.respond_to?(:run)
134
+ # Action is available, now execute it
135
+ return execute_action(method_sym, class_ref, arguments)
136
+ else
137
+ raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red
138
+ end
79
139
  rescue NameError => ex
80
140
  # Action not found
81
- raise "Could not find method '#{method_sym}'. Check out the README for more details: https://github.com/KrauseFx/fastlane".red
82
- end
83
-
84
- if class_ref && class_ref.respond_to?(:run)
85
- collector.did_launch_action(method_sym)
86
-
87
- step_name = class_ref.step_text rescue nil
88
- step_name = method_sym.to_s unless step_name
89
-
90
- verify_supported_os(method_sym, class_ref)
91
-
92
- Helper.log_alert("Step: " + step_name)
93
-
94
- begin
95
- Dir.chdir('..') do # go up from the fastlane folder, to the project folder
96
- Actions.execute_action(method_sym) do
97
- # arguments is an array by default, containing an hash with the actual parameters
98
- # Since we usually just need the passed hash, we'll just use the first object if there is only one
99
- if arguments.count == 0
100
- arguments = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hsh
101
- elsif arguments.count == 1 and arguments.first.kind_of?Hash
102
- arguments = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed
103
- elsif not class_ref.available_options
104
- # This action does not use the new action format
105
- # Just passing the arguments to this method
106
- else
107
- Helper.log.fatal "------------------------------------------------------------------------------------".red
108
- Helper.log.fatal "If you've been an existing fastlane user, please check out the MigrationGuide to 1.0".yellow
109
- Helper.log.fatal "https://github.com/KrauseFx/fastlane/blob/master/docs/MigrationGuide.md".yellow
110
- Helper.log.fatal "------------------------------------------------------------------------------------".red
111
- raise "You have to pass the options for '#{method_sym}' in a different way. Please check out the current documentation on GitHub!".red
112
- end
113
-
114
- class_ref.run(arguments)
115
- end
116
- end
117
- rescue => ex
118
- collector.did_raise_error(method_sym)
119
- raise ex
120
- end
121
- else
122
- raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red
141
+ # Is there a lane under this name?
142
+ return try_switch_to_lane(method_sym, arguments)
123
143
  end
124
144
  end
125
145
 
126
-
127
146
  #####################################################
128
147
  # @!group Other things
129
148
  #####################################################
@@ -2,9 +2,12 @@ module Fastlane
2
2
  class LaneManager
3
3
  # @param platform The name of the platform to execute
4
4
  # @param lane_name The name of the lane to execute
5
- def self.cruise_lane(platform, lane, env = nil)
5
+ # @param parameters [Hash] The parameters passed from the command line to the lane
6
+ # @param env Dot Env Information
7
+ def self.cruise_lane(platform, lane, parameters = nil, env = nil)
6
8
  raise 'lane must be a string' unless (lane.is_a?(String) or lane.nil?)
7
9
  raise 'platform must be a string' unless (platform.is_a?(String) or platform.nil?)
10
+ raise 'parameters must be a hash' unless (parameters.is_a?(Hash) or parameters.nil?)
8
11
 
9
12
  ff = Fastlane::FastFile.new(File.join(Fastlane::FastlaneFolder.path, 'Fastfile'))
10
13
 
@@ -30,7 +33,7 @@ module Fastlane
30
33
  started = Time.now
31
34
  e = nil
32
35
  begin
33
- ff.runner.execute(lane, platform)
36
+ ff.runner.execute(lane, platform, parameters)
34
37
  rescue => ex
35
38
  Helper.log.info 'Variable Dump:'.yellow
36
39
  Helper.log.info Actions.lane_context
@@ -47,15 +50,12 @@ module Fastlane
47
50
 
48
51
  # All the finishing up that needs to be done
49
52
  def self.finish_fastlane(ff, duration, error)
50
- thread = ff.did_finish
53
+ ff.did_finish
51
54
 
52
55
  # Finished with all the lanes
53
56
  Fastlane::JUnitGenerator.generate(Fastlane::Actions.executed_actions)
54
57
 
55
- thread.join(5) # https://github.com/KrauseFx/fastlane/issues/240
56
-
57
58
  unless error
58
-
59
59
  if duration > 5
60
60
  Helper.log.info "fastlane.tools just saved you #{duration} minutes! 🎉".green
61
61
  else
@@ -4,7 +4,8 @@ module Fastlane
4
4
  # This will take care of executing **one** lane.
5
5
  # @param lane_name The name of the lane to execute
6
6
  # @param platform The name of the platform to execute
7
- def execute(lane, platform = nil)
7
+ # @param parameters [Hash] The parameters passed from the command line to the lane
8
+ def execute(lane, platform = nil, parameters = nil)
8
9
  raise "No lane given" unless lane
9
10
 
10
11
  ENV["FASTLANE_LANE_NAME"] = lane.to_s
@@ -20,7 +21,7 @@ module Fastlane
20
21
  Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] = platform # set this in any case: important
21
22
 
22
23
  full_lane_name = [platform, lane].reject(&:nil?).join(' ')
23
- Helper.log.info "Driving the lane '#{full_lane_name}'".green
24
+ Helper.log.info "Driving the lane '#{full_lane_name}' 🚀".green
24
25
  Actions.lane_context[Actions::SharedValues::LANE_NAME] = full_lane_name
25
26
 
26
27
  return_val = nil
@@ -36,8 +37,7 @@ module Fastlane
36
37
  before_all_blocks[platform].call(lane) if (before_all_blocks[platform] and platform != nil)
37
38
  before_all_blocks[nil].call(lane) if before_all_blocks[nil]
38
39
 
39
- return_val = blocks[platform][lane].call
40
-
40
+ return_val = blocks[platform][lane].call(parameters || {}) # by default no parameters
41
41
 
42
42
  # `after_all` is only called if no exception was raised before
43
43
  # Call the platform specific before_all block and then the general one
@@ -1,3 +1,3 @@
1
1
  module Fastlane
2
- VERSION = '1.7.3'
2
+ VERSION = '1.8.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.7.3
4
+ version: 1.8.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-07-13 00:00:00.000000000 Z
11
+ date: 2015-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -474,6 +474,7 @@ files:
474
474
  - lib/fastlane/actions/xcodebuild.rb
475
475
  - lib/fastlane/actions/xctool.rb
476
476
  - lib/fastlane/actions_list.rb
477
+ - lib/fastlane/command_line_handler.rb
477
478
  - lib/fastlane/configuration_helper.rb
478
479
  - lib/fastlane/core_ext/string.rb
479
480
  - lib/fastlane/dependency_checker.rb