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
@@ -6,36 +6,34 @@ module Fastlane
6
6
  class UpdateInfoPlistAction < Action
7
7
  def self.run(params)
8
8
  require 'plist'
9
-
9
+
10
10
  # Check if parameters are set
11
11
  if params[:app_identifier] or params[:display_name]
12
-
12
+
13
13
  # Assign folder from parameter or search for xcodeproj file
14
14
  folder = params[:xcodeproj] || Dir["*.xcodeproj"].first
15
-
16
- # Read existing plist file
15
+
16
+ # Read existing plist file
17
17
  info_plist_path = File.join(folder, "..", params[:plist_path])
18
- raise "Couldn't find info plist file at path '#{params[:plist_path]}'".red unless File.exists?(info_plist_path)
19
- plist = Plist::parse_xml(info_plist_path)
20
-
18
+ raise "Couldn't find info plist file at path '#{params[:plist_path]}'".red unless File.exist?(info_plist_path)
19
+ plist = Plist.parse_xml(info_plist_path)
20
+
21
21
  # Update plist values
22
22
  plist['CFBundleIdentifier'] = params[:app_identifier] if params[:app_identifier]
23
23
  plist['CFBundleDisplayName'] = params[:display_name] if params[:display_name]
24
-
24
+
25
25
  # Write changes to file
26
26
  plist_string = Plist::Emit.dump(plist)
27
27
  File.write(info_plist_path, plist_string)
28
-
28
+
29
29
  Helper.log.info "Updated #{params[:plist_path]} 💾.".green
30
30
  plist_string
31
31
  else
32
32
  Helper.log.warn("You haven't specified any parameters to update your plist.")
33
33
  false
34
34
  end
35
-
36
35
  end
37
36
 
38
-
39
37
  #####################################################
40
38
  # @!group Documentation
41
39
  #####################################################
@@ -50,19 +48,19 @@ module Fastlane
50
48
 
51
49
  def self.available_options
52
50
  [
53
-
51
+
54
52
  FastlaneCore::ConfigItem.new(key: :xcodeproj,
55
53
  env_name: "FL_UPDATE_PLIST_PROJECT_PATH",
56
54
  description: "Path to your Xcode project",
57
55
  optional: true,
58
- verify_block: Proc.new do |value|
59
- raise "Please pass the path to the project, not the workspace".red if value.include?"workspace"
60
- raise "Could not find Xcode project".red unless File.exists?(value)
56
+ verify_block: proc do |value|
57
+ raise "Please pass the path to the project, not the workspace".red if value.include? "workspace"
58
+ raise "Could not find Xcode project".red unless File.exist?(value)
61
59
  end),
62
60
  FastlaneCore::ConfigItem.new(key: :plist_path,
63
61
  env_name: "FL_UPDATE_PLIST_PATH",
64
62
  description: "Path to info plist",
65
- verify_block: Proc.new do |value|
63
+ verify_block: proc do |value|
66
64
  raise "Invalid plist file".red unless value[-6..-1].downcase == ".plist"
67
65
  end),
68
66
  FastlaneCore::ConfigItem.new(key: :app_identifier,
@@ -7,7 +7,7 @@ module Fastlane
7
7
  def self.run(params)
8
8
  path = params[:path]
9
9
  path = File.join(path, "project.pbxproj")
10
- raise "Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!".red unless File.exists?(path)
10
+ raise "Could not find path to project config '#{path}'. Pass the path to your project (not workspace)!".red unless File.exist?(path)
11
11
 
12
12
  Helper.log.info("Updating provisioning profile UDID (#{params[:udid]}) for the given project '#{path}'")
13
13
 
@@ -30,8 +30,8 @@ module Fastlane
30
30
  FastlaneCore::ConfigItem.new(key: :path,
31
31
  env_name: "FL_PROJECT_SIGNING_PROJECT_PATH",
32
32
  description: "Path to your Xcode project",
33
- verify_block: Proc.new do |value|
34
- raise "Path is invalid".red unless File.exists?(value)
33
+ verify_block: proc do |value|
34
+ raise "Path is invalid".red unless File.exist?(value)
35
35
  end),
36
36
  FastlaneCore::ConfigItem.new(key: :udid,
37
37
  env_name: "FL_PROJECT_SIGNING_UDID",
@@ -1,22 +1,21 @@
1
+ # rubocop:disable Metrics/AbcSize
1
2
  module Fastlane
2
3
  module Actions
3
4
  module SharedValues
4
-
5
5
  end
6
6
 
7
7
  class UpdateProjectProvisioningAction < Action
8
8
  ROOT_CERTIFICATE_URL = "http://www.apple.com/appleca/AppleIncRootCertificate.cer"
9
9
  def self.run(params)
10
-
11
10
  # assign folder from parameter or search for xcodeproj file
12
11
  folder = params[:xcodeproj] || Dir["*.xcodeproj"].first
13
-
12
+
14
13
  # validate folder
15
- folder = File.join(folder, "project.pbxproj")
16
- raise "Could not find path to project config '#{folder}'. Pass the path to your project (not workspace)!".red unless File.exists?(folder)
14
+ project_file_path = File.join(folder, "project.pbxproj")
15
+ raise "Could not find path to project config '#{project_file_path}'. Pass the path to your project (not workspace)!".red unless File.exist?(project_file_path)
17
16
 
18
17
  # download certificate
19
- if not File.exists?(params[:certificate])
18
+ unless File.exist?(params[:certificate])
20
19
  Helper.log.info("Downloading root certificate from (#{ROOT_CERTIFICATE_URL}) to path '#{params[:certificate]}'")
21
20
  require 'open-uri'
22
21
  File.open(params[:certificate], "w") do |file|
@@ -29,38 +28,42 @@ module Fastlane
29
28
  profile = File.read(params[:profile])
30
29
  p7 = OpenSSL::PKCS7.new(profile)
31
30
  store = OpenSSL::X509::Store.new
32
- raise "Could not find valid certificate at '#{params[:certificate]}'" unless (File.size(params[:certificate]) > 0)
31
+ raise "Could not find valid certificate at '#{params[:certificate]}'" unless File.size(params[:certificate]) > 0
33
32
  cert = OpenSSL::X509::Certificate.new(File.read(params[:certificate]))
34
33
  store.add_cert(cert)
35
- verification = p7.verify([cert], store)
36
- data = Plist::parse_xml(p7.data)
37
-
38
- filter = params[:build_configuration_filter]
34
+ p7.verify([cert], store)
35
+ data = Plist.parse_xml(p7.data)
36
+
37
+ target_filter = params[:target_filter] || params[:build_configuration_filter]
38
+ configuration = params[:build_configuration]
39
39
 
40
40
  # manipulate project file
41
41
  Helper.log.info("Going to update project '#{folder}' with UUID".green)
42
- require 'pbxplorer'
42
+ require 'xcodeproj'
43
43
 
44
- project_file = XCProjectFile.new(folder)
45
- project_file.project.targets.each do |target|
46
- if filter
47
- if target['productName'].match(filter) or target['productType'].match(filter)
48
- Helper.log.info "Updating target #{target['productName']}...".green
49
- else
50
- Helper.log.info "Skipping target #{target['productName']} as it doesn't match the filter '#{filter}'".yellow
51
- next
52
- end
44
+ project = Xcodeproj::Project.open(folder)
45
+ project.targets.each do |target|
46
+ if !target_filter || target.product_name.match(target_filter) || target.product_type.match(target_filter)
47
+ Helper.log.info "Updating target #{target.product_name}...".green
53
48
  else
54
- Helper.log.info "Updating target #{target['productName']}...".green
49
+ Helper.log.info "Skipping target #{target.product_name} as it doesn't match the filter '#{target_filter}'".yellow
50
+ next
55
51
  end
56
52
 
57
53
  target.build_configuration_list.build_configurations.each do |build_configuration|
58
- build_configuration["buildSettings"]["PROVISIONING_PROFILE"] = data["UUID"]
59
- build_configuration["buildSettings"]["CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]"] = "$(SDKROOT)/ResourceRules.plist"
54
+ config_name = build_configuration.name
55
+ if !configuration || config_name.match(configuration)
56
+ Helper.log.info "Updating configuration #{config_name}...".green
57
+ else
58
+ Helper.log.info "Skipping configuration #{config_name} as it doesn't match the filter '#{configuration}'".yellow
59
+ next
60
+ end
61
+
62
+ build_configuration.build_settings["PROVISIONING_PROFILE"] = data["UUID"]
60
63
  end
61
64
  end
62
65
 
63
- project_file.save
66
+ project.save
64
67
 
65
68
  # complete
66
69
  Helper.log.info("Successfully updated project settings in'#{params[:xcodeproj]}'".green)
@@ -74,10 +77,10 @@ module Fastlane
74
77
  [
75
78
  "This action retrieves a provisioning profile UUID from a provisioning profile (.mobileprovision) to set",
76
79
  "up the xcode projects' code signing settings in *.xcodeproj/project.pbxproj",
77
- "",
78
- "The `build_configuration_filter` value can be used to only update code signing for one target",
80
+ "The `target_filter` value can be used to only update code signing for specified targets",
81
+ "The `build_configuration` value can be used to only update code signing for specified build configurations of the targets passing through the `target_filter`",
79
82
  "Example Usage is the WatchKit Extension or WatchKit App, where you need separate provisioning profiles",
80
- "Example: `update_project_provisioning(xcodeproj: \"..\", build_configuration_filter: \".*WatchKit App.*\")"
83
+ "Example: `update_project_provisioning(xcodeproj: \"..\", target_filter: \".*WatchKit App.*\")"
81
84
  ].join("\n")
82
85
  end
83
86
 
@@ -87,19 +90,27 @@ module Fastlane
87
90
  env_name: "FL_PROJECT_PROVISIONING_PROJECT_PATH",
88
91
  description: "Path to your Xcode project",
89
92
  optional: true,
90
- verify_block: Proc.new do |value|
91
- raise "Path to xcode project is invalid".red unless File.exists?(value)
93
+ verify_block: proc do |value|
94
+ raise "Path to xcode project is invalid".red unless File.exist?(value)
92
95
  end),
93
96
  FastlaneCore::ConfigItem.new(key: :profile,
94
97
  env_name: "FL_PROJECT_PROVISIONING_PROFILE_FILE",
95
98
  description: "Path to provisioning profile (.mobileprovision)",
96
99
  default_value: Actions.lane_context[SharedValues::SIGH_PROFILE_PATH],
97
- verify_block: Proc.new do |value|
98
- raise "Path to provisioning profile is invalid".red unless File.exists?(value)
100
+ verify_block: proc do |value|
101
+ raise "Path to provisioning profile is invalid".red unless File.exist?(value)
99
102
  end),
103
+ FastlaneCore::ConfigItem.new(key: :target_filter,
104
+ env_name: "FL_PROJECT_PROVISIONING_PROFILE_TARGET_FILTER",
105
+ description: "A filter for the target name. Use a standard regex",
106
+ optional: true),
100
107
  FastlaneCore::ConfigItem.new(key: :build_configuration_filter,
101
108
  env_name: "FL_PROJECT_PROVISIONING_PROFILE_FILTER",
102
- description: "A filter for the target name. Use a standard regex",
109
+ description: "Legacy option, use 'target_filter' instead",
110
+ optional: true),
111
+ FastlaneCore::ConfigItem.new(key: :build_configuration,
112
+ env_name: "FL_PROJECT_PROVISIONING_PROFILE_BUILD_CONFIGURATION",
113
+ description: "A filter for the build configuration name. Use a standard regex. Applied to all configurations if not specified",
103
114
  optional: true),
104
115
  FastlaneCore::ConfigItem.new(key: :certificate,
105
116
  env_name: "FL_PROJECT_PROVISIONING_CERTIFICATE_PATH",
@@ -108,13 +119,14 @@ module Fastlane
108
119
  ]
109
120
  end
110
121
 
111
- def self.author
112
- "tobiasstrebitzer"
122
+ def self.authors
123
+ ["tobiasstrebitzer", "czechboy0"]
113
124
  end
114
125
 
115
126
  def self.is_supported?(platform)
116
- platform == :ios
127
+ [:ios, :mac].include? platform
117
128
  end
118
129
  end
119
130
  end
120
131
  end
132
+ # rubocop:enable Metrics/AbcSize
@@ -19,13 +19,14 @@ module Fastlane
19
19
  #
20
20
  class XcodeSelectAction < Action
21
21
  def self.run(params)
22
- xcode_path = (params.first rescue nil)
22
+ params = nil unless params.kind_of? Array
23
+ xcode_path = (params || []).first
23
24
 
24
25
  # Verify that a param was passed in
25
26
  raise "Path to Xcode application required (e.x. \"/Applications/Xcode.app\")".red unless xcode_path.to_s.length > 0
26
27
 
27
28
  # Verify that a path to a directory was passed in
28
- raise "Path '#{xcode_path}' doesn't exist".red unless Dir.exists?(xcode_path)
29
+ raise "Path '#{xcode_path}' doesn't exist".red unless Dir.exist?(xcode_path)
29
30
 
30
31
  Helper.log.info "Setting Xcode version to #{xcode_path} for all build steps"
31
32
 
@@ -41,7 +42,7 @@ module Fastlane
41
42
  end
42
43
 
43
44
  def self.is_supported?(platform)
44
- [:ios, :mac].include?platform
45
+ [:ios, :mac].include? platform
45
46
  end
46
47
  end
47
48
  end
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Metrics/AbcSize
1
2
  module Fastlane
2
3
  module Actions
3
4
  module SharedValues
@@ -12,7 +13,6 @@ module Fastlane
12
13
  require 'fileutils'
13
14
 
14
15
  def self.run(params)
15
-
16
16
  host = params[:host]
17
17
  bot_name = params[:bot_name]
18
18
  integration_number_override = params[:integration_number]
@@ -46,10 +46,10 @@ module Fastlane
46
46
  # we have our bot, get finished integrations, sorted from newest to oldest
47
47
  integrations = xcs.fetch_integrations(bot['_id']).select { |i| i['currentStep'] == 'completed' }
48
48
  raise "Failed to find any completed integration for Bot \"#{bot_name}\"".red if (integrations || []).count == 0
49
-
49
+
50
50
  # if no integration number is specified, pick the newest one (this is sorted from newest to oldest)
51
51
  if integration_number_override
52
- integration = integrations.select { |i| i['number'] == integration_number_override }.first
52
+ integration = integrations.find { |i| i['number'] == integration_number_override }
53
53
  raise "Specified integration number #{integration_number_override} does not exist.".red unless integration
54
54
  else
55
55
  integration = integrations.first
@@ -68,7 +68,7 @@ module Fastlane
68
68
  Helper.log.info "Successfully downloaded #{asset_entries.count} assets to file #{assets_path}!".green
69
69
 
70
70
  # now find the archive and unzip it
71
- zipped_archive_path = asset_entries.select { |i| i.end_with?('xcarchive.zip') }.first
71
+ zipped_archive_path = asset_entries.find { |i| i.end_with?('xcarchive.zip') }
72
72
 
73
73
  if zipped_archive_path
74
74
 
@@ -77,7 +77,7 @@ module Fastlane
77
77
  archive_file_path = File.basename(zipped_archive_path, File.extname(zipped_archive_path))
78
78
  archive_dir_path = File.dirname(zipped_archive_path)
79
79
  archive_path = File.join(archive_dir_path, archive_file_path)
80
- if File.exists?(archive_path)
80
+ if File.exist?(archive_path)
81
81
  # we already have the archive, skip
82
82
  Helper.log.info "Archive #{archive_path} already exists, not unzipping again...".yellow
83
83
  else
@@ -89,8 +89,8 @@ module Fastlane
89
89
  asset_entries = Dir.entries(assets_path).map { |i| File.join(assets_path, i) }
90
90
 
91
91
  # optionally delete everything except for the archive
92
- if !keep_all_assets
93
- files_to_delete = asset_entries.select do |i|
92
+ unless keep_all_assets
93
+ files_to_delete = asset_entries.select do |i|
94
94
  File.extname(i) != '.xcarchive' && ![".", ".."].include?(File.basename(i))
95
95
  end
96
96
 
@@ -101,7 +101,7 @@ module Fastlane
101
101
 
102
102
  Actions.lane_context[SharedValues::XCODE_SERVER_GET_ASSETS_ARCHIVE_PATH] = archive_path
103
103
  end
104
-
104
+
105
105
  Actions.lane_context[SharedValues::XCODE_SERVER_GET_ASSETS_PATH] = assets_path
106
106
 
107
107
  return assets_path
@@ -117,22 +117,20 @@ module Fastlane
117
117
 
118
118
  def fetch_all_bots
119
119
  response = get_endpoint('/bots')
120
- raise "You are unauthorized to access data on #{@host}, please check that you're passing in a correct username and password.".red if response.status == 401
120
+ raise "You are unauthorized to access data on #{@host}, please check that you're passing in a correct username and password.".red if response.status == 401
121
121
  raise "Failed to fetch Bots from Xcode Server at #{@host}, response: #{response.status}: #{response.body}.".red if response.status != 200
122
- bots = JSON.parse(response.body)['results']
122
+ JSON.parse(response.body)['results']
123
123
  end
124
124
 
125
125
  def fetch_integrations(bot_id)
126
126
  response = get_endpoint("/bots/#{bot_id}/integrations?limit=10")
127
127
  raise "Failed to fetch Integrations for Bot #{bot_id} from Xcode Server at #{@host}, response: #{response.status}: #{response.body}".red if response.status != 200
128
- integrations = JSON.parse(response.body)['results']
128
+ JSON.parse(response.body)['results']
129
129
  end
130
130
 
131
131
  def fetch_assets(integration_id, target_folder, action)
132
-
133
132
  # create a temp folder and a file, stream the download into it
134
133
  Dir.mktmpdir do |dir|
135
-
136
134
  temp_file = File.join(dir, "tmp_download.#{rand(1000000)}")
137
135
  f = open(temp_file, 'w')
138
136
  streamer = lambda do |chunk, remaining_bytes, total_bytes|
@@ -145,7 +143,7 @@ module Fastlane
145
143
  end
146
144
 
147
145
  response = self.get_endpoint("/integrations/#{integration_id}/assets", streamer)
148
- f.close()
146
+ f.close
149
147
 
150
148
  raise "Integration doesn't have any assets (it probably never ran).".red if response.status == 500
151
149
  raise "Failed to fetch Assets zip for Integration #{integration_id} from Xcode Server at #{@host}, response: #{response.status}: #{response.body}".red if response.status != 200
@@ -157,7 +155,7 @@ module Fastlane
157
155
  action.sh "cd \"#{out_folder}\"; cat \"#{temp_file}\" | gzip -d | tar -x"
158
156
 
159
157
  # then pull the real name from headers
160
- asset_filename = response.headers['Content-Disposition'].split(';')[1].split('=')[1].gsub('"', '')
158
+ asset_filename = response.headers['Content-Disposition'].split(';')[1].split('=')[1].delete('"')
161
159
  asset_foldername = asset_filename.split('.')[0]
162
160
 
163
161
  # rename the folder in out_folder to asset_foldername
@@ -186,33 +184,33 @@ module Fastlane
186
184
 
187
185
  def headers
188
186
  require 'base64'
189
- headers = {
187
+ headers = {
190
188
  'User-Agent' => 'fastlane-xcode_server_get_assets', # XCS wants user agent. for some API calls. not for others. sigh.
191
189
  'X-XCSAPIVersion' => 1 # XCS API version with this API, Xcode needs this otherwise it explodes in a 500 error fire. Currently Xcode 7 Beta 5 is on Version 5.
192
190
  }
193
191
 
194
- if @username && @password
192
+ if @username and @password
195
193
  userpass = "#{@username}:#{@password}"
196
194
  headers['Authorization'] = "Basic #{Base64.strict_encode64(userpass)}"
197
195
  end
198
-
196
+
199
197
  return headers
200
198
  end
201
199
 
202
- def get_endpoint(endpoint, response_block=nil)
200
+ def get_endpoint(endpoint, response_block = nil)
203
201
  url = url_for_endpoint(endpoint)
204
202
  headers = self.headers || {}
205
203
 
206
204
  if response_block
207
- response = Excon.get(url, :response_block => response_block, :headers => headers)
205
+ response = Excon.get(url, response_block: response_block, headers: headers)
208
206
  else
209
- response = Excon.get(url, :headers => headers)
207
+ response = Excon.get(url, headers: headers)
210
208
  end
211
209
 
212
210
  return response
213
211
  end
214
212
 
215
- private
213
+ private
216
214
 
217
215
  def url_for_endpoint(endpoint)
218
216
  "#{@host}:20343/api#{endpoint}"
@@ -235,7 +233,7 @@ module Fastlane
235
233
  assets folder and puts into shared values the paths to the asset folder and to the `.xcarchive` inside it"
236
234
  end
237
235
 
238
- def self.available_options
236
+ def self.available_options
239
237
  [
240
238
  FastlaneCore::ConfigItem.new(key: :host,
241
239
  env_name: "FL_XCODE_SERVER_GET_ASSETS_HOST",
@@ -296,4 +294,5 @@ module Fastlane
296
294
  end
297
295
  end
298
296
  end
299
- end
297
+ end
298
+ # rubocop:enable Metrics/AbcSize
@@ -1,3 +1,4 @@
1
+ # rubocop:disable all
1
2
  module Fastlane
2
3
  module Actions
3
4
  module SharedValues
@@ -43,7 +44,7 @@ module Fastlane
43
44
  }
44
45
 
45
46
  def self.is_supported?(platform)
46
- [:ios, :mac].include?platform
47
+ [:ios, :mac].include? platform
47
48
  end
48
49
 
49
50
  def self.run(params)
@@ -65,7 +66,6 @@ module Fastlane
65
66
  build_path += "/"
66
67
  end
67
68
 
68
-
69
69
  if params
70
70
  # Operation bools
71
71
  archiving = params.key? :archive
@@ -80,7 +80,7 @@ module Fastlane
80
80
  params[:export_format] ||= "ipa"
81
81
 
82
82
  # If not passed, construct export path from env vars
83
- if params[:export_path] == nil
83
+ if params[:export_path].nil?
84
84
  ipa_filename = scheme ? scheme : File.basename(params[:archive_path], ".*")
85
85
  params[:export_path] = "#{build_path}#{ipa_filename}"
86
86
  end
@@ -139,7 +139,6 @@ module Fastlane
139
139
  if params[:reports]
140
140
  # New report options format
141
141
  reports = params[:reports].reduce("") do |arguments, report|
142
-
143
142
  report_string = "--report #{report[:report]}"
144
143
 
145
144
  if report[:output]
@@ -169,7 +168,7 @@ module Fastlane
169
168
  # Test report file format
170
169
  report_formats = params[:report_formats].map do |format|
171
170
  "--report #{format}"
172
- end.sort().join(" ")
171
+ end.sort.join(" ")
173
172
 
174
173
  xcpretty_args.push report_formats
175
174
 
@@ -213,7 +212,7 @@ module Fastlane
213
212
  raise_error = false
214
213
 
215
214
  Helper.log.warn "First attempt failed with iPhone Simulator error: #{iphone_simulator_time_out_error.source}"
216
- Helper.log.warn "Retrying once more..."
215
+ Helper.log.warn "Retrying once more..."
217
216
  Actions.sh "set -o pipefail && xcodebuild #{xcodebuild_args} | xcpretty #{xcpretty_args}"
218
217
  end
219
218
  end
@@ -233,7 +232,7 @@ module Fastlane
233
232
  value = (v != true && v.to_s.length > 0 ? "\"#{v}\"" : "")
234
233
  "#{arg} #{value}".strip
235
234
  elsif k == :build_settings
236
- v.map{|setting,value| "#{setting}=\"#{value}\""}.join(' ')
235
+ v.map {|setting, val| "#{setting}=\"#{val}\""}.join(' ')
237
236
  elsif k == :destination
238
237
  [*v].collect { |dst| "-destination \"#{dst}\"" }.join(' ')
239
238
  elsif k == :keychain && v.to_s.length > 0
@@ -251,7 +250,7 @@ module Fastlane
251
250
  Helper.log.warn "Multiple workspaces detected."
252
251
  end
253
252
 
254
- if !workspaces.empty?
253
+ unless workspaces.empty?
255
254
  workspace = workspaces.first
256
255
  Helper.log.warn "Using workspace \"#{workspace}\""
257
256
  end
@@ -299,7 +298,7 @@ module Fastlane
299
298
  end
300
299
 
301
300
  def self.is_supported?(platform)
302
- [:ios, :mac].include?platform
301
+ [:ios, :mac].include? platform
303
302
  end
304
303
 
305
304
  def self.available_options
@@ -329,7 +328,7 @@ module Fastlane
329
328
  end
330
329
 
331
330
  def self.is_supported?(platform)
332
- [:ios, :mac].include?platform
331
+ [:ios, :mac].include? platform
333
332
  end
334
333
 
335
334
  def self.available_options
@@ -360,7 +359,7 @@ module Fastlane
360
359
  end
361
360
 
362
361
  def self.is_supported?(platform)
363
- [:ios, :mac].include?platform
362
+ [:ios, :mac].include? platform
364
363
  end
365
364
 
366
365
  def self.available_options
@@ -402,7 +401,7 @@ module Fastlane
402
401
  end
403
402
 
404
403
  def self.is_supported?(platform)
405
- [:ios, :mac].include?platform
404
+ [:ios, :mac].include? platform
406
405
  end
407
406
  end
408
407
 
@@ -431,7 +430,7 @@ module Fastlane
431
430
  end
432
431
 
433
432
  def self.is_supported?(platform)
434
- [:ios, :mac].include?platform
433
+ [:ios, :mac].include? platform
435
434
  end
436
435
 
437
436
  def self.author
@@ -440,3 +439,4 @@ module Fastlane
440
439
  end
441
440
  end
442
441
  end
442
+ # rubocop:enable all