fastlane_core 0.36.9 → 0.37.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: eb03c52b6d68f1d13b5470c5921b9dbe50b88053
4
- data.tar.gz: 85e09706d35029e07617b279fb6bc8b724fd98c9
3
+ metadata.gz: 69d9a797fc7e20a98839ae7e0296d7215f95e08c
4
+ data.tar.gz: de39a88d7fd8c42a6d1988c291376d5eba49603f
5
5
  SHA512:
6
- metadata.gz: 93150dbe3b09b674fc298418aed928a461e1ed5b3328d3e1c5a1d9b41396970399419961c4adebfebc13ff579c813f651a3de616e43d0fb8140ce2daea096bb7
7
- data.tar.gz: 78dfc200e172ba6ade3ce3eed598e503aac40ec6eaeafebbb23b158224e1bf30fa3f10595e00e8b6147a1d77782b0fd1185dd8fcf997d551d8140a873a45dea4
6
+ metadata.gz: 44ece7894fb065c92ab2909d63d53760bb00386da1e836eeaa2ca74200363aa57170f5ba6790dbbe9d0cad4e7721426706e0a06728937e5c706daf6eba402ed9
7
+ data.tar.gz: 73a778016cf3e8dcb98a9bd4360c7b1a2b7891f1824718fca1c79d8fd08fdf92d269333b1c80791c2cc3db4c03ef2a7e1994487d47e1bd9df4f3ddff0b409ca1
@@ -9,30 +9,66 @@ module FastlaneCore
9
9
  # First, enable `always_trace`, to show the stack trace
10
10
  always_trace!
11
11
 
12
- short_codes = []
12
+ used_switches = []
13
13
  options.each do |option|
14
- next if option.description.to_s.length == 0 # "private" options
14
+ next if option.description.to_s.empty? # "private" options
15
15
 
16
- appendix = (option.string? ? "STRING" : "")
17
- type = option.data_type
18
- short_option = option.short_option
19
-
20
- raise "Short option #{short_option} already taken for key #{option.key}".red if short_codes.include? short_option
21
- raise "-v is already used for the version (key #{option.key})".red if short_option == "-v"
22
- raise "-h is already used for the help screen (key #{option.key})".red if short_option == "-h"
23
- raise "-t is already used for the trace screen (key #{option.key})".red if short_option == "-t"
16
+ short_switch = option.short_option
17
+ validate_short_switch(used_switches, short_switch)
24
18
 
25
- short_codes << short_option if short_option
19
+ type = option.data_type
26
20
 
27
- # Example Call
28
- # c.option '-p', '--pattern STRING', String, 'Description'
21
+ # This is an important bit of trickery to solve the boolean option situation.
22
+ #
23
+ # Typically, boolean command line flags do not accept trailing values. If the flag
24
+ # is present, the value is true, if it is missing, the value is false. fastlane
25
+ # supports this style of flag. For example, you can specify a flag like `--clean`,
26
+ # and the :clean option will be true.
27
+ #
28
+ # However, fastlane also supports another boolean flag style that accepts trailing
29
+ # values much like options for Strings and other value types. That looks like
30
+ # `--include_bitcode false` The problem is that this does not work out of the box
31
+ # for Commander and OptionsParser. So, we need to get tricky.
32
+ #
33
+ # The value_appendix below acts as a placeholder in the switch definition that
34
+ # states that we expect to have a trailing value for our options. When an option
35
+ # declares a data type, we use the name of that data type in all caps like:
36
+ # "--devices ARRAY". When the data type is nil, this implies that we're going
37
+ # to be doing some special handling on that value. One special thing we do
38
+ # automatically in Configuration is to coerce special Strings into boolean values.
39
+ #
40
+ # If the data type is nil, the trick we do is to specify a value placeholder, but
41
+ # we wrap it in [] brackets to mark it as optional. That means that the trailing
42
+ # value may or may not be present for this flag. If the flag is present, but the
43
+ # value is not, we get a value of `true`. Perfect for the boolean flag base-case!
44
+ # If the value is there, we'll actually get it back as a String, which we can
45
+ # later coerce into a boolean.
46
+ #
47
+ # In this way we support handling boolean flags with or without trailing values.
48
+ value_appendix = (type || '[VALUE]').to_s.upcase
49
+ long_switch = "--#{option.key} #{value_appendix}"
29
50
 
30
- flag = "--#{option.key} #{appendix}"
31
51
  description = option.description
32
- description += " (#{option.env_name})" if option.env_name.to_s.length > 0
52
+ description += " (#{option.env_name})" unless option.env_name.to_s.empty?
33
53
 
34
- global_option short_option, flag, type, description
54
+ # This is the sole call to Commander to set up the option we've been building.
55
+ #
56
+ # If we don't have a data type for this option, we tell it to act like a String.
57
+ # This allows us to get a reasonable value for boolean options that can be
58
+ # automatically coerced or otherwise handled by the ConfigItem for others.
59
+ global_option(short_switch, long_switch, (type || String), description)
35
60
  end
36
61
  end
62
+
63
+ def validate_short_switch(used_switches, short_switch)
64
+ return if short_switch.nil?
65
+
66
+ raise "Short option #{short_switch} already taken for key #{option.key}".red if used_switches.include?(short_switch)
67
+ raise "-v is already used for the version (key #{option.key})".red if short_switch == "-v"
68
+ raise "-h is already used for the help screen (key #{option.key})".red if short_switch == "-h"
69
+ raise "-t is already used for the trace screen (key #{option.key})".red if short_switch == "-t"
70
+
71
+ used_switches << short_switch
72
+ end
37
73
  end
38
74
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.36.9".freeze
2
+ VERSION = "0.37.0".freeze
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.36.9
4
+ version: 0.37.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-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -385,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
385
385
  version: '0'
386
386
  requirements: []
387
387
  rubyforge_project:
388
- rubygems_version: 2.4.5.1
388
+ rubygems_version: 2.2.2
389
389
  signing_key:
390
390
  specification_version: 4
391
391
  summary: Contains all shared code/dependencies of the fastlane.tools