fastlane 1.88.0 → 1.89.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: 9927ac2cd5350fa89c4e9c3b90d26fbff1fd14f3
4
- data.tar.gz: 2fbb1bb963af63e52d3c2231760b32d92cf42cb9
3
+ metadata.gz: 7ab10b5466a620abbe5ef7ec4f08f18612f49f77
4
+ data.tar.gz: 9a97c9b31a2aa353d5b006aec8c51f6a90f37227
5
5
  SHA512:
6
- metadata.gz: f2a17afe167377fe9094940660a184ee423752db2b7038bd61c3d8d37f515f9c93d833aa3325a61b8510f6064865d0984308d3ed5f4cf46f9aa2e9bebd57f966
7
- data.tar.gz: 02cdab05808de5fe681f86ed794b54e118789fdbb8c921bbd52ab51b3cf6a2691428e901b6fa2f304d34fc10f1a67bb696d726359c10dd5ced33e8cc28c0e5bc
6
+ metadata.gz: 5eec8e96803f2af205fd37ac2e6d32fe66a48a5aeab221497878e7228899283fdcde65d0a9172ea4410e42c2b4e6b3e87cdf3d41166b24d45e00d98dd60c53c4
7
+ data.tar.gz: 439f42b67b05dceac8dd534cfc7eeccb38431b58c655ee7c5581bb7306edd6fc76e70b66dd6cc1abacbd7e19f637b3f90ac149750b8514c1292a1a6be62be662
@@ -6,16 +6,19 @@ module Fastlane
6
6
 
7
7
  class ChangelogFromGitCommitsAction < Action
8
8
  def self.run(params)
9
- if params[:between]
10
- from, to = params[:between]
9
+ if params[:commits_count]
10
+ UI.success("Collecting the last #{params[:commits_count]} Git commits")
11
11
  else
12
- from = Actions.last_git_tag_name(params[:match_lightweight_tag], params[:tag_match_pattern])
13
- UI.verbose("Found the last Git tag: #{from}")
14
- to = 'HEAD'
12
+ if params[:between]
13
+ from, to = params[:between]
14
+ else
15
+ from = Actions.last_git_tag_name(params[:match_lightweight_tag], params[:tag_match_pattern])
16
+ UI.verbose("Found the last Git tag: #{from}")
17
+ to = 'HEAD'
18
+ end
19
+ UI.success("Collecting Git commits between #{from} and #{to}")
15
20
  end
16
21
 
17
- UI.success("Collecting Git commits between #{from} and #{to}")
18
-
19
22
  # Normally it is not good practice to take arbitrary input and convert it to a symbol
20
23
  # because prior to Ruby 2.2, symbols are never garbage collected. However, we've
21
24
  # already validated that the input matches one of our allowed values, so this is OK
@@ -26,7 +29,11 @@ module Fastlane
26
29
  merge_commit_filtering = :exclude_merges
27
30
  end
28
31
 
29
- changelog = Actions.git_log_between(params[:pretty], from, to, merge_commit_filtering)
32
+ if params[:commits_count]
33
+ changelog = Actions.git_log_last_commits(params[:pretty], params[:commits_count], merge_commit_filtering)
34
+ else
35
+ changelog = Actions.git_log_between(params[:pretty], from, to, merge_commit_filtering)
36
+ end
30
37
  changelog = changelog.gsub("\n\n", "\n") if changelog # as there are duplicate newlines
31
38
  Actions.lane_context[SharedValues::FL_CHANGELOG] = changelog
32
39
 
@@ -53,14 +60,25 @@ module Fastlane
53
60
  [
54
61
  FastlaneCore::ConfigItem.new(key: :between,
55
62
  env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_BETWEEN',
56
- description: 'Array containing two Git revision values between which to collect messages',
63
+ description: 'Array containing two Git revision values between which to collect messages, you mustn\'t use it with :commits_count key at the same time',
57
64
  optional: true,
58
65
  is_string: false,
66
+ conflicting_options: [:commits_count],
59
67
  verify_block: proc do |value|
60
68
  UI.user_error!(":between must be of type array") unless value.kind_of?(Array)
61
69
  UI.user_error!(":between must not contain nil values") if value.any?(&:nil?)
62
70
  UI.user_error!(":between must be an array of size 2") unless (value || []).size == 2
63
71
  end),
72
+ FastlaneCore::ConfigItem.new(key: :commits_count,
73
+ env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_COUNT',
74
+ description: 'Number of commits to include in changelog, you mustn\'t use it with :between key at the same time',
75
+ optional: true,
76
+ is_string: false,
77
+ conflicting_options: [:between],
78
+ verify_block: proc do |value|
79
+ UI.user_error!(":commits_count must be an integer") unless value.kind_of? Integer
80
+ UI.user_error!(":commits_count must be >= 1") unless value >= 1
81
+ end),
64
82
  FastlaneCore::ConfigItem.new(key: :pretty,
65
83
  env_name: 'FL_CHANGELOG_FROM_GIT_COMMITS_PRETTY',
66
84
  description: 'The format applied to each commit while generating the collected value',
@@ -103,7 +121,7 @@ module Fastlane
103
121
  end
104
122
 
105
123
  def self.author
106
- ['mfurtak', 'asfalcone']
124
+ ['mfurtak', 'asfalcone', 'SiarheiFedartsou']
107
125
  end
108
126
 
109
127
  def self.is_supported?(platform)
@@ -14,7 +14,7 @@ module Fastlane
14
14
  # every time one of the tools is launched
15
15
  available_lanes = Fastlane::FastlaneFolder.available_lanes
16
16
 
17
- tool_name = ARGV.first.downcase
17
+ tool_name = ARGV.first ? ARGV.first.downcase : nil
18
18
  if tool_name && Fastlane::TOOLS.include?(tool_name.to_sym) && !available_lanes.include?(tool_name.to_sym)
19
19
  # Triggering a specific tool
20
20
  # This happens when the users uses things like
@@ -115,11 +115,21 @@ module Fastlane
115
115
  @runner.set_before_all(@current_platform, block)
116
116
  end
117
117
 
118
+ # Is executed before each lane
119
+ def before_each(&block)
120
+ @runner.set_before_each(@current_platform, block)
121
+ end
122
+
118
123
  # Is executed after each test run
119
124
  def after_all(&block)
120
125
  @runner.set_after_all(@current_platform, block)
121
126
  end
122
127
 
128
+ # Is executed before each lane
129
+ def after_each(&block)
130
+ @runner.set_after_each(@current_platform, block)
131
+ end
132
+
123
133
  # Is executed if an error occured during fastlane execution
124
134
  def error(&block)
125
135
  @runner.set_error(@current_platform, block)
@@ -5,8 +5,16 @@ module Fastlane
5
5
  def self.git_log_between(pretty_format, from, to, merge_commit_filtering)
6
6
  command = 'git log'
7
7
  command << " --pretty=\"#{pretty_format}\" #{from.shellescape}...#{to.shellescape}"
8
- command << " --no-merges" if merge_commit_filtering == :exclude_merges
9
- command << " --merges" if merge_commit_filtering == :only_include_merges
8
+ command << git_log_merge_commit_filtering_option(merge_commit_filtering)
9
+ Actions.sh(command, log: false).chomp
10
+ rescue
11
+ nil
12
+ end
13
+
14
+ def self.git_log_last_commits(pretty_format, commit_count, merge_commit_filtering)
15
+ command = 'git log'
16
+ command << " --pretty=\"#{pretty_format}\" -n #{commit_count}"
17
+ command << git_log_merge_commit_filtering_option(merge_commit_filtering)
10
18
  Actions.sh(command, log: false).chomp
11
19
  rescue
12
20
  nil
@@ -80,5 +88,17 @@ module Fastlane
80
88
  rescue
81
89
  nil
82
90
  end
91
+
92
+ private_class_method
93
+ def self.git_log_merge_commit_filtering_option(merge_commit_filtering)
94
+ case merge_commit_filtering
95
+ when :exclude_merges
96
+ " --no-merges"
97
+ when :only_include_merges
98
+ " --merges"
99
+ else
100
+ ""
101
+ end
102
+ end
83
103
  end
84
104
  end
@@ -44,17 +44,15 @@ module Fastlane
44
44
  parameters ||= {}
45
45
  begin
46
46
  Dir.chdir(path_to_use) do # the file is located in the fastlane folder
47
- # Call the platform specific before_all block and then the general one
48
-
49
- before_all_blocks[current_platform].call(current_lane, parameters) if before_all_blocks[current_platform] && current_platform
50
- before_all_blocks[nil].call(current_lane, parameters) if before_all_blocks[nil]
47
+ execute_flow_block(before_all_blocks, current_platform, current_lane, parameters)
48
+ execute_flow_block(before_each_blocks, current_platform, current_lane, parameters)
51
49
 
52
50
  return_val = lane_obj.call(parameters) # by default no parameters
53
51
 
54
- # `after_all` is only called if no exception was raised before
55
- # Call the platform specific before_all block and then the general one
56
- after_all_blocks[current_platform].call(current_lane, parameters) if after_all_blocks[current_platform] && current_platform
57
- after_all_blocks[nil].call(current_lane, parameters) if after_all_blocks[nil]
52
+ # after blocks are only called if no exception was raised before
53
+ # Call the platform specific after block and then the general one
54
+ execute_flow_block(after_each_blocks, current_platform, current_lane, parameters)
55
+ execute_flow_block(after_all_blocks, current_platform, current_lane, parameters)
58
56
  end
59
57
 
60
58
  return return_val
@@ -127,6 +125,8 @@ module Fastlane
127
125
 
128
126
  UI.user_error!("Parameters for a lane must always be a hash") unless (parameters.first || {}).kind_of? Hash
129
127
 
128
+ execute_flow_block(before_each_blocks, current_platform, new_lane, parameters)
129
+
130
130
  pretty = [new_lane]
131
131
  pretty = [current_platform, new_lane] if current_platform
132
132
  Actions.execute_action("Switch to #{pretty.join(' ')} lane") {} # log the action
@@ -138,6 +138,10 @@ module Fastlane
138
138
  result = block.call(parameters.first || {}) # to always pass a hash
139
139
  self.current_lane = original_lane
140
140
 
141
+ # after blocks are only called if no exception was raised before
142
+ # Call the platform specific after block and then the general one
143
+ execute_flow_block(after_each_blocks, current_platform, new_lane, parameters)
144
+
141
145
  UI.success "Cruising back to lane '#{original_full}' 🚘".green
142
146
  return result
143
147
  else
@@ -182,6 +186,12 @@ module Fastlane
182
186
  end
183
187
  end
184
188
 
189
+ def execute_flow_block(block, current_platform, lane, parameters)
190
+ # Call the platform specific block and default back to the general one
191
+ block[current_platform].call(lane, parameters) if block[current_platform] && current_platform
192
+ block[nil].call(lane, parameters) if block[nil]
193
+ end
194
+
185
195
  def verify_supported_os(name, class_ref)
186
196
  if class_ref.respond_to?(:is_supported?)
187
197
  if Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
@@ -218,6 +228,14 @@ module Fastlane
218
228
  lanes[lane.platform][lane.name] = lane
219
229
  end
220
230
 
231
+ def set_before_each(platform, block)
232
+ before_each_blocks[platform] = block
233
+ end
234
+
235
+ def set_after_each(platform, block)
236
+ after_each_blocks[platform] = block
237
+ end
238
+
221
239
  def set_before_all(platform, block)
222
240
  before_all_blocks[platform] = block
223
241
  end
@@ -234,6 +252,14 @@ module Fastlane
234
252
  @lanes ||= {}
235
253
  end
236
254
 
255
+ def before_each_blocks
256
+ @before_each ||= {}
257
+ end
258
+
259
+ def after_each_blocks
260
+ @after_each ||= {}
261
+ end
262
+
237
263
  def before_all_blocks
238
264
  @before_all ||= {}
239
265
  end
@@ -1,4 +1,4 @@
1
1
  module Fastlane
2
- VERSION = '1.88.0'.freeze
2
+ VERSION = '1.89.0'.freeze
3
3
  DESCRIPTION = "The easiest way to automate building and releasing your iOS and Android apps"
4
4
  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.88.0
4
+ version: 1.89.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-05-11 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: krausefx-shenzhen
@@ -908,7 +908,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
908
908
  version: '0'
909
909
  requirements: []
910
910
  rubyforge_project:
911
- rubygems_version: 2.4.5.1
911
+ rubygems_version: 2.2.2
912
912
  signing_key:
913
913
  specification_version: 4
914
914
  summary: The easiest way to automate building and releasing your iOS and Android apps