fastlane 2.14.2 → 2.15.0.beta.20170213032052

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/cert/lib/cert/commands_generator.rb +1 -1
  3. data/cert/lib/cert/runner.rb +1 -1
  4. data/credentials_manager/lib/credentials_manager/appfile_config.rb +1 -1
  5. data/deliver/lib/deliver/commands_generator.rb +1 -1
  6. data/deliver/lib/deliver/runner.rb +2 -2
  7. data/deliver/lib/deliver/setup.rb +4 -2
  8. data/fastlane/lib/fastlane/actions/actions_helper.rb +1 -1
  9. data/fastlane/lib/fastlane/actions/add_extra_platforms.rb +45 -0
  10. data/fastlane/lib/fastlane/actions/changelog_from_git_commits.rb +13 -7
  11. data/fastlane/lib/fastlane/actions/crashlytics.rb +2 -2
  12. data/fastlane/lib/fastlane/actions/ensure_no_debug_code.rb +13 -1
  13. data/fastlane/lib/fastlane/actions/git_tag_exists.rb +1 -1
  14. data/fastlane/lib/fastlane/actions/hockey.rb +117 -14
  15. data/fastlane/lib/fastlane/actions/slack.rb +1 -1
  16. data/fastlane/lib/fastlane/cli_tools_distributor.rb +4 -0
  17. data/fastlane/lib/fastlane/commands_generator.rb +12 -12
  18. data/fastlane/lib/fastlane/documentation/docs_generator.rb +1 -1
  19. data/fastlane/lib/fastlane/environment_printer.rb +2 -2
  20. data/fastlane/lib/fastlane/fastlane_require.rb +1 -1
  21. data/fastlane/lib/fastlane/helper/git_helper.rb +22 -15
  22. data/fastlane/lib/fastlane/lane_manager.rb +2 -2
  23. data/fastlane/lib/fastlane/plugins/plugin_info_collector.rb +2 -2
  24. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +5 -5
  25. data/fastlane/lib/fastlane/runner.rb +12 -9
  26. data/fastlane/lib/fastlane/setup/crashlytics_beta_ui.rb +1 -4
  27. data/fastlane/lib/fastlane/supported_platforms.rb +17 -7
  28. data/fastlane/lib/fastlane/version.rb +1 -1
  29. data/fastlane_core/lib/fastlane_core.rb +1 -0
  30. data/fastlane_core/lib/fastlane_core/cert_checker.rb +3 -3
  31. data/fastlane_core/lib/fastlane_core/command_executor.rb +1 -1
  32. data/fastlane_core/lib/fastlane_core/configuration/commander_generator.rb +7 -3
  33. data/fastlane_core/lib/fastlane_core/device_manager.rb +43 -16
  34. data/fastlane_core/lib/fastlane_core/globals.rb +27 -0
  35. data/fastlane_core/lib/fastlane_core/ipa_upload_package_builder.rb +1 -1
  36. data/fastlane_core/lib/fastlane_core/itunes_transporter.rb +2 -4
  37. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +1 -1
  38. data/fastlane_core/lib/fastlane_core/pkg_upload_package_builder.rb +1 -1
  39. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +4 -4
  40. data/fastlane_core/lib/fastlane_core/ui/github_issue_inspector_reporter.rb +1 -1
  41. data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +22 -14
  42. data/fastlane_core/lib/fastlane_core/ui/interface.rb +5 -4
  43. data/frameit/README.md +4 -1
  44. data/frameit/lib/frameit/commands_generator.rb +1 -1
  45. data/frameit/lib/frameit/editor.rb +60 -13
  46. data/frameit/lib/frameit/runner.rb +1 -1
  47. data/gym/README.md +14 -0
  48. data/gym/lib/gym/commands_generator.rb +1 -1
  49. data/gym/lib/gym/error_handler.rb +2 -2
  50. data/gym/lib/gym/generators/package_command_generator_xcode7.rb +1 -1
  51. data/gym/lib/gym/runner.rb +3 -3
  52. data/gym/lib/gym/xcodebuild_fixes/package_application_fix.rb +2 -2
  53. data/gym/lib/gym/xcodebuild_fixes/swift_fix.rb +1 -1
  54. data/match/lib/match/commands_generator.rb +1 -1
  55. data/match/lib/match/encrypt.rb +3 -3
  56. data/match/lib/match/git_helper.rb +8 -8
  57. data/match/lib/match/options.rb +1 -1
  58. data/match/lib/match/utils.rb +3 -3
  59. data/pem/lib/pem/commands_generator.rb +1 -1
  60. data/pilot/lib/pilot/commands_generator.rb +1 -1
  61. data/produce/README.md +1 -1
  62. data/produce/lib/produce/commands_generator.rb +2 -2
  63. data/scan/lib/scan/commands_generator.rb +1 -1
  64. data/scan/lib/scan/options.rb +6 -0
  65. data/scan/lib/scan/runner.rb +2 -2
  66. data/scan/lib/scan/test_command_generator.rb +1 -0
  67. data/screengrab/lib/screengrab/commands_generator.rb +1 -1
  68. data/sigh/lib/sigh/commands_generator.rb +3 -3
  69. data/sigh/lib/sigh/local_manage.rb +1 -1
  70. data/sigh/lib/sigh/resign.rb +1 -1
  71. data/sigh/lib/sigh/runner.rb +8 -3
  72. data/snapshot/README.md +3 -3
  73. data/snapshot/lib/snapshot/collector.rb +1 -1
  74. data/snapshot/lib/snapshot/commands_generator.rb +1 -1
  75. data/snapshot/lib/snapshot/fixes/hardware_keyboard_fix.rb +1 -1
  76. data/snapshot/lib/snapshot/fixes/simulator_zoom_fix.rb +1 -1
  77. data/snapshot/lib/snapshot/reset_simulators.rb +2 -2
  78. data/snapshot/lib/snapshot/runner.rb +3 -3
  79. data/spaceship/lib/spaceship.rb +2 -0
  80. data/spaceship/lib/spaceship/base.rb +18 -0
  81. data/spaceship/lib/spaceship/client.rb +8 -5
  82. data/spaceship/lib/spaceship/globals.rb +12 -0
  83. data/spaceship/lib/spaceship/portal/app.rb +0 -6
  84. data/spaceship/lib/spaceship/portal/app_group.rb +0 -6
  85. data/spaceship/lib/spaceship/portal/device.rb +0 -6
  86. data/spaceship/lib/spaceship/portal/person.rb +0 -6
  87. data/spaceship/lib/spaceship/portal/portal.rb +1 -0
  88. data/spaceship/lib/spaceship/portal/portal_client.rb +37 -0
  89. data/spaceship/lib/spaceship/portal/spaceship.rb +9 -0
  90. data/spaceship/lib/spaceship/portal/website_push.rb +90 -0
  91. data/spaceship/lib/spaceship/tunes/app_image.rb +0 -6
  92. data/spaceship/lib/spaceship/tunes/app_ratings.rb +0 -9
  93. data/spaceship/lib/spaceship/tunes/app_screenshot.rb +0 -7
  94. data/spaceship/lib/spaceship/tunes/app_trailer.rb +0 -6
  95. data/spaceship/lib/spaceship/tunes/app_version.rb +1 -0
  96. data/spaceship/lib/spaceship/tunes/app_version_generated_promocodes.rb +0 -9
  97. data/spaceship/lib/spaceship/tunes/app_version_history.rb +0 -9
  98. data/spaceship/lib/spaceship/tunes/app_version_promocodes.rb +0 -9
  99. data/spaceship/lib/spaceship/tunes/app_version_ref.rb +0 -6
  100. data/spaceship/lib/spaceship/tunes/app_version_states_history.rb +0 -9
  101. data/spaceship/lib/spaceship/tunes/application.rb +0 -6
  102. data/spaceship/lib/spaceship/tunes/build.rb +0 -8
  103. data/spaceship/lib/spaceship/tunes/build_details.rb +0 -8
  104. data/spaceship/lib/spaceship/tunes/build_train.rb +0 -6
  105. data/spaceship/lib/spaceship/tunes/member.rb +0 -6
  106. data/spaceship/lib/spaceship/tunes/pricing_tier.rb +0 -9
  107. data/spaceship/lib/spaceship/tunes/recovery_device.rb +0 -6
  108. data/spaceship/lib/spaceship/tunes/territory.rb +0 -7
  109. data/spaceship/lib/spaceship/tunes/tester.rb +0 -6
  110. data/spaceship/lib/spaceship/tunes/transit_app_file.rb +0 -6
  111. data/spaceship/lib/spaceship/tunes/tunes_client.rb +2 -2
  112. data/spaceship/lib/spaceship/tunes/user_detail.rb +0 -6
  113. data/spaceship/lib/spaceship/tunes/version_set.rb +0 -11
  114. data/spaceship/lib/spaceship/two_step_client.rb +2 -2
  115. data/supply/lib/supply/commands_generator.rb +1 -1
  116. metadata +34 -17
@@ -46,7 +46,7 @@ module Fastlane
46
46
  UI.success('Successfully sent Slack notification')
47
47
  else
48
48
  UI.verbose(result)
49
- UI.user_error!("Error pushing Slack message, maybe the integration has no permission to post on this channel? Try removing the channel parameter in your Fastfile.")
49
+ UI.user_error!("Error pushing Slack message, maybe the integration has no permission to post on this channel? Try removing the channel parameter in your Fastfile, this is usually caused by a mispelled or changed group/channel name or an expired SLACK_URL")
50
50
  end
51
51
  end
52
52
 
@@ -8,6 +8,10 @@ module Fastlane
8
8
  ARGV.include?('-v') || ARGV.include?('--version')
9
9
  end
10
10
 
11
+ def running_help_command?
12
+ ARGV.include?('-h') || ARGV.include?('--help')
13
+ end
14
+
11
15
  def take_off
12
16
  before_import_time = Time.now
13
17
 
@@ -10,20 +10,20 @@ module Fastlane
10
10
  def self.start
11
11
  # since at this point we haven't yet loaded commander
12
12
  # however we do want to log verbose information in the PluginManager
13
- FastlaneCore::Swag.show_loader
14
- $verbose = true if ARGV.include?("--verbose")
15
-
13
+ FastlaneCore::Globals.verbose = true if ARGV.include?("--verbose")
14
+ FastlaneCore::Globals.capture_output = true if ARGV.include?("--capture_output")
16
15
  if ARGV.include?("--capture_output")
17
- $capture_output = true
18
- $verbose = true
16
+ FastlaneCore::Globals.verbose = true
17
+ FastlaneCore::Globals.capture_output = true
19
18
  end
19
+ FastlaneCore::Swag.show_loader
20
20
 
21
21
  # has to be checked here - in case we wan't to troubleshoot plugin related issues
22
22
  if ARGV.include?("--troubleshoot")
23
23
  self.confirm_troubleshoot
24
24
  end
25
25
 
26
- if $capture_output
26
+ if FastlaneCore::Globals.capture_output?
27
27
  # Trace mode is enabled
28
28
  # redirect STDOUT and STDERR
29
29
  out_channel = StringIO.new
@@ -34,7 +34,7 @@ module Fastlane
34
34
  Fastlane.load_actions
35
35
  FastlaneCore::Swag.stop_loader
36
36
  # do not use "include" as it may be some where in the commandline where "env" is required, therefore explicit index->0
37
- unless ARGV[0] == "env" || CLIToolsDistributor.running_version_command?
37
+ unless ARGV[0] == "env" || CLIToolsDistributor.running_version_command? || CLIToolsDistributor.running_help_command?
38
38
  # *after* loading the plugins
39
39
  Fastlane.plugin_manager.load_plugins
40
40
  Fastlane::PluginUpdateManager.start_looking_for_updates
@@ -43,8 +43,8 @@ module Fastlane
43
43
  ensure
44
44
  FastlaneCore::UpdateChecker.show_update_status('fastlane', Fastlane::VERSION)
45
45
  Fastlane::PluginUpdateManager.show_update_status
46
- if $capture_output
47
- $captured_output = Helper.strip_ansi_colors($stdout.string)
46
+ if FastlaneCore::Globals.capture_output?
47
+ FastlaneCore::Globals.captured_output = Helper.strip_ansi_colors($stdout.string)
48
48
  $stdout = STDOUT
49
49
  $stderr = STDERR
50
50
 
@@ -86,10 +86,10 @@ module Fastlane
86
86
  program :help, 'GitHub', 'https://github.com/fastlane/fastlane'
87
87
  program :help_formatter, :compact
88
88
 
89
- global_option('--verbose') { $verbose = true }
89
+ global_option('--verbose') { FastlaneCore::Globals.verbose = true }
90
90
  global_option('--capture_output', 'Captures the output of the current run, and generates a markdown issue template') do
91
- $capture_output = true
92
- $verbose = true
91
+ FastlaneCore::Globals.capture_output = true
92
+ FastlaneCore::Globals.verbose = true
93
93
  end
94
94
  global_option('--troubleshoot', 'Enables extended verbose mode. Use with caution, as this even includes ALL sensitive data. Cannot be used on CI.')
95
95
 
@@ -64,7 +64,7 @@ module Fastlane
64
64
  output << ""
65
65
 
66
66
  File.write(output_path, output.join("\n"))
67
- UI.success "Successfully generated documentation at path '#{File.expand_path(output_path)}'" if $verbose
67
+ UI.success "Successfully generated documentation at path '#{File.expand_path(output_path)}'" if FastlaneCore::Globals.verbose?
68
68
  end
69
69
 
70
70
  #####################################################
@@ -34,10 +34,10 @@ module Fastlane
34
34
  env_tail = "</details>"
35
35
  final_output = ""
36
36
 
37
- if $captured_output
37
+ if FastlaneCore::Globals.captured_output?
38
38
  final_output << "### Captured Output\n\n"
39
39
  final_output << "Command Used: `#{ARGV.join(' ')}`\n"
40
- final_output << "<details><summary>Output/Log</summary>\n\n```\n\n#{$captured_output}\n\n```\n\n</details>\n\n"
40
+ final_output << "<details><summary>Output/Log</summary>\n\n```\n\n#{FastlaneCore::Globals.captured_output}\n\n```\n\n</details>\n\n"
41
41
  end
42
42
 
43
43
  final_output << env_header + env_output + env_tail
@@ -6,7 +6,7 @@ module Fastlane
6
6
 
7
7
  # check if it's installed
8
8
  if gem_installed?(gem_name)
9
- UI.success("gem '#{gem_name}' is already installed") if $verbose
9
+ UI.success("gem '#{gem_name}' is already installed") if FastlaneCore::Globals.verbose?
10
10
  require gem_require_name if require_gem
11
11
  return true
12
12
  end
@@ -2,20 +2,24 @@ module Fastlane
2
2
  module Actions
3
3
  GIT_MERGE_COMMIT_FILTERING_OPTIONS = [:include_merges, :exclude_merges, :only_include_merges].freeze
4
4
 
5
- def self.git_log_between(pretty_format, from, to, merge_commit_filtering)
6
- command = 'git log'
7
- command << " --pretty=\"#{pretty_format}\" #{from.shellescape}...#{to.shellescape}"
5
+ def self.git_log_between(pretty_format, from, to, merge_commit_filtering, date_format = nil)
6
+ command = ['git log']
7
+ command << "--pretty=\"#{pretty_format}\""
8
+ command << "--date=\"#{date_format}\"" if date_format
9
+ command << "#{from.shellescape}...#{to.shellescape}"
8
10
  command << git_log_merge_commit_filtering_option(merge_commit_filtering)
9
- Actions.sh(command, log: false).chomp
11
+ Actions.sh(command.compact.join(' '), log: false).chomp
10
12
  rescue
11
13
  nil
12
14
  end
13
15
 
14
- def self.git_log_last_commits(pretty_format, commit_count, merge_commit_filtering)
15
- command = 'git log'
16
- command << " --pretty=\"#{pretty_format}\" -n #{commit_count}"
16
+ def self.git_log_last_commits(pretty_format, commit_count, merge_commit_filtering, date_format = nil)
17
+ command = ['git log']
18
+ command << "--pretty=\"#{pretty_format}\""
19
+ command << "--date=\"#{date_format}\"" if date_format
20
+ command << "-n #{commit_count}"
17
21
  command << git_log_merge_commit_filtering_option(merge_commit_filtering)
18
- Actions.sh(command, log: false).chomp
22
+ Actions.sh(command.compact.join(' '), log: false).chomp
19
23
  rescue
20
24
  nil
21
25
  end
@@ -26,7 +30,7 @@ module Fastlane
26
30
  command = ['git describe']
27
31
  command << '--tags' if match_lightweight
28
32
  command << "`git rev-list --tags#{tag_pattern_param} --max-count=1`"
29
- Actions.sh(command.join(' '), log: false).chomp
33
+ Actions.sh(command.compact.join(' '), log: false).chomp
30
34
  rescue
31
35
  nil
32
36
  end
@@ -44,8 +48,11 @@ module Fastlane
44
48
 
45
49
  # Gets the last git commit information formatted into a String by the provided
46
50
  # pretty format String. See the git-log documentation for valid format placeholders
47
- def self.last_git_commit_formatted_with(pretty_format)
48
- Actions.sh("git log -1 --pretty=#{pretty_format}", log: false).chomp
51
+ def self.last_git_commit_formatted_with(pretty_format, date_format = nil)
52
+ command = ['git log -1']
53
+ command << "--pretty=\"#{pretty_format}\""
54
+ command << "--date=\"#{date_format}\"" if date_format
55
+ Actions.sh(command.compact.join(' '), log: false).chomp
49
56
  rescue
50
57
  nil
51
58
  end
@@ -93,11 +100,11 @@ module Fastlane
93
100
  def self.git_log_merge_commit_filtering_option(merge_commit_filtering)
94
101
  case merge_commit_filtering
95
102
  when :exclude_merges
96
- " --no-merges"
103
+ "--no-merges"
97
104
  when :only_include_merges
98
- " --merges"
99
- else
100
- ""
105
+ "--merges"
106
+ when :include_merges
107
+ nil
101
108
  end
102
109
  end
103
110
  end
@@ -211,13 +211,13 @@ module Fastlane
211
211
  def self.print_lane_context
212
212
  return if Actions.lane_context.empty?
213
213
 
214
- if $verbose
214
+ if FastlaneCore::Globals.verbose?
215
215
  UI.important 'Lane Context:'.yellow
216
216
  UI.message Actions.lane_context
217
217
  return
218
218
  end
219
219
 
220
- # Print a nice table unless in $verbose mode
220
+ # Print a nice table unless in FastlaneCore::Globals.verbose? mode
221
221
  rows = Actions.lane_context.collect do |key, content|
222
222
  [key, content.to_s]
223
223
  end
@@ -95,7 +95,7 @@ module Fastlane
95
95
  #
96
96
 
97
97
  def detect_author
98
- git_name = Helper.backticks('git config --get user.name', print: $verbose).strip
98
+ git_name = Helper.backticks('git config --get user.name', print: FastlaneCore::Globals.verbose?).strip
99
99
  return git_name.empty? ? nil : git_name
100
100
  end
101
101
 
@@ -121,7 +121,7 @@ module Fastlane
121
121
  #
122
122
 
123
123
  def detect_email
124
- git_email = Helper.backticks('git config --get user.email', print: $verbose).strip
124
+ git_email = Helper.backticks('git config --get user.email', print: FastlaneCore::Globals.verbose?).strip
125
125
  return git_email.empty? ? nil : git_email
126
126
  end
127
127
 
@@ -169,9 +169,9 @@ module Fastlane
169
169
  ensure_plugins_attached!
170
170
  with_clean_bundler_env do
171
171
  cmd = "bundle install"
172
- cmd << " --quiet" unless $verbose
172
+ cmd << " --quiet" unless FastlaneCore::Globals.verbose?
173
173
  cmd << " && echo 'Successfully installed plugins'"
174
- UI.command(cmd) if $verbose
174
+ UI.command(cmd) if FastlaneCore::Globals.verbose?
175
175
  exec(cmd)
176
176
  end
177
177
  end
@@ -183,9 +183,9 @@ module Fastlane
183
183
  ensure_plugins_attached!
184
184
  with_clean_bundler_env do
185
185
  cmd = "bundle update"
186
- cmd << " --quiet" unless $verbose
186
+ cmd << " --quiet" unless FastlaneCore::Globals.verbose?
187
187
  cmd << " && echo 'Successfully updated plugins'"
188
- UI.command(cmd) if $verbose
188
+ UI.command(cmd) if FastlaneCore::Globals.verbose?
189
189
  exec(cmd)
190
190
  end
191
191
  end
@@ -279,7 +279,7 @@ module Fastlane
279
279
 
280
280
  store_plugin_reference(gem_name)
281
281
  loaded_plugins = true
282
- rescue => ex
282
+ rescue StandardError, ScriptError => ex # some errors, like ScriptError are not caught unless explicitly
283
283
  UI.error("Error loading plugin '#{gem_name}': #{ex}")
284
284
 
285
285
  # We'll still add it to the table, to make the error
@@ -58,10 +58,14 @@ module Fastlane
58
58
  rescue => ex
59
59
  Dir.chdir(path_to_use) do
60
60
  # Provide error block exception without colour code
61
- error_ex = ex.exception(ex.message.gsub(/\033\[\d+m/, ''))
62
-
63
- error_blocks[current_platform].call(current_lane, error_ex, parameters) if error_blocks[current_platform] && current_platform
64
- error_blocks[nil].call(current_lane, error_ex, parameters) if error_blocks[nil]
61
+ begin
62
+ error_blocks[current_platform].call(current_lane, ex, parameters) if current_platform && error_blocks[current_platform]
63
+ error_blocks[nil].call(current_lane, ex, parameters) if error_blocks[nil]
64
+ rescue => error_block_exception
65
+ UI.error("An error occured while executing the `error` block:")
66
+ UI.error(error_block_exception.to_s)
67
+ raise ex # raise the original error message
68
+ end
65
69
  end
66
70
 
67
71
  raise ex
@@ -258,12 +262,11 @@ module Fastlane
258
262
 
259
263
  def verify_supported_os(name, class_ref)
260
264
  if class_ref.respond_to?(:is_supported?)
261
- if Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
262
- # This value is filled in based on the executed platform block. Might be nil when lane is in root of Fastfile
263
- platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
264
-
265
+ # This value is filled in based on the executed platform block. Might be nil when lane is in root of Fastfile
266
+ platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
267
+ if platform
265
268
  unless class_ref.is_supported?(platform)
266
- UI.user_error!("Action '#{name}' doesn't support required operating system '#{platform}'.")
269
+ UI.important("Action '#{name}' isn't known to support operating system '#{platform}'.")
267
270
  end
268
271
  end
269
272
  end
@@ -9,10 +9,7 @@ module Fastlane
9
9
  end
10
10
 
11
11
  def header(text)
12
- i = text.length + 8
13
- success("-" * i)
14
- success("--- " + text + " ---")
15
- success("-" * i)
12
+ FastlaneCore::UI.header(text)
16
13
  end
17
14
 
18
15
  def important(text)
@@ -1,17 +1,27 @@
1
1
  module Fastlane
2
2
  class SupportedPlatforms
3
+ class << self
4
+ attr_accessor :extra
5
+ attr_reader :default
6
+
7
+ def extra=(value)
8
+ value ||= []
9
+ UI.important("Setting '#{value}' as extra SupportedPlatforms")
10
+ @extra = value
11
+ end
12
+ end
13
+
14
+ @default = [:ios, :mac, :android]
15
+ @extra = []
16
+
3
17
  def self.all
4
- [
5
- :ios,
6
- :mac,
7
- :android
8
- ]
18
+ (@default + @extra).flatten
9
19
  end
10
20
 
11
- # this will throw an exception if the passed platform is not supported
21
+ # this will log a warning if the passed platform is not supported
12
22
  def self.verify!(platform)
13
23
  unless all.include? platform.to_s.to_sym
14
- UI.user_error!("Platform '#{platform}' is not supported. Must be either #{self.all}")
24
+ UI.important("Platform '#{platform}' is not officially supported. Currently supported plaforms are #{self.all}.")
15
25
  end
16
26
  end
17
27
  end
@@ -1,4 +1,4 @@
1
1
  module Fastlane
2
- VERSION = '2.14.2'.freeze
2
+ VERSION = '2.15.0.beta.20170213032052'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  end
@@ -1,6 +1,7 @@
1
1
  require 'json'
2
2
  require 'fastlane/version'
3
3
 
4
+ require 'fastlane_core/globals'
4
5
  # Ruby monkey-patches - should be before almost all else
5
6
  require 'fastlane_core/core_ext/string'
6
7
 
@@ -49,7 +49,7 @@ module FastlaneCore
49
49
  def self.wwdr_certificate_installed?
50
50
  certificate_name = "Apple Worldwide Developer Relations Certification Authority"
51
51
  keychain = wwdr_keychain
52
- response = Helper.backticks("security find-certificate -c '#{certificate_name}' #{keychain.shellescape}", print: $verbose)
52
+ response = Helper.backticks("security find-certificate -c '#{certificate_name}' #{keychain.shellescape}", print: FastlaneCore::Globals.verbose?)
53
53
  return response.include?("attributes:")
54
54
  end
55
55
 
@@ -59,7 +59,7 @@ module FastlaneCore
59
59
  filename = File.basename(url)
60
60
  keychain = wwdr_keychain
61
61
  keychain = "-k #{keychain.shellescape}" unless keychain.empty?
62
- Helper.backticks("curl -O #{url} && security import #{filename} #{keychain}", print: $verbose)
62
+ Helper.backticks("curl -O #{url} && security import #{filename} #{keychain}", print: FastlaneCore::Globals.verbose?)
63
63
  UI.user_error!("Could not install WWDR certificate") unless $?.success?
64
64
  end
65
65
  end
@@ -70,7 +70,7 @@ module FastlaneCore
70
70
  "security default-keychain -d user"
71
71
  ]
72
72
  priority.each do |command|
73
- keychains = Helper.backticks(command, print: $verbose).split("\n")
73
+ keychains = Helper.backticks(command, print: FastlaneCore::Globals.verbose?).split("\n")
74
74
  unless keychains.empty?
75
75
  # Select first keychain name from returned keychains list
76
76
  return keychains[0].strip.tr('"', '')
@@ -31,7 +31,7 @@ module FastlaneCore
31
31
  # @param loading [String] A loading string that is shown before the first output
32
32
  # @return [String] All the output as string
33
33
  def execute(command: nil, print_all: false, print_command: true, error: nil, prefix: nil, loading: nil)
34
- print_all = true if $verbose
34
+ print_all = true if FastlaneCore::Globals.verbose?
35
35
  prefix ||= {}
36
36
 
37
37
  output = []
@@ -6,7 +6,7 @@ module FastlaneCore
6
6
  include Commander::Methods
7
7
 
8
8
  # Calls the appropriate methods for commander to show the available parameters
9
- def generate(options)
9
+ def generate(options, command: nil)
10
10
  # First, enable `always_trace`, to show the stack trace
11
11
  always_trace!
12
12
 
@@ -64,8 +64,12 @@ module FastlaneCore
64
64
  # automatically coerced or otherwise handled by the ConfigItem for others.
65
65
  args = [short_switch, long_switch, (type || String), description].compact
66
66
 
67
- # This is the call to Commander to set up the option we've been building.
68
- global_option(*args)
67
+ if command
68
+ command.option(*args)
69
+ else
70
+ # This is the call to Commander to set up the option we've been building.
71
+ global_option(*args)
72
+ end
69
73
  end
70
74
  end
71
75
 
@@ -194,21 +194,6 @@ module FastlaneCore
194
194
  all.each(&:reset)
195
195
  end
196
196
 
197
- def copy_logarchive(device, dest)
198
- sim_resource_dir = FastlaneCore::CommandExecutor.execute(command: "xcrun simctl getenv #{device.udid} SIMULATOR_SHARED_RESOURCES_DIRECTORY 2>/dev/null", print_all: false, print_command: true)
199
- logarchive_src = File.join(sim_resource_dir, "system_logs.logarchive")
200
-
201
- # if logarchive already exists it fails as the .logarchive is a directory, so delete it. to be sure its gone
202
- FileUtils.rm_rf(logarchive_src)
203
- FileUtils.rm_rf(dest)
204
-
205
- command = "xcrun simctl spawn #{device.udid} log collect 2>/dev/null"
206
- FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: true)
207
-
208
- FileUtils.cp_r(logarchive_src, dest)
209
- UI.success "Copying file '#{logarchive_src}' to '#{dest}'..."
210
- end
211
-
212
197
  def reset_all_by_version(os_version: nil)
213
198
  return false unless os_version
214
199
  all.select { |device| device.os_version == os_version }.each(&:reset)
@@ -232,7 +217,49 @@ module FastlaneCore
232
217
 
233
218
  UI.verbose "Launching #{simulator_path} for device: #{device.name} (#{device.udid})"
234
219
 
235
- Helper.backticks("open -a #{simulator_path} --args -CurrentDeviceUDID #{device.udid}", print: $verbose)
220
+ Helper.backticks("open -a #{simulator_path} --args -CurrentDeviceUDID #{device.udid}", print: FastlaneCore::Globals.verbose?)
221
+ end
222
+
223
+ def copy_logs(device, log_identity, logs_destination_dir)
224
+ logs_destination_dir = File.expand_path(logs_destination_dir)
225
+ os_version = FastlaneCore::CommandExecutor.execute(command: 'sw_vers -productVersion', print_all: false, print_command: false)
226
+
227
+ if Gem::Version.new(os_version) >= Gem::Version.new('10.12.0')
228
+ copy_logarchive(device, log_identity, logs_destination_dir)
229
+ else
230
+ copy_logfile(device, log_identity, logs_destination_dir)
231
+ end
232
+ end
233
+
234
+ private
235
+
236
+ def copy_logfile(device, log_identity, logs_destination_dir)
237
+ logfile_src = File.expand_path("~/Library/Logs/CoreSimulator/#{device.udid}/system.log")
238
+ return unless File.exist?(logfile_src)
239
+
240
+ FileUtils.mkdir_p(logs_destination_dir)
241
+ logfile_dst = File.join(logs_destination_dir, "system-#{log_identity}.log")
242
+
243
+ FileUtils.rm_f(logfile_dst)
244
+ FileUtils.cp(logfile_src, logfile_dst)
245
+ UI.success "Copying file '#{logfile_src}' to '#{logfile_dst}'..."
246
+ end
247
+
248
+ def copy_logarchive(device, log_identity, logs_destination_dir)
249
+ sim_resource_dir = FastlaneCore::CommandExecutor.execute(command: "xcrun simctl getenv #{device.udid} SIMULATOR_SHARED_RESOURCES_DIRECTORY 2>/dev/null", print_all: false, print_command: true)
250
+ logarchive_src = File.join(sim_resource_dir, "system_logs.logarchive")
251
+ logarchive_dst = File.join(logs_destination_dir, "system_logs-#{log_identity}.logarchive")
252
+
253
+ # if logarchive already exists it fails as the .logarchive is a directory, so delete it. to be sure its gone
254
+ FileUtils.rm_rf(logarchive_src)
255
+ FileUtils.rm_rf(logarchive_dst)
256
+
257
+ command = "xcrun simctl spawn #{device.udid} log collect 2>/dev/null"
258
+ FastlaneCore::CommandExecutor.execute(command: command, print_all: false, print_command: true)
259
+
260
+ FileUtils.mkdir_p(logarchive_dst)
261
+ FileUtils.cp_r("#{logarchive_src}/.", logarchive_dst)
262
+ UI.success "Copying file '#{logarchive_src}' to '#{logarchive_dst}'..."
236
263
  end
237
264
  end
238
265
  end