fastlane 1.9.0 → 1.10.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: beef52022ff1b725c056cb6d6b76940e08a80e47
4
- data.tar.gz: 7d3ae10b2bd5e238fb9476d14ea3133f53c3fb04
3
+ metadata.gz: 1b02853674db4c9391b0afc92187c12553bd5ca5
4
+ data.tar.gz: abdf86a0c1a16a537e0482b988ff466aa241b6a6
5
5
  SHA512:
6
- metadata.gz: 0cd216d8caabb4f7cbfe99e0d9adf6bba9269fd75f0561939c4f7e0675c9b6bc156f9ec54de1533f3f2d1ef2f17567721799654ffbe2af178dd4e4fb7f086b59
7
- data.tar.gz: f882d73eb82fc32a530ae6538060c3c9895fe5b222fcbab700253a8dd9e1f1145ade69dc74b0b11453dffc4942640669e520b9fefd4b2ab98d977b163e71dbd8
6
+ metadata.gz: f74b8a54acbd869d226682e105a03e9e6ace60f9d87f145436538d081396d5701b0a7cad95fd987775a04b37b16458becdd56ba8aea3b72f73efe435ea00a57b
7
+ data.tar.gz: a51ba8231bb61993678733fb47486a25e9e94759f80678dc4f570d45474857de291004d3d6e032afaf1c28471e779ebe325e9e1c0d03b3f4abe60fa6966aa4b9
@@ -76,7 +76,7 @@ class FastlaneApplication
76
76
  ff = Fastlane::FastFile.new(File.join(Fastlane::FastlaneFolder.path || '.', 'Fastfile'))
77
77
  puts "\nAvailable lanes:".green
78
78
  ff.runner.available_lanes.each do |lane|
79
- puts "- #{lane}"
79
+ puts "- #{lane}" unless lane.is_private
80
80
  end
81
81
  puts "\nExecute using `fastlane [lane_name]`".yellow
82
82
  end
@@ -52,7 +52,11 @@ module Fastlane
52
52
  raise "Implementing `is_supported?` for all actions is mandatory. Please update #{self}".red
53
53
  end
54
54
 
55
-
55
+ # Is printed out in the Steps: output in the terminal
56
+ # Return nil if you don't want any logging in the terminal/JUnit Report
57
+ def self.step_text
58
+ self.action_name
59
+ end
56
60
 
57
61
  # to allow a simple `sh` in the custom actions
58
62
  def self.sh(command)
@@ -20,7 +20,7 @@ module Fastlane
20
20
  def did_finish
21
21
  unless ENV["FASTLANE_OPT_OUT_USAGE"]
22
22
  begin
23
- unless did_show_message?
23
+ if !did_show_message? and !Helper.is_ci?
24
24
  Helper.log.debug("Sending Crash/Success information. More information on: https://github.com/fastlane/enhancer")
25
25
  Helper.log.debug("No personal/sensitive data is sent. Only sharing the following:")
26
26
  Helper.log.debug(launches)
@@ -49,14 +49,16 @@ module Fastlane
49
49
 
50
50
  # Pass a block which should be tracked. One block = one testcase
51
51
  # @param step_name (String) the name of the currently built code (e.g. snapshot, sigh, ...)
52
+ # This might be nil, in which case the step is not printed out to the terminal
52
53
  def self.execute_action(step_name)
54
+ start = Time.now # before the raise block, since `start` is required in the ensure block
53
55
  raise 'No block given'.red unless block_given?
54
56
 
55
- start = Time.now
56
57
  error = nil
57
58
  exc = nil
58
59
 
59
60
  begin
61
+ Helper.log_alert("Step: " + step_name) if step_name
60
62
  yield
61
63
  rescue => ex
62
64
  exc = ex
@@ -64,19 +66,23 @@ module Fastlane
64
66
  end
65
67
  ensure
66
68
  # This is also called, when the block has a return statement
67
- duration = Time.now - start
68
-
69
- executed_actions << {
70
- name: step_name,
71
- error: error,
72
- time: duration
73
- # output: captured_output
74
- }
69
+ if step_name
70
+ duration = Time.now - start
71
+
72
+ executed_actions << {
73
+ name: step_name,
74
+ error: error,
75
+ time: duration
76
+ }
77
+ end
78
+
75
79
  raise exc if exc
76
80
  end
77
81
 
78
82
  # Execute a shell command
79
83
  # This method will output the string and execute it
84
+ # Just an alias for sh_no_action
85
+ # @param log [boolean] should fastlane print out the executed command
80
86
  def self.sh(command, log: true)
81
87
  sh_no_action(command, log: log)
82
88
  end
@@ -28,6 +28,11 @@ module Fastlane
28
28
  def self.is_supported?(platform)
29
29
  true
30
30
  end
31
+
32
+ # We don't want to show this as step
33
+ def self.step_text
34
+ nil
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -20,6 +20,11 @@ module Fastlane
20
20
  def self.is_supported?(platform)
21
21
  true
22
22
  end
23
+
24
+ # We don't want to show this as step
25
+ def self.step_text
26
+ nil
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -21,6 +21,7 @@ module Fastlane
21
21
 
22
22
  if value
23
23
  value.each do |lane_name, lane|
24
+ next if lane.is_private
24
25
  output << render(platform, lane_name, lane.description.join("\n\n"))
25
26
  end
26
27
 
@@ -48,6 +49,9 @@ module Fastlane
48
49
  return pl
49
50
  end
50
51
 
52
+ # @param platform [String]
53
+ # @param lane [Fastlane::Lane]
54
+ # @param description [String]
51
55
  def self.render(platform, lane, description)
52
56
  full_name = [platform, lane].reject(&:nil?).join(' ')
53
57
 
@@ -42,7 +42,21 @@ module Fastlane
42
42
  self.runner.add_lane(Lane.new(platform: self.current_platform,
43
43
  block: block,
44
44
  description: desc_collection,
45
- name: lane_name))
45
+ name: lane_name,
46
+ is_private: false))
47
+
48
+ @desc_collection = nil # reset the collected description again for the next lane
49
+ end
50
+
51
+ # User defines a new private lane, which can't be called from the CLI
52
+ def private_lane(lane_name, &block)
53
+ raise "You have to pass a block using 'do' for lane '#{lane_name}'. Make sure you read the docs on GitHub.".red unless block
54
+
55
+ self.runner.add_lane(Lane.new(platform: self.current_platform,
56
+ block: block,
57
+ description: desc_collection,
58
+ name: lane_name,
59
+ is_private: true))
46
60
 
47
61
  @desc_collection = nil # reset the collected description again for the next lane
48
62
  end
@@ -80,17 +94,21 @@ module Fastlane
80
94
  class_ref = nil
81
95
  begin
82
96
  class_ref = Fastlane::Actions.const_get(class_name)
83
- if class_ref && class_ref.respond_to?(:run)
84
- # Action is available, now execute it
85
- return self.runner.execute_action(method_sym, class_ref, arguments)
86
- else
87
- raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red
88
- end
89
97
  rescue NameError => ex
90
98
  # Action not found
91
99
  # Is there a lane under this name?
92
100
  return self.runner.try_switch_to_lane(method_sym, arguments)
93
101
  end
102
+
103
+ # It's important to *not* have this code inside the rescue block
104
+ # otherwise all NameErrors will be catched and the error message is
105
+ # confusing
106
+ if class_ref && class_ref.respond_to?(:run)
107
+ # Action is available, now execute it
108
+ return self.runner.execute_action(method_sym, class_ref, arguments)
109
+ else
110
+ raise "Action '#{method_sym}' of class '#{class_name}' was found, but has no `run` method.".red
111
+ end
94
112
  end
95
113
 
96
114
  #####################################################
@@ -149,10 +167,8 @@ module Fastlane
149
167
  def puts(value)
150
168
  # Overwrite this, since there is already a 'puts' method defined in the Ruby standard library
151
169
  value ||= yield
152
- Actions.execute_action('puts') do
153
- collector.did_launch_action(:pus)
154
- Fastlane::Actions::PutsAction.run([value])
155
- end
170
+ collector.did_launch_action(:puts)
171
+ Fastlane::Actions::PutsAction.run([value])
156
172
  end
157
173
  end
158
174
  end
@@ -5,19 +5,23 @@ module Fastlane
5
5
 
6
6
  attr_accessor :name
7
7
 
8
- # @return (Array) An array containing the description of this lane
8
+ # @return [Array] An array containing the description of this lane
9
9
  # Each item of the array is one line
10
10
  attr_accessor :description
11
11
 
12
12
  attr_accessor :block
13
13
 
14
- def initialize(platform: nil, name: nil, description: nil, block: nil)
14
+ # @return [Boolean] Is that a private lane that can't be called from the CLI?
15
+ attr_accessor :is_private
16
+
17
+ def initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false)
15
18
  raise "description must be an array" unless description.kind_of?Array
16
19
 
17
20
  self.platform = platform
18
21
  self.name = name
19
22
  self.description = description
20
23
  self.block = block
24
+ self.is_private = is_private
21
25
  end
22
26
 
23
27
  # Execute this lane
@@ -25,6 +25,8 @@ module Fastlane
25
25
 
26
26
  if value
27
27
  value.each do |lane_name, lane|
28
+ next if lane.is_private
29
+
28
30
  output += "----- fastlane #{lane.pretty_name}".green
29
31
  output += "\n" + lane.description.join("\n") + "\n\n" if lane.description.count > 0
30
32
  end
@@ -24,6 +24,11 @@ module Fastlane
24
24
  self.current_lane = lane.to_sym
25
25
  self.current_platform = (platform ? platform.to_sym : nil)
26
26
 
27
+
28
+ lane_obj = (lanes[current_platform][current_lane] rescue nil)
29
+ raise "Could not find lane '#{full_lane_name}'. Available lanes: #{available_lanes.join(', ')}".red unless lane_obj
30
+ raise "You can't call the private lane '#{lane}' directly" if lane_obj.is_private
31
+
27
32
  ENV["FASTLANE_LANE_NAME"] = current_lane.to_s
28
33
  ENV["FASTLANE_PLATFORM_NAME"] = (current_platform ? current_platform.to_s : nil)
29
34
 
@@ -35,34 +40,32 @@ module Fastlane
35
40
  return_val = nil
36
41
 
37
42
  path_to_use = Fastlane::FastlaneFolder.path || Dir.pwd
38
- Dir.chdir(path_to_use) do # the file is located in the fastlane folder
39
-
40
- unless (lanes[current_platform][current_lane] rescue nil)
41
- raise "Could not find lane '#{full_lane_name}'. Available lanes: #{available_lanes.join(', ')}".red
43
+ begin
44
+ Dir.chdir(path_to_use) do # the file is located in the fastlane folder
45
+
46
+ # Call the platform specific before_all block and then the general one
47
+ before_all_blocks[current_platform].call(current_lane) if (before_all_blocks[current_platform] and current_platform)
48
+ before_all_blocks[nil].call(current_lane) if before_all_blocks[nil]
49
+
50
+ return_val = lane_obj.call(parameters || {}) # by default no parameters
51
+
52
+ # `after_all` is only called if no exception was raised before
53
+ # Call the platform specific before_all block and then the general one
54
+ after_all_blocks[current_platform].call(current_lane) if (after_all_blocks[current_platform] and current_platform)
55
+ after_all_blocks[nil].call(current_lane) if (after_all_blocks[nil])
42
56
  end
43
57
 
44
- # Call the platform specific before_all block and then the general one
45
- before_all_blocks[current_platform].call(current_lane) if (before_all_blocks[current_platform] and current_platform)
46
- before_all_blocks[nil].call(current_lane) if before_all_blocks[nil]
47
-
48
- return_val = lanes[current_platform][current_lane].call(parameters || {}) # by default no parameters
49
-
50
- # `after_all` is only called if no exception was raised before
51
- # Call the platform specific before_all block and then the general one
52
- after_all_blocks[current_platform].call(current_lane) if (after_all_blocks[current_platform] and current_platform)
53
- after_all_blocks[nil].call(current_lane) if (after_all_blocks[nil])
54
- end
55
-
56
- return return_val
57
- rescue => ex
58
- Dir.chdir(path_to_use) do
59
- # Provide error block exception without colour code
60
- error_ex = ex.exception(ex.message.gsub(/\033\[\d+m/, ''))
58
+ return return_val
59
+ rescue => ex
60
+ Dir.chdir(path_to_use) do
61
+ # Provide error block exception without colour code
62
+ error_ex = ex.exception(ex.message.gsub(/\033\[\d+m/, ''))
61
63
 
62
- error_blocks[current_platform].call(current_lane, error_ex) if (error_blocks[current_platform] and current_platform)
63
- error_blocks[nil].call(current_lane, error_ex) if error_blocks[nil]
64
+ error_blocks[current_platform].call(current_lane, error_ex) if (error_blocks[current_platform] and current_platform)
65
+ error_blocks[nil].call(current_lane, error_ex) if error_blocks[nil]
66
+ end
67
+ raise ex
64
68
  end
65
- raise ex
66
69
  end
67
70
 
68
71
  # @param filter_platform: Filter, to only show the lanes of a given platform
@@ -94,6 +97,7 @@ module Fastlane
94
97
 
95
98
  pretty = [new_lane]
96
99
  pretty = [current_platform, new_lane] if current_platform
100
+ Actions.execute_action("Switch to #{pretty.join(' ')} lane") {} # log the action
97
101
  Helper.log.info "Cruising over to lane '#{pretty.join(' ')}' 🚖".green
98
102
 
99
103
  # Actually switch lane now
@@ -106,6 +110,7 @@ module Fastlane
106
110
  return result
107
111
  else
108
112
  # No action and no lane, raising an exception now
113
+ Helper.log.error caller.join("\n")
109
114
  raise "Could not find action or lane '#{new_lane}'. Check out the README for more details: https://github.com/KrauseFx/fastlane".red
110
115
  end
111
116
  end
@@ -118,11 +123,9 @@ module Fastlane
118
123
 
119
124
  verify_supported_os(method_sym, class_ref)
120
125
 
121
- Helper.log_alert("Step: " + step_name)
122
-
123
126
  begin
124
127
  Dir.chdir('..') do # go up from the fastlane folder, to the project folder
125
- Actions.execute_action(method_sym) do
128
+ Actions.execute_action(class_ref.step_text) do
126
129
  # arguments is an array by default, containing an hash with the actual parameters
127
130
  # Since we usually just need the passed hash, we'll just use the first object if there is only one
128
131
  if arguments.count == 0
@@ -1,3 +1,3 @@
1
1
  module Fastlane
2
- VERSION = '1.9.0'
2
+ VERSION = '1.10.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.9.0
4
+ version: 1.10.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-16 00:00:00.000000000 Z
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri