fastlane_core 0.5.2 → 0.6.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: 5c7558dcc162c851329311ec25d8157718a58487
4
- data.tar.gz: 4bb9549d6060d3518f835955b0f725b6bdc581be
3
+ metadata.gz: 06327f198e2394586d0a6dd85ea74c828e9a75e0
4
+ data.tar.gz: a6d15a06e21bd123ce34a704f294fa8b1bbb28e7
5
5
  SHA512:
6
- metadata.gz: ee70b2aac81876ea582d9ede3ac183267c077d46c20dc4710b0e6b66e3631d28501377ae1a3072f58f193dcc20a8b3a13e96d77c48471aa2216da18733d6e1fe
7
- data.tar.gz: c9f8d64c2c2bd22a687611a5113d0ff389523cdd11b8e863b6834200c1caac6ef8d16ee52c2835ba077c50b6df252939ff3edcefe859c2eb43285de91c032780
6
+ metadata.gz: 233efb9872b290d7e26d954aa8ba617693c30e3a082842fdcc3aaf4071191feb151780c475ac81fdd313e120faad316538f98ba58a01c1d1967da74688b59051
7
+ data.tar.gz: 59b492002c6ad95ba8619bd13bb6d80f221e1d38fe7ecb03dca6993299c73fc4638c2b89f59efd661c1f4968bc0d4654829ce445da0b3897e3e02881612c0322
@@ -9,8 +9,12 @@ module FastlaneCore
9
9
 
10
10
  # Setting up
11
11
 
12
+ def values
13
+ @values
14
+ end
15
+
12
16
  def initialize(available_options, values)
13
- @available_options = available_options
17
+ @available_options = available_options || []
14
18
  @values = values || {}
15
19
 
16
20
  verify_input_types
@@ -19,9 +23,9 @@ module FastlaneCore
19
23
  end
20
24
 
21
25
  def verify_input_types
22
- raise "available_options parameter must be an array of ConfigItems".red unless @available_options.kind_of?Array
26
+ raise "available_options parameter must be an array of ConfigItems but is #{@available_options.class}".red unless @available_options.kind_of?Array
23
27
  @available_options.each do |item|
24
- raise "available_options parameter must be an array of ConfigItems".red unless item.kind_of?ConfigItem
28
+ raise "available_options parameter must be an array of ConfigItems. Found #{item.class}.".red unless item.kind_of?ConfigItem
25
29
  end
26
30
  raise "values parameter must be a hash".red unless @values.kind_of?Hash
27
31
  end
@@ -33,7 +37,7 @@ module FastlaneCore
33
37
  if option
34
38
  option.verify!(value) # Call the verify block for it too
35
39
  else
36
- raise "Could not find available option '#{key}' in the list of available options #{@available_options.collect { |a| a.key }}".red
40
+ raise "Could not find available option '#{key}' in the list of available options: #{@available_options.collect { |a| a.key }.join(', ')}".red
37
41
  end
38
42
  end
39
43
  end
@@ -58,11 +62,11 @@ module FastlaneCore
58
62
  raise "Key '#{key}' must be a symbol. Example :app_id.".red unless key.kind_of?Symbol
59
63
 
60
64
  option = option_for_key(key)
61
- raise "Could not find option for key :#{key}. Available keys: #{@available_options.collect { |a| a.key }}".red unless option
65
+ raise "Could not find option for key :#{key}. Available keys: #{@available_options.collect { |a| a.key }.join(', ')}".red unless option
62
66
 
63
67
  # `if value == nil` instead of ||= because false is also a valid value
64
68
 
65
- value ||= @values[key]
69
+ value = @values[key]
66
70
  # TODO: configuration files
67
71
 
68
72
  if value == nil
@@ -71,9 +75,22 @@ module FastlaneCore
71
75
  end
72
76
 
73
77
  value = option.default_value if value == nil
74
- value = false if (value == nil and not option.is_string) # by default boolean flags are false
78
+ value = nil if (value == nil and not option.is_string) # by default boolean flags are false
79
+
80
+ return value unless value.nil? # we already have a value
81
+ return value if option.optional # as this value is not required, just return what we have
82
+
75
83
 
76
- while value == nil and !option.optional
84
+ if Helper.is_test?
85
+ # Since we don't want to be asked on tests, we'll just call the verify block with no value
86
+ # to raise the exception that is shown when the user passes an invalid value
87
+ set(key, '')
88
+ # If this didn't raise an exception, just raise a default one
89
+ raise "No value found for '#{key}'"
90
+ end
91
+
92
+ while value == nil
93
+ Helper.log.info "To not be asked about this value, you can specify it using '#{option.key}'".yellow
77
94
  value = ask("#{option.description}: ")
78
95
  # Also store this value to use it from now on
79
96
  begin
@@ -89,11 +106,11 @@ module FastlaneCore
89
106
 
90
107
  # Overwrites or sets a new value for a given key
91
108
  def set(key, value)
92
- raise "Key '#{key}' must be a symbol. Example :app_id.".red unless key.kind_of?Symbol
109
+ raise "Key '#{key}' must be a symbol. Example :#{key}.".red unless key.kind_of?Symbol
93
110
  option = option_for_key(key)
94
111
 
95
112
  unless option
96
- raise "Could not find available option '#{key}' in the list of !available options #{@available_options.collect { |a| a.key }}".red
113
+ raise "Could not find available option '#{key}' in the list of available options #{@available_options.collect { |a| a.key }.join(', ')}".red
97
114
  end
98
115
 
99
116
  option.verify!(value)
@@ -109,5 +126,6 @@ module FastlaneCore
109
126
 
110
127
  # Aliases `[key]` to `fetch(key)` because Ruby can do it.
111
128
  alias_method :[], :fetch
129
+ alias_method :[]=, :set
112
130
  end
113
131
  end
@@ -11,7 +11,7 @@ module FastlaneCore
11
11
  # @param verify_block an optional block which is called when a new value is set.
12
12
  # Check value is valid. This could be type checks or if a folder/file exists
13
13
  # You have to raise a specific exception if something goes wrong. Append .red after the string
14
- # @param is_string (String) is that parameter a string?
14
+ # @param is_string (String) is that parameter a string? Defaults to true. If it's true, the type string will be verified.
15
15
  # @param optional (Boolean) is false by default. If set to true, also string values will not be asked to the user
16
16
  def initialize(key: nil, env_name: nil, description: nil, short_option: nil, default_value: nil, verify_block: nil, is_string: true, optional: false)
17
17
  raise "key must be a symbol" unless key.kind_of?Symbol
@@ -46,7 +46,7 @@ module FastlaneCore
46
46
  # we also allow nil values, which do not have to be verified.
47
47
  if value
48
48
  if @is_string
49
- raise "Please pass a path as String".red unless value.kind_of?String
49
+ raise "'#{self.key}' value must be a String!".red unless value.kind_of?String
50
50
  end
51
51
 
52
52
  if @verify_block
@@ -54,7 +54,7 @@ module FastlaneCore
54
54
  if page.has_content?"Getting Started"
55
55
  raise "There was no valid signing certificate found. Please log in and follow the 'Getting Started guide' on '#{current_url}'".red
56
56
  else
57
- raise DeveloperCenterLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.")
57
+ raise DeveloperCenterLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.".red)
58
58
  end
59
59
  end
60
60
 
@@ -44,11 +44,11 @@ module FastlaneCore
44
44
  if page.has_content?"My Apps"
45
45
  # Everything looks good
46
46
  else
47
- raise ItunesConnectLoginError.new("Looks like your login data was correct, but you do not have access to the apps.")
47
+ raise ItunesConnectLoginError.new("Looks like your login data was correct, but you do not have access to the apps.".red)
48
48
  end
49
49
  rescue => ex
50
50
  Helper.log.debug(ex)
51
- raise ItunesConnectLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.")
51
+ raise ItunesConnectLoginError.new("Error logging in user #{user} with the given password. Make sure you entered them correctly.".red)
52
52
  end
53
53
 
54
54
  Helper.log.info "Successfully logged into iTunesConnect"
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.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.5.2
4
+ version: 0.6.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-04-12 00:00:00.000000000 Z
11
+ date: 2015-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -249,7 +249,7 @@ dependencies:
249
249
  - !ruby/object:Gem::Version
250
250
  version: 1.19.0
251
251
  - !ruby/object:Gem::Dependency
252
- name: codeclimate-test-reporter
252
+ name: coveralls
253
253
  requirement: !ruby/object:Gem::Requirement
254
254
  requirements:
255
255
  - - '>='