fastlane_core 0.29.1 → 0.30.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: 4159006b340c635d1d3eee49239db32a6c4da1cd
4
- data.tar.gz: 4166e741e399b1fc503902f7f1145cd3462d142e
3
+ metadata.gz: f765af55f0a11a0983c37094f5d3ef3152fe1ae4
4
+ data.tar.gz: 185c80d69c241ad8ba747f783566da2030de6470
5
5
  SHA512:
6
- metadata.gz: e2aa321316da4eb336f78f1f6ef7912f958591c1b81afe0a2747fd4444ce8911e91e2afd91ec91c3cbdc9968d0a6278ccb57bd1b970a62baa9a5cc0287c5c700
7
- data.tar.gz: 956b0c49699f9fd0b056fe094c6fcf04e7cc0dc4d57f30623f3f1a3d9d5f0ff6c2cd1c3eacd89787d4826ebecaecb4174b691b75e9d81ab653c51f14e0f8f702
6
+ metadata.gz: 231898cba50047e62739d620452e69f28e4c4a41ce96ac43caac3d0f41e285cb0a45a08c746632092a95a7b031ffa58a8b6c72c739ce059c03ca43bf1aeceda8
7
+ data.tar.gz: 71c2c7bb47ba0afdd4159ff0e05b389b119f9bfd51bdc227a50414a26d34ed4894b622dfd4906e67888606fe012c29a1e39bb6df3e15d3b7d6af6e9a7bd43919
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <package xmlns="http://apple.com/itunes/importer" version="software4.7">
3
- <software_assets apple_id="<%= @data[:apple_id] %>">
2
+ <package xmlns="http://apple.com/itunes/importer" version="software5.4">
3
+ <software_assets apple_id="<%= @data[:apple_id] %>" app_platform="<%= data[:platform] %>">
4
4
  <asset type="bundle">
5
5
  <data_file>
6
6
  <size><%= @data[:file_size] %></size>
@@ -44,7 +44,11 @@ module FastlaneCore
44
44
  output << ex.to_s
45
45
  o = output.join("\n")
46
46
  puts o
47
- error.call(o, nil)
47
+ if error
48
+ error.call(o, nil)
49
+ else
50
+ raise ex
51
+ end
48
52
  end
49
53
 
50
54
  # Exit status for build command, should be 0 if build succeeded
@@ -53,7 +57,11 @@ module FastlaneCore
53
57
  o = output.join("\n")
54
58
  puts o # the user has the right to see the raw output
55
59
  UI.error "Exit status: #{status}"
56
- error.call(o, status)
60
+ if error
61
+ error.call(o, status)
62
+ else
63
+ raise "Exit status: #{status}"
64
+ end
57
65
  end
58
66
 
59
67
  return output.join("\n")
@@ -13,8 +13,8 @@ module FastlaneCore
13
13
  options.each do |option|
14
14
  next if option.description.to_s.length == 0 # "private" options
15
15
 
16
- appendix = (option.is_string ? "STRING" : "")
17
- type = (option.is_string ? String : nil)
16
+ appendix = (option.string? ? "STRING" : "")
17
+ type = option.data_type
18
18
  short_option = option.short_option
19
19
 
20
20
  raise "Short option #{short_option} already taken for key #{option.key}".red if short_codes.include? short_option
@@ -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, :is_string, :optional
3
+ attr_accessor :key, :env_name, :description, :short_option, :default_value, :verify_block, :optional
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
@@ -11,11 +11,13 @@ 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? Defaults to true. If it's true, the type string will be verified.
14
+ # @param is_string *DEPRECATED* (Boolean) is that parameter a string? Defaults to true. If it's true, the type string will be verified.
15
+ # @param type (Class) the data type of this config item. Takes precedence over `is_string`
15
16
  # @param optional (Boolean) is false by default. If set to true, also string values will not be asked to the user
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
+ 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
18
  raise "key must be a symbol" unless key.kind_of? Symbol
18
19
  raise "env_name must be a String" unless (env_name || '').kind_of? String
20
+
19
21
  if short_option
20
22
  raise "short_option must be a String of length 1" unless short_option.kind_of? String and short_option.delete('-').length == 1
21
23
  end
@@ -23,6 +25,10 @@ module FastlaneCore
23
25
  raise "Do not let descriptions end with a '.', since it's used for user inputs as well".red if description[-1] == '.'
24
26
  end
25
27
 
28
+ if type.to_s.length > 0 and short_option.to_s.length == 0
29
+ raise "Type '#{type}' for key '#{key}' requires a short option"
30
+ end
31
+
26
32
  @key = key
27
33
  @env_name = env_name
28
34
  @description = description
@@ -30,6 +36,7 @@ module FastlaneCore
30
36
  @default_value = default_value
31
37
  @verify_block = verify_block
32
38
  @is_string = is_string
39
+ @data_type = type
33
40
  @optional = optional
34
41
  end
35
42
 
@@ -44,7 +51,7 @@ module FastlaneCore
44
51
  def valid?(value)
45
52
  # we also allow nil values, which do not have to be verified.
46
53
  if value
47
- if @is_string
54
+ if string?
48
55
  raise "'#{self.key}' value must be a String! Found #{value.class} instead.".red unless value.kind_of? String
49
56
  end
50
57
 
@@ -63,14 +70,40 @@ module FastlaneCore
63
70
 
64
71
  # Returns an updated value type (if necessary)
65
72
  def auto_convert_value(value)
66
- # Special treatment if the user specififed true, false or YES, NO
67
- if %w(YES yes true).include?(value)
68
- value = true
69
- elsif %w(NO no false).include?(value)
70
- value = false
73
+ # Weird because of https://stackoverflow.com/questions/9537895/using-a-class-object-in-case-statement
74
+
75
+ case
76
+ when data_type == Array
77
+ return value.split(',') if value.kind_of?(String)
78
+ when data_type == Integer
79
+ return value.to_i
80
+ when data_type == Float
81
+ return value.to_f
82
+ else
83
+ # Special treatment if the user specififed true, false or YES, NO
84
+ # There is no boolean typoe, so we just do it here
85
+ if %w(YES yes true).include?(value)
86
+ return true
87
+ elsif %w(NO no false).include?(value)
88
+ return false
89
+ end
71
90
  end
72
91
 
73
- return value
92
+ return value # fallback to not doing anything
93
+ end
94
+
95
+ # Determines the defined data type of this ConfigItem
96
+ def data_type
97
+ if @data_type
98
+ @data_type
99
+ else
100
+ (@is_string ? String : nil)
101
+ end
102
+ end
103
+
104
+ # Replaces the attr_accessor, but maintains the same interface
105
+ def string?
106
+ data_type == String
74
107
  end
75
108
 
76
109
  def to_s
@@ -120,7 +120,8 @@ module FastlaneCore
120
120
  #####################################################
121
121
 
122
122
  # Returns the value for a certain key. fastlane_core tries to fetch the value from different sources
123
- def fetch(key)
123
+ # if 'ask' is true and the value is not present, the user will be prompted to provide a value
124
+ def fetch(key, ask: true)
124
125
  raise "Key '#{key}' must be a symbol. Example :app_id.".red unless key.kind_of?(Symbol)
125
126
 
126
127
  option = option_for_key(key)
@@ -132,12 +133,12 @@ module FastlaneCore
132
133
 
133
134
  # `if value == nil` instead of ||= because false is also a valid value
134
135
  if value.nil? and option.env_name and ENV[option.env_name]
135
- value = ENV[option.env_name].dup
136
+ value = option.auto_convert_value(ENV[option.env_name].dup)
136
137
  option.verify!(value) if value
137
138
  end
138
139
 
139
140
  value = option.default_value if value.nil?
140
- value = nil if value.nil? and !option.is_string # by default boolean flags are false
141
+ value = nil if value.nil? and !option.string? # by default boolean flags are false
141
142
 
142
143
  return value unless value.nil? # we already have a value
143
144
  return value if option.optional # as this value is not required, just return what we have
@@ -150,7 +151,7 @@ module FastlaneCore
150
151
  raise "No value found for '#{key}'"
151
152
  end
152
153
 
153
- while value.nil?
154
+ while ask && value.nil?
154
155
  Helper.log.info "To not be asked about this value, you can specify it using '#{option.key}'".yellow
155
156
  value = ask("#{option.description}: ")
156
157
  # Also store this value to use it from now on
@@ -7,7 +7,7 @@ module FastlaneCore
7
7
 
8
8
  attr_accessor :package_path
9
9
 
10
- def generate(app_id: nil, ipa_path: nil, package_path: nil)
10
+ def generate(app_id: nil, ipa_path: nil, package_path: nil, platform: nil)
11
11
  self.package_path = File.join(package_path, "#{app_id}.itmsp")
12
12
  FileUtils.rm_rf self.package_path if File.directory?(self.package_path)
13
13
  FileUtils.mkdir_p self.package_path
@@ -19,7 +19,8 @@ module FastlaneCore
19
19
  apple_id: app_id,
20
20
  file_size: File.size(ipa_path),
21
21
  ipa_path: File.basename(ipa_path), # this is only the base name as the ipa is inside the package
22
- md5: Digest::MD5.hexdigest(File.read(ipa_path))
22
+ md5: Digest::MD5.hexdigest(File.read(ipa_path)),
23
+ platform: (platform || "ios") # pass "appletvos" for Apple TV's IPA
23
24
  }
24
25
 
25
26
  xml_path = File.join(lib_path, "lib/assets/XMLTemplate.xml.erb")
@@ -8,7 +8,7 @@ module FastlaneCore
8
8
  rows = []
9
9
 
10
10
  config.available_options.each do |config_item|
11
- value = config._values[config_item.key] # using `_values` here to not ask the user for missing values at this point
11
+ value = config.fetch(config_item.key, ask: false) # Don't ask the user for missing values at this point
12
12
  next if value.nil?
13
13
  next if value.to_s == ""
14
14
  next if hide_keys.include?(config_item.key)
@@ -67,6 +67,40 @@ module FastlaneCore
67
67
  Helper.log.info(("-" * i).green)
68
68
  end
69
69
 
70
+ #####################################################
71
+ # @!group Errors: Inputs
72
+ #####################################################
73
+
74
+ def interactive?
75
+ interactive = true
76
+ interactive = false if $stdout.isatty == false
77
+ interactive = false if Helper.ci?
78
+ return interactive
79
+ end
80
+
81
+ def input(message)
82
+ verify_interactive!(message)
83
+ ask(message)
84
+ end
85
+
86
+ def confirm(message)
87
+ verify_interactive!(message)
88
+ agree("#{message} (y/n)", true)
89
+ end
90
+
91
+ def select(message, options)
92
+ verify_interactive!(message)
93
+
94
+ important(message)
95
+ choose(*(options))
96
+ end
97
+
98
+ def password(message)
99
+ verify_interactive!(message)
100
+
101
+ ask(message.yellow) { |q| q.echo = "*" }
102
+ end
103
+
70
104
  #####################################################
71
105
  # @!group Errors: Different kinds of exceptions
72
106
  #####################################################
@@ -88,7 +122,7 @@ module FastlaneCore
88
122
  end
89
123
 
90
124
  def user_error!(error_message)
91
- error_message = "[!] #{error_message}".red
125
+ error_message = "\n[!] #{error_message}".red
92
126
  if $verbose
93
127
  # On verbose we want to see the full stack trace
94
128
  raise error_message
@@ -96,5 +130,13 @@ module FastlaneCore
96
130
  abort(error_message)
97
131
  end
98
132
  end
133
+
134
+ private
135
+
136
+ def verify_interactive!(message)
137
+ return if interactive?
138
+ important(message)
139
+ crash!("Could not retrieve response as fastlane runs in non-interactive mode")
140
+ end
99
141
  end
100
142
  end
@@ -69,6 +69,37 @@ module FastlaneCore
69
69
  not_implemented(__method__)
70
70
  end
71
71
 
72
+ #####################################################
73
+ # @!group Errors: Inputs
74
+ #####################################################
75
+
76
+ # Is is possible to ask the user questions?
77
+ def interactive?(_message)
78
+ not_implemented(__method__)
79
+ end
80
+
81
+ # get a standard text input (single line)
82
+ def input(_message)
83
+ not_implemented(__method__)
84
+ end
85
+
86
+ # A simple yes or no question
87
+ def confirm(_message)
88
+ not_implemented(__method__)
89
+ end
90
+
91
+ # Let the user select one out of x items
92
+ # return value is the value of the option the user chose
93
+ def select(_message, _options)
94
+ not_implemented(__method__)
95
+ end
96
+
97
+ # Password input for the user, text field shouldn't show
98
+ # plain text
99
+ def password(_message)
100
+ not_implemented(__method__)
101
+ end
102
+
72
103
  #####################################################
73
104
  # @!group Errors: Different kinds of exceptions
74
105
  #####################################################
@@ -7,13 +7,11 @@ module FastlaneCore
7
7
  end
8
8
 
9
9
  def self.method_missing(method_sym, *args, &_block)
10
- raise "Only pass exactly one parameter to UI".red if args.length != 1
11
-
12
10
  # not using `responds` beacuse we don't care about methods like .to_s and so on
13
11
  interface_methods = Interface.instance_methods - Object.instance_methods
14
12
  raise "Unknown method '#{method_sym}', supported #{interface_methods}" unless interface_methods.include?(method_sym)
15
13
 
16
- self.current.send(method_sym, args.first)
14
+ self.current.send(method_sym, *args)
17
15
  end
18
16
  end
19
17
  end
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.29.1"
2
+ VERSION = "0.30.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.29.1
4
+ version: 0.30.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-12-10 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json