fastlane 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/bin/fastlane +16 -16
  3. data/lib/assets/custom_action_template.rb +2 -2
  4. data/lib/fastlane.rb +1 -0
  5. data/lib/fastlane/action.rb +5 -6
  6. data/lib/fastlane/action_collector.rb +6 -6
  7. data/lib/fastlane/actions/actions_helper.rb +12 -74
  8. data/lib/fastlane/actions/add_git_tag.rb +2 -2
  9. data/lib/fastlane/actions/appstore.rb +2 -2
  10. data/lib/fastlane/actions/backup_file.rb +2 -2
  11. data/lib/fastlane/actions/backup_xcarchive.rb +11 -12
  12. data/lib/fastlane/actions/bundle_install.rb +5 -1
  13. data/lib/fastlane/actions/chatwork.rb +12 -12
  14. data/lib/fastlane/actions/clean_build_artifacts.rb +4 -6
  15. data/lib/fastlane/actions/clipboard.rb +1 -1
  16. data/lib/fastlane/actions/commit_version_bump.rb +35 -10
  17. data/lib/fastlane/actions/crashlytics.rb +26 -26
  18. data/lib/fastlane/actions/create_keychain.rb +6 -6
  19. data/lib/fastlane/actions/default_platform.rb +1 -1
  20. data/lib/fastlane/actions/delete_keychain.rb +3 -3
  21. data/lib/fastlane/actions/deliver.rb +3 -3
  22. data/lib/fastlane/actions/deploygate.rb +19 -18
  23. data/lib/fastlane/actions/dsym_zip.rb +7 -9
  24. data/lib/fastlane/actions/ensure_git_branch.rb +2 -3
  25. data/lib/fastlane/actions/ensure_no_debug_code.rb +8 -8
  26. data/lib/fastlane/actions/fastlane_version.rb +4 -2
  27. data/lib/fastlane/actions/frameit.rb +7 -7
  28. data/lib/fastlane/actions/gcovr.rb +5 -4
  29. data/lib/fastlane/actions/get_build_number.rb +27 -30
  30. data/lib/fastlane/actions/get_github_release.rb +11 -11
  31. data/lib/fastlane/actions/get_version_number.rb +28 -30
  32. data/lib/fastlane/actions/git_branch.rb +1 -2
  33. data/lib/fastlane/actions/gym.rb +2 -2
  34. data/lib/fastlane/actions/hg_commit_version_bump.rb +28 -6
  35. data/lib/fastlane/actions/hg_push.rb +0 -1
  36. data/lib/fastlane/actions/hipchat.rb +20 -20
  37. data/lib/fastlane/actions/hockey.rb +16 -17
  38. data/lib/fastlane/actions/import.rb +1 -2
  39. data/lib/fastlane/actions/import_certificate.rb +1 -1
  40. data/lib/fastlane/actions/import_from_git.rb +6 -2
  41. data/lib/fastlane/actions/increment_build_number.rb +25 -28
  42. data/lib/fastlane/actions/increment_version_number.rb +55 -57
  43. data/lib/fastlane/actions/install_carthage.rb +10 -11
  44. data/lib/fastlane/actions/install_cocoapods.rb +3 -3
  45. data/lib/fastlane/actions/ipa.rb +8 -6
  46. data/lib/fastlane/actions/is_ci.rb +37 -0
  47. data/lib/fastlane/actions/lane_context.rb +2 -2
  48. data/lib/fastlane/actions/last_git_tag.rb +1 -1
  49. data/lib/fastlane/actions/lcov.rb +28 -31
  50. data/lib/fastlane/actions/mailgun.rb +11 -42
  51. data/lib/fastlane/actions/oclint.rb +10 -13
  52. data/lib/fastlane/actions/pem.rb +2 -2
  53. data/lib/fastlane/actions/pilot.rb +4 -2
  54. data/lib/fastlane/actions/prompt.rb +6 -6
  55. data/lib/fastlane/actions/push_git_tags.rb +38 -0
  56. data/lib/fastlane/actions/push_to_git_remote.rb +4 -1
  57. data/lib/fastlane/actions/puts.rb +1 -1
  58. data/lib/fastlane/actions/register_devices.rb +4 -3
  59. data/lib/fastlane/actions/reset_git_repo.rb +6 -6
  60. data/lib/fastlane/actions/resign.rb +4 -5
  61. data/lib/fastlane/actions/restore_file.rb +2 -2
  62. data/lib/fastlane/actions/s3.rb +19 -22
  63. data/lib/fastlane/actions/set_build_number_repository.rb +26 -36
  64. data/lib/fastlane/actions/set_changelog.rb +4 -4
  65. data/lib/fastlane/actions/set_github_release.rb +10 -11
  66. data/lib/fastlane/actions/sigh.rb +1 -1
  67. data/lib/fastlane/actions/slack.rb +85 -74
  68. data/lib/fastlane/actions/snapshot.rb +2 -2
  69. data/lib/fastlane/actions/team_id.rb +2 -1
  70. data/lib/fastlane/actions/team_name.rb +2 -1
  71. data/lib/fastlane/actions/testflight.rb +2 -2
  72. data/lib/fastlane/actions/testmunk.rb +16 -16
  73. data/lib/fastlane/actions/typetalk.rb +14 -14
  74. data/lib/fastlane/actions/update_app_group_identifiers.rb +17 -17
  75. data/lib/fastlane/actions/update_fastlane.rb +16 -14
  76. data/lib/fastlane/actions/update_info_plist.rb +14 -16
  77. data/lib/fastlane/actions/update_project_code_signing.rb +3 -3
  78. data/lib/fastlane/actions/update_project_provisioning.rb +48 -36
  79. data/lib/fastlane/actions/xcode_select.rb +4 -3
  80. data/lib/fastlane/actions/xcode_server_get_assets.rb +23 -24
  81. data/lib/fastlane/actions/xcodebuild.rb +13 -13
  82. data/lib/fastlane/actions/xctool.rb +2 -2
  83. data/lib/fastlane/actions_list.rb +27 -29
  84. data/lib/fastlane/command_line_handler.rb +13 -14
  85. data/lib/fastlane/configuration_helper.rb +18 -20
  86. data/lib/fastlane/core_ext/string.rb +2 -2
  87. data/lib/fastlane/docs_generator.rb +33 -32
  88. data/lib/fastlane/erb_template_helper.rb +1 -1
  89. data/lib/fastlane/fast_file.rb +27 -18
  90. data/lib/fastlane/fastlane_folder.rb +1 -1
  91. data/lib/fastlane/helper/git_helper.rb +27 -0
  92. data/lib/fastlane/helper/sh_helper.rb +48 -0
  93. data/lib/fastlane/junit_generator.rb +1 -1
  94. data/lib/fastlane/lane.rb +6 -6
  95. data/lib/fastlane/lane_list.rb +12 -13
  96. data/lib/fastlane/lane_manager.rb +17 -11
  97. data/lib/fastlane/new_action.rb +1 -1
  98. data/lib/fastlane/runner.rb +23 -24
  99. data/lib/fastlane/setup.rb +16 -17
  100. data/lib/fastlane/supported_platforms.rb +2 -2
  101. data/lib/fastlane/version.rb +1 -1
  102. metadata +16 -12
@@ -0,0 +1,27 @@
1
+ module Fastlane
2
+ module Actions
3
+ # Get the author name of the last git commit
4
+ def self.git_author
5
+ s = `git log --name-status HEAD^..HEAD`
6
+ s = s.match(/Author:.*<(.*)>/)[1]
7
+ return s if s.to_s.length > 0
8
+ return nil
9
+ rescue
10
+ return nil
11
+ end
12
+
13
+ def self.last_git_commit
14
+ s = `git log -1 --pretty=%B`.strip
15
+ return s if s.to_s.length > 0
16
+ nil
17
+ end
18
+
19
+ # Returns the current git branch - can be replaced using the environment variable `GIT_BRANCH`
20
+ def self.git_branch
21
+ return ENV['GIT_BRANCH'] if ENV['GIT_BRANCH'].to_s.length > 0 # set by Jenkins
22
+ s = `git rev-parse --abbrev-ref HEAD`
23
+ return s.to_s.strip if s.to_s.length > 0
24
+ nil
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,48 @@
1
+ module Fastlane
2
+ module Actions
3
+ # Execute a shell command
4
+ # This method will output the string and execute it
5
+ # Just an alias for sh_no_action
6
+ # @param log [boolean] should fastlane print out the executed command
7
+ def self.sh(command, log: true)
8
+ sh_no_action(command, log: log)
9
+ end
10
+
11
+ def self.sh_no_action(command, log: true)
12
+ # Set the encoding first, the user might have set it wrong
13
+ previous_encoding = [Encoding.default_external, Encoding.default_internal]
14
+ Encoding.default_external = Encoding::UTF_8
15
+ Encoding.default_internal = Encoding::UTF_8
16
+
17
+ command = command.join(' ') if command.kind_of?(Array) # since it's an array of one element when running from the Fastfile
18
+ Helper.log.info ['[SHELL COMMAND]', command.yellow].join(': ') if log
19
+
20
+ result = ''
21
+ if Helper.test?
22
+ result << command # only for the tests
23
+ else
24
+ exit_status = nil
25
+ IO.popen(command, err: [:child, :out]) do |io|
26
+ io.each do |line|
27
+ Helper.log.info ['[SHELL]', line.strip].join(': ')
28
+ result << line
29
+ end
30
+ io.close
31
+ exit_status = $?.exitstatus
32
+ end
33
+
34
+ if exit_status != 0
35
+ # this will also append the output to the exception
36
+ raise "Exit status of command '#{command}' was #{exit_status} instead of 0. \n#{result}"
37
+ end
38
+ end
39
+
40
+ result
41
+ rescue => ex
42
+ raise ex
43
+ ensure
44
+ Encoding.default_external = previous_encoding.first
45
+ Encoding.default_internal = previous_encoding.last
46
+ end
47
+ end
48
+ end
@@ -21,7 +21,7 @@ module Fastlane
21
21
  end
22
22
  end
23
23
  end
24
- result = builder.to_xml.gsub('system_', 'system-').gsub("", ' ') # Jenkins can not parse 'ESC' symbol
24
+ result = builder.to_xml.gsub('system_', 'system-').delete("\e") # Jenkins can not parse 'ESC' symbol
25
25
 
26
26
  File.write(path, result)
27
27
 
@@ -15,15 +15,15 @@ module Fastlane
15
15
  attr_accessor :is_private
16
16
 
17
17
  def initialize(platform: nil, name: nil, description: nil, block: nil, is_private: false)
18
- raise "description must be an array" unless description.kind_of?Array
19
- raise "lane name must not contain any spaces".red if name.to_s.include?" "
20
- raise "lane name must start with :".red unless name.kind_of?Symbol
18
+ raise "description must be an array" unless description.kind_of? Array
19
+ raise "lane name must not contain any spaces".red if name.to_s.include? " "
20
+ raise "lane name must start with :".red unless name.kind_of? Symbol
21
21
 
22
22
  if self.class.black_list.include?(name.to_s)
23
23
  Helper.log.error "Lane Name '#{name}' can not be one of the followings: #{self.class.black_list}".red
24
24
  raise "Name '#{name}' is already taken"
25
25
  end
26
-
26
+
27
27
  self.platform = platform
28
28
  self.name = name
29
29
  self.description = description
@@ -43,8 +43,8 @@ module Fastlane
43
43
 
44
44
  class << self
45
45
  def black_list
46
- %w{run init new_action lanes list docs action actions help}
46
+ %w(run init new_action lanes list docs action actions help)
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -2,7 +2,6 @@ module Fastlane
2
2
  class LaneList
3
3
  # Print out the result of `generate`
4
4
  def self.output(path)
5
-
6
5
  puts generate(path)
7
6
 
8
7
  puts "Execute using `fastlane [lane_name]`".yellow
@@ -11,29 +10,29 @@ module Fastlane
11
10
  def self.generate(path)
12
11
  ff = Fastlane::FastFile.new(path)
13
12
  output = ""
14
-
15
- all_keys = ff.runner.lanes.keys.reject(&:nil?)
13
+
14
+ all_keys = ff.runner.lanes.keys.reject(&:nil?)
16
15
  all_keys.unshift(nil) # because we want root elements on top. always! They have key nil
17
16
 
18
17
  all_keys.each do |platform|
19
18
  next if (ff.runner.lanes[platform] || []).count == 0
19
+
20
20
  plat_text = platform
21
21
  plat_text = "general" if platform.to_s.empty?
22
22
  output += "\n--------- #{plat_text}---------\n".yellow
23
-
23
+
24
24
  value = ff.runner.lanes[platform]
25
-
26
- if value
27
- value.each do |lane_name, lane|
28
- next if lane.is_private
29
-
30
- output += "----- fastlane #{lane.pretty_name}".green
31
- output += "\n" + lane.description.join("\n") + "\n\n" if lane.description.count > 0
32
- end
25
+ next unless value
26
+
27
+ value.each do |lane_name, lane|
28
+ next if lane.is_private
29
+
30
+ output += "----- fastlane #{lane.pretty_name}".green
31
+ output += "\n" + lane.description.join("\n") + "\n\n" if lane.description.count > 0
33
32
  end
34
33
  end
35
34
 
36
35
  output
37
36
  end
38
37
  end
39
- end
38
+ end
@@ -5,23 +5,29 @@ module Fastlane
5
5
  # @param parameters [Hash] The parameters passed from the command line to the lane
6
6
  # @param env Dot Env Information
7
7
  def self.cruise_lane(platform, lane, parameters = nil, env = nil)
8
- raise 'lane must be a string' unless (lane.is_a?(String) or lane.nil?)
9
- raise 'platform must be a string' unless (platform.is_a?(String) or platform.nil?)
10
- raise 'parameters must be a hash' unless (parameters.is_a?(Hash) or parameters.nil?)
8
+ raise 'lane must be a string' unless lane.kind_of?(String) or lane.nil?
9
+ raise 'platform must be a string' unless platform.kind_of?(String) or platform.nil?
10
+ raise 'parameters must be a hash' unless parameters.kind_of?(Hash) or parameters.nil?
11
11
 
12
12
  ff = Fastlane::FastFile.new(File.join(Fastlane::FastlaneFolder.path, 'Fastfile'))
13
13
 
14
- unless (ff.is_platform_block?lane rescue false) # rescue, because this raises an exception if it can't be found at all
14
+ is_platform = false
15
+ begin
16
+ is_platform = ff.is_platform_block? lane
17
+ rescue
18
+ end
19
+
20
+ unless is_platform # rescue, because this raises an exception if it can't be found at all
15
21
  # maybe the user specified a default platform
16
22
  # We'll only do this, if the lane specified isn't a platform, as we want to list all platforms then
17
23
 
18
24
  platform ||= Actions.lane_context[Actions::SharedValues::DEFAULT_PLATFORM]
19
25
  end
20
26
 
21
- if not platform and lane
27
+ if !platform and lane
22
28
  # Either, the user runs a specific lane in root or want to auto complete the available lanes for a platform
23
29
  # e.g. `fastlane ios` should list all available iOS actions
24
- if ff.is_platform_block?lane
30
+ if ff.is_platform_block? lane
25
31
  platform = lane
26
32
  lane = nil
27
33
  end
@@ -57,15 +63,15 @@ module Fastlane
57
63
  Fastlane::JUnitGenerator.generate(Fastlane::Actions.executed_actions)
58
64
  print_table(Fastlane::Actions.executed_actions)
59
65
 
60
- unless error
66
+ if error
67
+ Helper.log.fatal 'fastlane finished with errors'.red
68
+ raise error
69
+ else
61
70
  if duration > 5
62
71
  Helper.log.info "fastlane.tools just saved you #{duration} minutes! 🎉".green
63
72
  else
64
73
  Helper.log.info 'fastlane.tools finished successfully 🎉'.green
65
74
  end
66
- else
67
- Helper.log.fatal 'fastlane finished with errors'.red
68
- raise error
69
75
  end
70
76
  end
71
77
 
@@ -100,7 +106,7 @@ module Fastlane
100
106
  end
101
107
 
102
108
  i = $stdin.gets.strip.to_i - 1
103
- if i >= 0 and (available[i] rescue nil)
109
+ if i >= 0 and available[i]
104
110
  selection = available[i]
105
111
  Helper.log.info "Driving the lane #{selection}. Next time launch fastlane using `fastlane #{selection}`".yellow
106
112
  platform = selection.split(' ')[0]
@@ -10,7 +10,7 @@ module Fastlane
10
10
  puts "Must be lower case, and use a '_' between words. Do not use '.'".green
11
11
  puts "examples: 'testflight', 'upload_to_s3'".green
12
12
  name = ask('Name of your action: ')
13
- while !name_valid?(name)
13
+ until name_valid?(name)
14
14
  puts 'Name invalid!'
15
15
  name = ask('Name of your action: ')
16
16
  end
@@ -18,13 +18,14 @@ module Fastlane
18
18
  # @param lane_name The name of the lane to execute
19
19
  # @param platform The name of the platform to execute
20
20
  # @param parameters [Hash] The parameters passed from the command line to the lane
21
+ # rubocop:disable Metrics/CyclomaticComplexity
22
+ # rubocop:disable Metrics/AbcSize
21
23
  def execute(lane, platform = nil, parameters = nil)
22
24
  raise "No lane given" unless lane
23
25
 
24
26
  self.current_lane = lane.to_sym
25
27
  self.current_platform = (platform ? platform.to_sym : nil)
26
28
 
27
-
28
29
  lane_obj = lanes.fetch(current_platform, {}).fetch(current_lane, nil)
29
30
 
30
31
  raise "Could not find lane '#{full_lane_name}'. Available lanes: #{available_lanes.join(', ')}".red unless lane_obj
@@ -32,7 +33,7 @@ module Fastlane
32
33
 
33
34
  ENV["FASTLANE_LANE_NAME"] = current_lane.to_s
34
35
  ENV["FASTLANE_PLATFORM_NAME"] = (current_platform ? current_platform.to_s : nil)
35
-
36
+
36
37
  Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] = current_platform
37
38
  Actions.lane_context[Actions::SharedValues::LANE_NAME] = full_lane_name
38
39
 
@@ -43,17 +44,16 @@ module Fastlane
43
44
  path_to_use = Fastlane::FastlaneFolder.path || Dir.pwd
44
45
  begin
45
46
  Dir.chdir(path_to_use) do # the file is located in the fastlane folder
46
-
47
47
  # Call the platform specific before_all block and then the general one
48
- before_all_blocks[current_platform].call(current_lane) if (before_all_blocks[current_platform] and current_platform)
48
+ before_all_blocks[current_platform].call(current_lane) if before_all_blocks[current_platform] && current_platform
49
49
  before_all_blocks[nil].call(current_lane) if before_all_blocks[nil]
50
-
50
+
51
51
  return_val = lane_obj.call(parameters || {}) # by default no parameters
52
-
52
+
53
53
  # `after_all` is only called if no exception was raised before
54
54
  # Call the platform specific before_all block and then the general one
55
- after_all_blocks[current_platform].call(current_lane) if (after_all_blocks[current_platform] and current_platform)
56
- after_all_blocks[nil].call(current_lane) if (after_all_blocks[nil])
55
+ after_all_blocks[current_platform].call(current_lane) if after_all_blocks[current_platform] && current_platform
56
+ after_all_blocks[nil].call(current_lane) if after_all_blocks[nil]
57
57
  end
58
58
 
59
59
  return return_val
@@ -62,19 +62,21 @@ module Fastlane
62
62
  # Provide error block exception without colour code
63
63
  error_ex = ex.exception(ex.message.gsub(/\033\[\d+m/, ''))
64
64
 
65
- error_blocks[current_platform].call(current_lane, error_ex) if (error_blocks[current_platform] and current_platform)
65
+ error_blocks[current_platform].call(current_lane, error_ex) if error_blocks[current_platform] && current_platform
66
66
  error_blocks[nil].call(current_lane, error_ex) if error_blocks[nil]
67
67
  end
68
68
  raise ex
69
69
  end
70
70
  end
71
+ # rubocop:enable Metrics/CyclomaticComplexity
72
+ # rubocop:enable Metrics/AbcSize
71
73
 
72
74
  # @param filter_platform: Filter, to only show the lanes of a given platform
73
75
  # @return an array of lanes (platform lane_name) to print them out to the user
74
76
  def available_lanes(filter_platform = nil)
75
77
  all = []
76
78
  lanes.each do |platform, platform_lanes|
77
- next if (filter_platform and filter_platform.to_s != platform.to_s) # skip actions that don't match
79
+ next if filter_platform && filter_platform.to_s != platform.to_s # skip actions that don't match
78
80
 
79
81
  platform_lanes.each do |lane_name, lane|
80
82
  all << [platform, lane_name].reject(&:nil?).join(' ') unless lane.is_private
@@ -83,9 +85,9 @@ module Fastlane
83
85
  all
84
86
  end
85
87
 
86
- #
88
+ #
87
89
  # All the methods that are usually called on execution
88
- #
90
+ #
89
91
 
90
92
  def try_switch_to_lane(new_lane, parameters)
91
93
  block = lanes.fetch(current_platform, {}).fetch(new_lane, nil)
@@ -94,7 +96,7 @@ module Fastlane
94
96
  original_full = full_lane_name
95
97
  original_lane = current_lane
96
98
 
97
- raise "Parameters for a lane must always be a hash".red unless (parameters.first || {}).kind_of?Hash
99
+ raise "Parameters for a lane must always be a hash".red unless (parameters.first || {}).kind_of? Hash
98
100
 
99
101
  pretty = [new_lane]
100
102
  pretty = [current_platform, new_lane] if current_platform
@@ -102,10 +104,10 @@ module Fastlane
102
104
  Helper.log.info "Cruising over to lane '#{pretty.join(' ')}' 🚖".green
103
105
 
104
106
  # Actually switch lane now
105
- current_lane = new_lane
107
+ self.current_lane = new_lane
106
108
  collector.did_launch_action(:lane_switch)
107
109
  result = block.call(parameters.first || {}) # to always pass a hash
108
- current_lane = original_lane
110
+ self.current_lane = original_lane
109
111
 
110
112
  Helper.log.info "Cruising back to lane '#{original_full}' 🚘".green
111
113
  return result
@@ -119,9 +121,6 @@ module Fastlane
119
121
  def execute_action(method_sym, class_ref, arguments)
120
122
  collector.did_launch_action(method_sym)
121
123
 
122
- step_name = class_ref.step_text rescue nil
123
- step_name = method_sym.to_s unless step_name
124
-
125
124
  verify_supported_os(method_sym, class_ref)
126
125
 
127
126
  begin
@@ -129,11 +128,11 @@ module Fastlane
129
128
  Actions.execute_action(class_ref.step_text) do
130
129
  # arguments is an array by default, containing an hash with the actual parameters
131
130
  # Since we usually just need the passed hash, we'll just use the first object if there is only one
132
- if arguments.count == 0
131
+ if arguments.count == 0
133
132
  arguments = ConfigurationHelper.parse(class_ref, {}) # no parameters => empty hash
134
- elsif arguments.count == 1 and arguments.first.kind_of?Hash
133
+ elsif arguments.count == 1 and arguments.first.kind_of? Hash
135
134
  arguments = ConfigurationHelper.parse(class_ref, arguments.first) # Correct configuration passed
136
- elsif not class_ref.available_options
135
+ elsif !class_ref.available_options
137
136
  # This action does not use the new action format
138
137
  # Just passing the arguments to this method
139
138
  else
@@ -156,7 +155,7 @@ module Fastlane
156
155
  platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
157
156
 
158
157
  unless class_ref.is_supported?(platform)
159
- raise "Action '#{name}' doesn't support required operating system '#{platform}'.".red
158
+ raise "Action '#{name}' doesn't support required operating system '#{platform}'.".red
160
159
  end
161
160
  end
162
161
  end
@@ -172,7 +171,7 @@ module Fastlane
172
171
  end
173
172
 
174
173
  # Called internally to setup the runner object
175
- #
174
+ #
176
175
 
177
176
  # @param lane [Lane] A lane object
178
177
  def add_lane(lane, override = false)
@@ -181,7 +180,7 @@ module Fastlane
181
180
  if !override and lanes[lane.platform][lane.name]
182
181
  raise "Lane '#{lane.name}' was defined multiple times!".red
183
182
  end
184
-
183
+
185
184
  lanes[lane.platform][lane.name] = lane
186
185
  end
187
186
 
@@ -1,9 +1,11 @@
1
- # rubocop:disable Metrics/LineLength
2
-
3
1
  module Fastlane
4
2
  class Setup
3
+
4
+ # the tools that are already enabled
5
+ attr_reader :tools
6
+
5
7
  def run
6
- if (FastlaneFolder.setup? and not Helper.is_test?)
8
+ if FastlaneFolder.setup? and !Helper.is_test?
7
9
  Helper.log.info "Fastlane already set up at path #{folder}".yellow
8
10
  return
9
11
  end
@@ -14,6 +16,7 @@ module Fastlane
14
16
  response = agree('Do you have everything commited in version control? If not please do so! (y/n)'.yellow, true)
15
17
  return unless response
16
18
 
19
+ # rubocop:disable Lint/RescueException
17
20
  begin
18
21
  FastlaneFolder.create_folder! unless Helper.is_test?
19
22
  copy_existing_files
@@ -31,6 +34,7 @@ module Fastlane
31
34
  restore_previous_state
32
35
  raise ex
33
36
  end
37
+ # rubocop:enable Lint/RescueException
34
38
  end
35
39
 
36
40
  def show_infos
@@ -66,7 +70,7 @@ module Fastlane
66
70
  def generate_app_metadata
67
71
  Helper.log.info '------------------------------'
68
72
  Helper.log.info 'To not re-enter your username and app identifier every time you run one of the fastlane tools or fastlane, these will be stored from now on.'.green
69
-
73
+
70
74
  app_identifier = ask('App Identifier (com.krausefx.app): '.yellow)
71
75
  apple_id = ask('Your Apple ID (fastlane@krausefx.com): '.yellow)
72
76
 
@@ -88,14 +92,7 @@ module Fastlane
88
92
  end
89
93
 
90
94
  def ask_to_enable_other_tools
91
- unless @tools[:deliver]
92
- if agree("Do you want to setup 'deliver', which is used to upload app screenshots, app metadata and app updates to the App Store or Apple TestFlight? (y/n)".yellow, true)
93
- Helper.log.info "Loading up 'deliver', this might take a few seconds"
94
- require 'deliver'
95
- Deliver::DeliverfileCreator.create(folder)
96
- @tools[:deliver] = true
97
- end
98
- else
95
+ if @tools[:deliver]
99
96
  # deliver already enabled
100
97
  Helper.log.info '-------------------------------------------------------------------------------------------'
101
98
  Helper.log.info 'Since all files are moved into the `fastlane` subfolder, you have to adapt your Deliverfile'.yellow
@@ -103,6 +100,13 @@ module Fastlane
103
100
  Helper.log.info "e.g. `system('cd ..; ipa build')`".yellow
104
101
  Helper.log.info 'Please read the above carefully and hit Enter to confirm.'.green
105
102
  STDIN.gets unless Helper.is_test?
103
+ else
104
+ if agree("Do you want to setup 'deliver', which is used to upload app screenshots, app metadata and app updates to the App Store or Apple TestFlight? (y/n)".yellow, true)
105
+ Helper.log.info "Loading up 'deliver', this might take a few seconds"
106
+ require 'deliver'
107
+ Deliver::DeliverfileCreator.create(folder)
108
+ @tools[:deliver] = true
109
+ end
106
110
  end
107
111
 
108
112
  unless @tools[:snapshot]
@@ -129,7 +133,6 @@ module Fastlane
129
133
  template.gsub!('[[SCHEME]]', "")
130
134
  end
131
135
 
132
-
133
136
  template.gsub!('deliver', '# deliver') unless @tools[:deliver]
134
137
  template.gsub!('snapshot', '# snapshot') unless @tools[:snapshot]
135
138
  template.gsub!('sigh', '# sigh') unless @tools[:sigh]
@@ -151,10 +154,6 @@ module Fastlane
151
154
  FastlaneFolder.path
152
155
  end
153
156
 
154
- def tools
155
- @tools
156
- end
157
-
158
157
  def restore_previous_state
159
158
  # Move all moved files back
160
159
  files_to_copy.each do |current|