fastlane_core 0.10.1 → 0.11.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: 36c410576fea3a0fd2d9c81f5f310944ce594cfc
4
- data.tar.gz: d5fd0b3f2d9c694a28a886570993056a1c867e0a
3
+ metadata.gz: 846d4304cc09efca10ff15c3df3da67cd768f9a4
4
+ data.tar.gz: 6631f360eae684b31bd71577cc9bdbf32ed7736d
5
5
  SHA512:
6
- metadata.gz: 71b506675cd3dee7c198d4d8bf7474c1f6f69c414d69c01ccee44f767e3986a2ce37e9b36f514087057d4064bceb9350b5bcda4718c1748cec1e6c2814adede5
7
- data.tar.gz: 2b9b7dcf00f6310ba554e4e5f26f74344a15e09d0b35cb40b17f6326e2ce1d95356a6397d52e47fdff5d2fe034ac8fbcbcaf0ad769fef2561dae8899ffa0204e
6
+ metadata.gz: fa20228043bbbdf42d0865b11c9d8fa1fd3550ab9d49c1c3a7f5316a9d7c6e9334be5aedd0085f15c1326f6e02631cf14c67136b6791ff3e1c960af86cb31967
7
+ data.tar.gz: 10cff7760c63f6277458709114e5ec56e9d4a995aa0ddb78c78f340807a26fdd472e9306178a3ec275ce00ffdbaac8edb0e8c4451544d704621ec4e0ba336c12
data/README.md CHANGED
@@ -13,11 +13,14 @@
13
13
  <a href="https://github.com/KrauseFx/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/KrauseFx/produce">produce</a> &bull;
15
15
  <a href="https://github.com/KrauseFx/cert">cert</a> &bull;
16
- <a href="https://github.com/KrauseFx/codes">codes</a>
16
+ <a href="https://github.com/KrauseFx/codes">codes</a> &bull;
17
+ <a href="https://github.com/fastlane/spaceship">spaceship</a> &bull;
18
+ <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
19
+ <a href="https://github.com/fastlane/boarding">boarding</a>
17
20
  </p>
18
21
  -------
19
22
 
20
- Fastlane Core
23
+ FastlaneCore
21
24
  ============
22
25
 
23
26
  [![Twitter: @KauseFx](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
@@ -45,6 +48,8 @@ This gem contains all shared classes and code:
45
48
  # License
46
49
  This project is licensed under the terms of the MIT license. See the LICENSE file.
47
50
 
51
+ > This project and all fastlane tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All fastlane tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use fastlane tools.
52
+
48
53
  # Contributing
49
54
 
50
55
  1. Create an issue to start a discussion about your idea
data/lib/fastlane_core.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'json'
2
2
  require 'fastlane_core/version'
3
3
  require 'fastlane_core/helper'
4
- require 'fastlane_core/configuration'
4
+ require 'fastlane_core/configuration/configuration'
5
5
  require 'fastlane_core/update_checker'
6
6
  require 'fastlane_core/languages'
7
7
  require 'fastlane_core/itunes_search_api'
@@ -5,10 +5,16 @@ module FastlaneCore
5
5
  include Commander::Methods
6
6
 
7
7
  def generate(options)
8
+ short_codes = []
8
9
  options.each do |option|
9
10
  appendix = (option.is_string ? "STRING" : "")
10
11
  type = (option.is_string ? String : nil)
11
12
  short_option = option.short_option || "-#{option.key.to_s[0]}"
13
+
14
+ raise "Short option #{short_option} already taken for key #{option.key}".red if short_codes.include?short_option
15
+ raise "-v is already used for the version (key #{option.key})".red if short_option == "-v"
16
+
17
+ short_codes << short_option
12
18
  global_option short_option, "--#{option.key} #{appendix}", type, (option.description + " (#{option.env_name})")
13
19
  end
14
20
  end
@@ -1,30 +1,43 @@
1
1
  require 'fastlane_core/configuration/config_item'
2
2
  require 'fastlane_core/configuration/commander_generator'
3
+ require 'fastlane_core/configuration/configuration_file'
3
4
 
4
5
  module FastlaneCore
5
6
  class Configuration
6
- def self.create(available_options, values)
7
- Configuration.new(available_options, values)
8
- end
9
7
 
10
- # Setting up
8
+ attr_accessor :available_options
11
9
 
12
- def values
13
- # As the user accesses all values, we need to iterate through them to receive all the values
14
- @available_options.each do |option|
15
- @values[option.key] = fetch(option.key) unless @values[option.key]
16
- end
17
- @values
10
+ attr_accessor :values
11
+
12
+ # @return [Array] An array of symbols which are all available keys
13
+ attr_reader :all_keys
14
+
15
+ # @return [String] The name of the configuration file (not the path). Optional!
16
+ attr_accessor :config_file_name
17
+
18
+ # @param config_file_name [String] The name of the configuration file to use (optional)
19
+ # @param block_for_missing [Block] A ruby block that is called when there is an unkonwn method
20
+ # in the configuration file
21
+ def self.create(available_options, values, config_file_name = nil, block_for_missing = nil)
22
+ Configuration.new(available_options, values, config_file_name, block_for_missing)
18
23
  end
19
24
 
20
- def initialize(available_options, values)
21
- @available_options = available_options || []
22
- @values = values || {}
25
+ #####################################################
26
+ # @!group Setting up the configuration
27
+ #####################################################
28
+
29
+ def initialize(available_options, values, config_file_name = nil, block_for_missing = nil)
30
+ self.available_options = available_options || []
31
+ self.values = values || {}
32
+ self.config_file_name = config_file_name
33
+ @block_for_missing = block_for_missing
23
34
 
24
35
  verify_input_types
25
36
  verify_value_exists
26
37
  verify_no_duplicates
27
38
  verify_default_value_matches_verify_block
39
+
40
+ load_configuration_file
28
41
  end
29
42
 
30
43
  def verify_input_types
@@ -42,7 +55,7 @@ module FastlaneCore
42
55
  if option
43
56
  option.verify!(value) # Call the verify block for it too
44
57
  else
45
- raise "Could not find available option '#{key}' in the list of available options: #{@available_options.collect { |a| a.key }.join(', ')}".red
58
+ raise "Could not find option '#{key}' in the list of available options: #{@available_options.collect { |a| a.key }.join(', ')}".red
46
59
  end
47
60
  end
48
61
  end
@@ -74,7 +87,19 @@ module FastlaneCore
74
87
  end
75
88
  end
76
89
 
77
- # Using the class
90
+ def load_configuration_file
91
+ return unless self.config_file_name
92
+ paths = Dir["./fastlane/#{self.config_file_name}"] + Dir["./#{self.config_file_name}"]
93
+ paths = paths + Dir["./spec/fixtures/#{self.config_file_name}"] if Helper.is_test?
94
+ return if paths.count == 0
95
+
96
+ path = paths.first
97
+ ConfigurationFile.new(self, path, @block_for_missing)
98
+ end
99
+
100
+ #####################################################
101
+ # @!group Actually using the class
102
+ #####################################################
78
103
 
79
104
  # Returns the value for a certain key. fastlane_core tries to fetch the value from different sources
80
105
  def fetch(key)
@@ -122,12 +147,13 @@ module FastlaneCore
122
147
  end
123
148
 
124
149
  # Overwrites or sets a new value for a given key
150
+ # @param key [Symbol] Must be a symbol
125
151
  def set(key, value)
126
152
  raise "Key '#{key}' must be a symbol. Example :#{key}.".red unless key.kind_of?Symbol
127
153
  option = option_for_key(key)
128
154
 
129
155
  unless option
130
- raise "Could not find available option '#{key}' in the list of available options #{@available_options.collect { |a| a.key }.join(', ')}".red
156
+ raise "Could not find option '#{key}' in the list of available options: #{@available_options.collect { |a| a.key }.join(', ')}".red
131
157
  end
132
158
 
133
159
  option.verify!(value)
@@ -136,6 +162,18 @@ module FastlaneCore
136
162
  true
137
163
  end
138
164
 
165
+ def values
166
+ # As the user accesses all values, we need to iterate through them to receive all the values
167
+ @available_options.each do |option|
168
+ @values[option.key] = fetch(option.key) unless @values[option.key]
169
+ end
170
+ @values
171
+ end
172
+
173
+ def all_keys
174
+ @available_options.collect { |o| o.key }
175
+ end
176
+
139
177
  # Returns the config_item object for a given key
140
178
  def option_for_key(key)
141
179
  @available_options.find { |o| o.key == key }
@@ -0,0 +1,35 @@
1
+ module FastlaneCore
2
+ # Responsible for loading configuration files
3
+ class ConfigurationFile
4
+ # A reference to the actual configuration
5
+ attr_accessor :config
6
+
7
+ # @param config [FastlaneCore::Configuration] is stored to save the resulting values
8
+ # @param path [String] The path to the configuration file to use
9
+ def initialize(config, path, block_for_missing)
10
+ self.config = config
11
+ @block_for_missing = block_for_missing
12
+
13
+ eval(File.read(path))
14
+ end
15
+
16
+ def method_missing(method_sym, *arguments, &block)
17
+ # First, check if the key is actually available
18
+ if self.config.all_keys.include?method_sym
19
+ value = arguments.first || (block.call if block_given?) # this is either a block or a value
20
+ if value
21
+ self.config[method_sym] = value
22
+ end
23
+ else
24
+ # We can't set this value, maybe the tool using this configuration system has its own
25
+ # way of handling this block, as this might be a special block (e.g. ipa block) that's only
26
+ # executed on demand
27
+ if @block_for_missing
28
+ @block_for_missing.call(method_sym, arguments, block)
29
+ else
30
+ self.config[method_sym] = '' # important, since this will raise a good exception for free
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -54,10 +54,13 @@ module FastlaneCore
54
54
  self.test?
55
55
  end
56
56
 
57
- # @return true if building in a known CI environment
57
+ # @return [boolean] true if building in a known CI environment
58
58
  def self.is_ci?
59
59
  # Check for Jenkins, Travis CI, ... environment variables
60
- ENV.has_key?("JENKINS_URL") || ENV.has_key?("TRAVIS") || ENV.has_key?("CIRCLECI") || ENV.has_key?("CI")
60
+ ['JENKINS_URL', 'TRAVIS', 'CIRCLECI', 'CI'].each do |current|
61
+ return true if ENV.has_key?(current)
62
+ end
63
+ return false
61
64
  end
62
65
 
63
66
  # @return the full path to the Xcode developer tools of the currently
@@ -34,6 +34,7 @@ module FastlaneCore
34
34
  begin
35
35
  finished_running(gem_name)
36
36
  rescue
37
+ # we don't want to show a stack trace if something goes wrong
37
38
  end
38
39
  end
39
40
 
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.10.1"
2
+ VERSION = "0.11.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.10.1
4
+ version: 0.11.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-13 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -287,9 +287,10 @@ files:
287
287
  - README.md
288
288
  - lib/fastlane_core.rb
289
289
  - lib/fastlane_core/cert_checker.rb
290
- - lib/fastlane_core/configuration.rb
291
290
  - lib/fastlane_core/configuration/commander_generator.rb
292
291
  - lib/fastlane_core/configuration/config_item.rb
292
+ - lib/fastlane_core/configuration/configuration.rb
293
+ - lib/fastlane_core/configuration/configuration_file.rb
293
294
  - lib/fastlane_core/developer_center/developer_center.rb
294
295
  - lib/fastlane_core/developer_center/developer_center_helper.rb
295
296
  - lib/fastlane_core/developer_center/developer_center_login.rb