fastlane_core 0.34.0 → 0.35.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: 6c4e0e0dfd2c77a1169ff2dcb62cf7f353f71938
4
- data.tar.gz: 5c439e39a2d28893b40eee0fde61967d11688783
3
+ metadata.gz: 1b43d0fb739ccee6fcedec6856d38d00f10bcbfe
4
+ data.tar.gz: 664c10324aeb625a85039f1d11c9b8db4c66fdfc
5
5
  SHA512:
6
- metadata.gz: f3a670a6ab99b201705a0344cdcc589639050213b301acd6611f674960fe0d8d7b148f0777e31337a6d072c8fe60c61e3ad1ce2c2ecd1ca0131ce018e2451c73
7
- data.tar.gz: 56c7324933a6ef4f17312a785f353b33d5388ef0bd58a27bfbc54cfea462c7280d1f6a510942cffd1552e2a97c8c0e543d791d3a023edba4a1f8373bdfdf7a51
6
+ metadata.gz: e8268978937c954fede5259007736560abbba4d52e05ae04947acf8c4eb9d7eedbb803933b0b2d2b330406509293158811433ff130c48eeadd7f6c672145ba37
7
+ data.tar.gz: 7b19622020da636ff3940da9ffc37ec0cf2393596addf246f62f94ff721e6f645e056e04b438f60322e1a1d316c3771268a825eddb486d9f1a3013950af1866e
@@ -1,6 +1,6 @@
1
1
  module FastlaneCore
2
2
  class ConfigItem
3
- attr_accessor :key, :env_name, :description, :short_option, :default_value, :verify_block, :optional
3
+ attr_accessor :key, :env_name, :description, :short_option, :default_value, :verify_block, :optional, :conflicting_options, :conflict_block
4
4
 
5
5
  # Creates a new option
6
6
  # @param key (Symbol) the key which is used as command paramters or key in the fastlane tools
@@ -14,7 +14,9 @@ module FastlaneCore
14
14
  # @param is_string *DEPRECATED: Use `type` instead* (Boolean) is that parameter a string? Defaults to true. If it's true, the type string will be verified.
15
15
  # @param type (Class) the data type of this config item. Takes precedence over `is_string`
16
16
  # @param optional (Boolean) is false by default. If set to true, also string values will not be asked to the user
17
- def initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, type: nil, optional: false)
17
+ # @param conflicting_options ([]) array of conflicting option keys(@param key). This allows to resolve conflicts intelligently
18
+ # @param conflict_block an optional block which is called when options conflict happens
19
+ def initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, type: nil, optional: false, conflicting_options: nil, conflict_block: nil)
18
20
  raise "key must be a symbol" unless key.kind_of? Symbol
19
21
  raise "env_name must be a String" unless (env_name || '').kind_of? String
20
22
 
@@ -29,6 +31,12 @@ module FastlaneCore
29
31
  raise "Type '#{type}' for key '#{key}' requires a short option"
30
32
  end
31
33
 
34
+ if conflicting_options
35
+ conflicting_options.each do |conflicting_option_key|
36
+ raise "Conflicting option key must be a symbol" unless conflicting_option_key.kind_of? Symbol
37
+ end
38
+ end
39
+
32
40
  @key = key
33
41
  @env_name = env_name
34
42
  @description = description
@@ -38,6 +46,8 @@ module FastlaneCore
38
46
  @is_string = is_string
39
47
  @data_type = type
40
48
  @optional = optional
49
+ @conflicting_options = conflicting_options
50
+ @conflict_block = conflict_block
41
51
  end
42
52
 
43
53
  # This will raise an exception if the value is not valid
@@ -38,6 +38,7 @@ module FastlaneCore
38
38
  verify_input_types
39
39
  verify_value_exists
40
40
  verify_no_duplicates
41
+ verify_conflicts
41
42
  verify_default_value_matches_verify_block
42
43
  end
43
44
 
@@ -76,6 +77,36 @@ module FastlaneCore
76
77
  end
77
78
  end
78
79
 
80
+ def verify_conflicts
81
+ option_keys = @values.keys
82
+
83
+ option_keys.each do |current|
84
+ index = @available_options.find_index { |item| item.key == current }
85
+ current = @available_options[index]
86
+
87
+ next if current.conflicting_options.nil?
88
+
89
+ conflicts = current.conflicting_options & option_keys
90
+ next if conflicts.nil?
91
+
92
+ conflicts.each do |conflicting_option_key|
93
+ index = @available_options.find_index { |item| item.key == conflicting_option_key }
94
+ conflicting_option = @available_options[index]
95
+
96
+ if current.conflict_block
97
+ begin
98
+ current.conflict_block.call(conflicting_option)
99
+ rescue => ex
100
+ Helper.log.fatal "Error resolving conflict between options: '#{current.key}' and '#{conflicting_option.key}'".red
101
+ raise ex
102
+ end
103
+ else
104
+ raise "Unresolved conflict between options: '#{current.key}' and '#{conflicting_option.key}'".red
105
+ end
106
+ end
107
+ end
108
+ end
109
+
79
110
  # Verifies the default value is also valid
80
111
  def verify_default_value_matches_verify_block
81
112
  @available_options.each do |item|
@@ -112,7 +143,9 @@ module FastlaneCore
112
143
  return if paths.count == 0
113
144
 
114
145
  path = paths.first
115
- ConfigurationFile.new(self, path, block_for_missing)
146
+ configuration_file = ConfigurationFile.new(self, path, block_for_missing)
147
+ verify_conflicts # important, since user can set conflicting options in configuration file
148
+ configuration_file
116
149
  end
117
150
 
118
151
  #####################################################
@@ -198,9 +198,9 @@ module FastlaneCore
198
198
  end
199
199
 
200
200
  # Returns the build settings and sets the default scheme to the options hash
201
- def default_build_settings(key: nil, optional: true, silent: false)
201
+ def default_build_settings(key: nil, optional: true)
202
202
  options[:scheme] = schemes.first if is_workspace
203
- build_settings(key: key, optional: optional, silent: silent)
203
+ build_settings(key: key, optional: optional)
204
204
  end
205
205
 
206
206
  def raw_info(silent: false)
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.34.0"
2
+ VERSION = "0.35.0"
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.34.0
4
+ version: 0.35.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-01-19 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -383,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
383
383
  version: '0'
384
384
  requirements: []
385
385
  rubyforge_project:
386
- rubygems_version: 2.4.5
386
+ rubygems_version: 2.4.0
387
387
  signing_key:
388
388
  specification_version: 4
389
389
  summary: Contains all shared code/dependencies of the fastlane.tools