fastlane_core 0.28.0 → 0.29.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: 91fc2f52c866a8347a057dd45f6734fb192303a5
4
- data.tar.gz: 71b696f8c444e64187a31fbfc7009ded60e0dea1
3
+ metadata.gz: 26d39ce9978be6553334d8cf4213bb844d5df8ff
4
+ data.tar.gz: bd80eed52b439ac6c7ce8792137df2256f9c1579
5
5
  SHA512:
6
- metadata.gz: c0f5f662a7e349040b28d1582eb2f8c775b4c4042c88f00b5d382e8b56a401924dfe860f8dcb181f73e7f727032e8ba8e2bdd82162ac416bc5fe2c1fea4a86f9
7
- data.tar.gz: a3f5146dcc4a4319ad83658b87d8e301aa68a7e3684bf6f27931a538dcc9bbd9ac9e76abfea6495ca2332b44883fc61e2c929f4705630494ff4670d6b8fb1f39
6
+ metadata.gz: 0ab0dc29557bce345a43f887ec2f3eae3738c86b7cd95055ad49b28b3147e9b9a3a795e7eddce6c9ebf7e821cda4afd3d32072930b7077641e8b87b418751402
7
+ data.tar.gz: 043b377c7cca9211f3dbfe3c2178f0fb07cff105f91bfc4237c3972aadf1ef57ab17f9541996ea362588361109d06ad45ed623af691634c5282ab6395eea5103
data/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
10
  <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
11
  <a href="https://github.com/fastlane/frameit">frameit</a> &bull;
12
- <a href="https://github.com/fastlane/PEM">PEM</a> &bull;
12
+ <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
13
  <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
15
  <a href="https://github.com/fastlane/cert">cert</a> &bull;
@@ -15,6 +15,7 @@ require 'fastlane_core/print_table'
15
15
  require 'fastlane_core/project'
16
16
  require 'fastlane_core/simulator'
17
17
  require 'fastlane_core/crash_reporting/crash_reporting'
18
+ require 'fastlane_core/ui/ui'
18
19
 
19
20
  # Third Party code
20
21
  require 'colored'
@@ -15,10 +15,10 @@ module FastlaneCore
15
15
 
16
16
  output = []
17
17
  command = command.join(" ") if command.kind_of?(Array)
18
- Helper.log.info command.yellow.strip if print_command
18
+ UI.command(command) if print_command
19
19
 
20
20
  if print_all and loading # this is only used to show the "Loading text"...
21
- puts loading.cyan
21
+ UI.command_output(loading)
22
22
  end
23
23
 
24
24
  begin
@@ -29,14 +29,12 @@ module FastlaneCore
29
29
 
30
30
  next unless print_all
31
31
 
32
- line = line.cyan
33
-
34
32
  # Prefix the current line with a string
35
33
  prefix.each do |element|
36
34
  line = element[:prefix] + line if element[:block] && element[:block].call(line)
37
35
  end
38
36
 
39
- puts line
37
+ UI.command_output(line)
40
38
  end
41
39
  Process.wait(pid)
42
40
  end
@@ -54,7 +52,7 @@ module FastlaneCore
54
52
  if status != 0
55
53
  o = output.join("\n")
56
54
  puts o # the user has the right to see the raw output
57
- Helper.log.info "Exit status: #{status}"
55
+ UI.error "Exit status: #{status}"
58
56
  error.call(o, status)
59
57
  end
60
58
 
@@ -11,6 +11,8 @@ module FastlaneCore
11
11
 
12
12
  short_codes = []
13
13
  options.each do |option|
14
+ next if option.description.to_s.length == 0 # "private" options
15
+
14
16
  appendix = (option.is_string ? "STRING" : "")
15
17
  type = (option.is_string ? String : nil)
16
18
  short_option = option.short_option
@@ -1,6 +1,7 @@
1
1
  require 'logger'
2
2
 
3
3
  module FastlaneCore
4
+ # rubocop:disable Metrics/ModuleLength
4
5
  module Helper
5
6
  # Logging happens using this method
6
7
  def self.log
@@ -45,6 +46,15 @@ module FastlaneCore
45
46
  Helper.log.info(("-" * i).green)
46
47
  end
47
48
 
49
+ # Runs a given command using backticks (`)
50
+ # and prints them out using the UI.command method
51
+ def self.backticks(command, print: true)
52
+ UI.command(command) if print
53
+ result = `#{command}`
54
+ UI.command_output(result) if print
55
+ return result
56
+ end
57
+
48
58
  # @return true if the currently running program is a unit test
49
59
  def self.test?
50
60
  defined?SpecHelper
@@ -141,4 +151,5 @@ module FastlaneCore
141
151
  end
142
152
  end
143
153
  end
154
+ # rubocop:enable Metrics/ModuleLength
144
155
  end
@@ -8,7 +8,7 @@ module FastlaneCore
8
8
  rows = []
9
9
 
10
10
  config.available_options.each do |config_item|
11
- value = config[config_item.key]
11
+ value = config._values[config_item.key] # using `_values` here to not 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)
@@ -0,0 +1,17 @@
1
+ # This code overwrites the methods from the colored gem
2
+ # via https://github.com/defunkt/colored/blob/master/lib/colored.rb
3
+
4
+ require 'colored'
5
+
6
+ class String
7
+ Colored::COLORS.keys.each do |color|
8
+ define_method(color) do
9
+ self # do nothing with the string, but return it
10
+ end
11
+ end
12
+ Colored::EXTRAS.keys.each do |extra|
13
+ define_method(extra) do
14
+ self # do nothing with the string, but return it
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,100 @@
1
+ module FastlaneCore
2
+ # Shell is the terminal output of things
3
+ # For documentation for each of the methods open `interface.rb`
4
+ class Shell < Interface
5
+ def log
6
+ return @log if @log
7
+
8
+ $stdout.sync = true
9
+
10
+ if Helper.is_test?
11
+ @log ||= Logger.new(nil) # don't show any logs when running tests
12
+ else
13
+ @log ||= Logger.new($stdout)
14
+ end
15
+
16
+ @log.formatter = proc do |severity, datetime, progname, msg|
17
+ string = "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: " if $verbose
18
+ string = "[#{datetime.strftime('%H:%M:%S')}]: " unless $verbose
19
+
20
+ string += "#{msg}\n"
21
+
22
+ string
23
+ end
24
+
25
+ @log
26
+ end
27
+
28
+ #####################################################
29
+ # @!group Messaging: show text to the user
30
+ #####################################################
31
+
32
+ def error(message)
33
+ log.error(message.red)
34
+ end
35
+
36
+ def important(message)
37
+ log.warn(message.yellow)
38
+ end
39
+
40
+ def success(message)
41
+ log.info(message.green)
42
+ end
43
+
44
+ def message(message)
45
+ log.info(message)
46
+ end
47
+
48
+ def command(message)
49
+ log.info("$ #{message}".cyan.underline)
50
+ end
51
+
52
+ def command_output(message)
53
+ actual = (message.split("\r").last || "") # as clearing the line will remove the `>` and the time stamp
54
+ actual.split("\n").each do |msg|
55
+ log.info("> #{msg}".magenta)
56
+ end
57
+ end
58
+
59
+ def verbose(message)
60
+ log.debug(message) if $verbose
61
+ end
62
+
63
+ def header(message)
64
+ i = message.length + 8
65
+ Helper.log.info(("-" * i).green)
66
+ Helper.log.info(("--- " + message + " ---").green)
67
+ Helper.log.info(("-" * i).green)
68
+ end
69
+
70
+ #####################################################
71
+ # @!group Errors: Different kinds of exceptions
72
+ #####################################################
73
+
74
+ def crash!(exception)
75
+ if exception.kind_of?(String)
76
+ raise exception.red
77
+ elsif exception.kind_of?(Exception)
78
+ # From https://stackoverflow.com/a/4789702/445598
79
+ # We do this to make the actual error message red and therefore more visible
80
+ begin
81
+ raise exception
82
+ rescue => ex
83
+ raise $!, "[!] #{ex.message}".red, $!.backtrace
84
+ end
85
+ else
86
+ raise exception # we're just raising whatever we have here #yolo
87
+ end
88
+ end
89
+
90
+ def user_error!(error_message)
91
+ error_message = "[!] #{error_message}".red
92
+ if $verbose
93
+ # On verbose we want to see the full stack trace
94
+ raise error_message
95
+ else
96
+ abort(error_message)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,102 @@
1
+ module FastlaneCore
2
+ # Abstract super class
3
+ class Interface
4
+ #####################################################
5
+ # @!group Messaging: show text to the user
6
+ #####################################################
7
+
8
+ # Level Error: Can be used to show additional error
9
+ # information before actually raising an exception
10
+ # or can be used to just show an error from which
11
+ # fastlane can recover (much magic)
12
+ #
13
+ # By default those messages are shown in red
14
+ def error(_message)
15
+ not_implemented(__method__)
16
+ end
17
+
18
+ # Level Important: Can be used to show warnings to the user
19
+ # not necessarly negative, but something the user should
20
+ # be aware of.
21
+ #
22
+ # By default those messages are shown in yellow
23
+ def important(_message)
24
+ not_implemented(__method__)
25
+ end
26
+
27
+ # Level Success: Show that something was successful
28
+ #
29
+ # By default those messages are shown in green
30
+ def success(_message)
31
+ not_implemented(__method__)
32
+ end
33
+
34
+ # Level Message: Show a neutral message to the user
35
+ #
36
+ # By default those messages shown in white/black
37
+ def message(_message)
38
+ not_implemented(__method__)
39
+ end
40
+
41
+ # Level Command: Print out a terminal command that is being
42
+ # executed.
43
+ #
44
+ # By default those messages shown in cyan
45
+ def command(_message)
46
+ not_implemented(__method__)
47
+ end
48
+
49
+ # Level Command Output: Print the output of a command with
50
+ # this method
51
+ #
52
+ # By default those messages shown in magenta
53
+ def command_output(_message)
54
+ not_implemented(__method__)
55
+ end
56
+
57
+ # Level Verbose: Print out additional information for the
58
+ # users that are interested. Will only be printed when
59
+ # $verbose = true
60
+ #
61
+ # By default those messages are shown in white
62
+ def verbose(_message)
63
+ not_implemented(__method__)
64
+ end
65
+
66
+ # Print a header = a text in a box
67
+ # use this if this message is really important
68
+ def header(_message)
69
+ not_implemented(__method__)
70
+ end
71
+
72
+ #####################################################
73
+ # @!group Errors: Different kinds of exceptions
74
+ #####################################################
75
+
76
+ # Pass an exception to this method to exit the program
77
+ # using the given exception
78
+ def crash!(_exception)
79
+ not_implemented(__method__)
80
+ end
81
+
82
+ # Use this method to exit the program because of an user error
83
+ # e.g. app doesn't exist on the given Developer Account
84
+ # or invalid user credentials
85
+ # This will show the error message, but doesn't show the full
86
+ # stack trace
87
+ def user_error!(_error_message)
88
+ not_implemented(__method__)
89
+ end
90
+
91
+ #####################################################
92
+ # @!group Helpers
93
+ #####################################################
94
+ def not_implemented(method_name)
95
+ raise "Current UI '#{self}' doesn't support method '#{method_name}'".red
96
+ end
97
+
98
+ def to_s
99
+ self.class.name.split('::').last
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,28 @@
1
+ module FastlaneCore
2
+ class UI
3
+ class << self
4
+ def current
5
+ @current ||= Shell.new
6
+ end
7
+ end
8
+
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
+ # not using `responds` beacuse we don't care about methods like .to_s and so on
13
+ interface_methods = Interface.instance_methods - Object.instance_methods
14
+ raise "Unknown method '#{method_sym}', supported #{interface_methods}" unless interface_methods.include?(method_sym)
15
+
16
+ self.current.send(method_sym, args.first)
17
+ end
18
+ end
19
+ end
20
+
21
+ require 'fastlane_core/ui/interface'
22
+
23
+ # Import all available implementations
24
+ Dir[File.expand_path('implementations/*.rb', File.dirname(__FILE__))].each do |file|
25
+ require file
26
+ end
27
+
28
+ require 'fastlane_core/ui/disable_colors' if ENV["FASTLANE_DISABLE_COLORS"]
@@ -1,3 +1,3 @@
1
1
  module FastlaneCore
2
- VERSION = "0.28.0"
2
+ VERSION = "0.29.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.28.0
4
+ version: 0.29.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-03 00:00:00.000000000 Z
11
+ date: 2015-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -339,6 +339,10 @@ files:
339
339
  - lib/fastlane_core/project.rb
340
340
  - lib/fastlane_core/provisioning_profile.rb
341
341
  - lib/fastlane_core/simulator.rb
342
+ - lib/fastlane_core/ui/disable_colors.rb
343
+ - lib/fastlane_core/ui/implementations/shell.rb
344
+ - lib/fastlane_core/ui/interface.rb
345
+ - lib/fastlane_core/ui/ui.rb
342
346
  - lib/fastlane_core/update_checker/changelog.rb
343
347
  - lib/fastlane_core/update_checker/update_checker.rb
344
348
  - lib/fastlane_core/version.rb
@@ -362,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
366
  version: '0'
363
367
  requirements: []
364
368
  rubyforge_project:
365
- rubygems_version: 2.2.2
369
+ rubygems_version: 2.4.0
366
370
  signing_key:
367
371
  specification_version: 4
368
372
  summary: Contains all shared code/dependencies of the fastlane.tools