fastlane 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets/FastfileTemplate +3 -0
  3. data/lib/fastlane.rb +1 -0
  4. data/lib/fastlane/action.rb +5 -0
  5. data/lib/fastlane/action_collector.rb +3 -1
  6. data/lib/fastlane/actions/actions_helper.rb +5 -0
  7. data/lib/fastlane/actions/add_git_tag.rb +21 -15
  8. data/lib/fastlane/actions/cert.rb +2 -2
  9. data/lib/fastlane/actions/clean_build_artifacts.rb +1 -1
  10. data/lib/fastlane/actions/commit_version_bump.rb +15 -8
  11. data/lib/fastlane/actions/crashlytics.rb +51 -66
  12. data/lib/fastlane/actions/deliver.rb +32 -15
  13. data/lib/fastlane/actions/deploygate.rb +29 -22
  14. data/lib/fastlane/actions/ensure_git_status_clean.rb +1 -1
  15. data/lib/fastlane/actions/frameit.rb +2 -2
  16. data/lib/fastlane/actions/gcovr.rb +2 -2
  17. data/lib/fastlane/actions/hipchat.rb +36 -23
  18. data/lib/fastlane/actions/hockey.rb +37 -23
  19. data/lib/fastlane/actions/increment_build_number.rb +14 -19
  20. data/lib/fastlane/actions/increment_version_number.rb +42 -44
  21. data/lib/fastlane/actions/install_carthage.rb +1 -1
  22. data/lib/fastlane/actions/install_cocapods.rb +1 -1
  23. data/lib/fastlane/actions/ipa.rb +69 -47
  24. data/lib/fastlane/actions/notify.rb +1 -1
  25. data/lib/fastlane/actions/pem.rb +1 -1
  26. data/lib/fastlane/actions/produce.rb +3 -4
  27. data/lib/fastlane/actions/push_to_git_remote.rb +24 -14
  28. data/lib/fastlane/actions/register_devices.rb +23 -11
  29. data/lib/fastlane/actions/reset_git_repo.rb +13 -5
  30. data/lib/fastlane/actions/resign.rb +19 -16
  31. data/lib/fastlane/actions/s3.rb +56 -37
  32. data/lib/fastlane/actions/sigh.rb +1 -1
  33. data/lib/fastlane/actions/slack.rb +31 -13
  34. data/lib/fastlane/actions/snapshot.rb +13 -6
  35. data/lib/fastlane/actions/team_id.rb +1 -1
  36. data/lib/fastlane/actions/team_name.rb +1 -1
  37. data/lib/fastlane/actions/testmunk.rb +28 -14
  38. data/lib/fastlane/actions/typetalk.rb +1 -1
  39. data/lib/fastlane/actions/update_fastlane.rb +115 -0
  40. data/lib/fastlane/actions/update_project_code_signing.rb +22 -7
  41. data/lib/fastlane/actions/xcode_select.rb +1 -1
  42. data/lib/fastlane/actions/xcodebuild.rb +56 -12
  43. data/lib/fastlane/actions_list.rb +2 -2
  44. data/lib/fastlane/configuration_helper.rb +28 -0
  45. data/lib/fastlane/fast_file.rb +17 -0
  46. data/lib/fastlane/fastlane_folder.rb +3 -3
  47. data/lib/fastlane/setup.rb +11 -5
  48. data/lib/fastlane/version.rb +1 -1
  49. metadata +7 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cbac227e095ab139acfcf394f2607bb1da0ae82
4
- data.tar.gz: 7f41df9446553d5c0bf1d1ead4a872cbdb169933
3
+ metadata.gz: b6af986f5285287dc4be0672d7567284e404ad1f
4
+ data.tar.gz: 349556bcb8ecd9755d3276a1691c14e3fe423e43
5
5
  SHA512:
6
- metadata.gz: cffeeee93a8a855fb5f5c5dca44cba393c0304d4a2b9c79816ec4107835f997ae1112fd9b3f324a7a919a91a142cf7fb7f7685b246cb705239252ca35db13378
7
- data.tar.gz: 1752557d250037e80eb7b583050aa24226cb1875d85420fd4b8cbe45a09fb73c5f9bd764f4e1eb7bb29723adf9777059d497bee919b4b5050998b3693412c78a
6
+ metadata.gz: c28b00dfefe71736fefdedc38cf21f224113e2f66a7f2b9ec80c9c08012251c167fd05e5c3e53a8183b3a086ccc421b055e4cde9cd8202f39f9d6ebcaa00d080
7
+ data.tar.gz: 26a97d1667f249374d9cdc7338a3344305fb8698dc613c8a5483a4eeb508357e0b4a891e50ce694741d9ffb374c893872a2b9f2bac5c6b3c7bc36e4b0564c0cd
@@ -9,6 +9,9 @@
9
9
  # Uncomment the following line to opt out
10
10
  # opt_out_usage
11
11
 
12
+ # If you want to automatically update fastlane if a new version is available:
13
+ # update_fastlane
14
+
12
15
  # This is the minimum version number required.
13
16
  # Update this, if you use features of a newer version
14
17
  fastlane_version "[[FASTLANE_VERSION]]"
data/lib/fastlane.rb CHANGED
@@ -11,6 +11,7 @@ require 'fastlane/action'
11
11
  require 'fastlane/actions/actions_helper'
12
12
  require 'fastlane/action_collector'
13
13
  require 'fastlane/supported_platforms'
14
+ require 'fastlane/configuration_helper'
14
15
 
15
16
  require 'fastlane_core'
16
17
 
@@ -54,5 +54,10 @@ module Fastlane
54
54
  def self.sh(command)
55
55
  Fastlane::Actions.sh(command)
56
56
  end
57
+
58
+ # instead of "AddGitAction", this will return "add_git" to print it to the user
59
+ def self.action_name
60
+ self.name.split('::').last.gsub('Action', '').fastlane_underscore
61
+ end
57
62
  end
58
63
  end
@@ -33,7 +33,9 @@ module Fastlane
33
33
  error: @error
34
34
  )
35
35
 
36
- Excon.post(url)
36
+ unless Helper.is_test? # don't send test data
37
+ Excon.post(url)
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -17,6 +17,11 @@ module Fastlane
17
17
  @lane_context ||= {}
18
18
  end
19
19
 
20
+ # Used in tests to get a clear lane before every test
21
+ def self.clear_lane_context
22
+ @lane_context = nil
23
+ end
24
+
20
25
  # Pass a block which should be tracked. One block = one testcase
21
26
  # @param step_name (String) the name of the currently built code (e.g. snapshot, sigh, ...)
22
27
  def self.execute_action(step_name)
@@ -2,19 +2,12 @@ module Fastlane
2
2
  module Actions
3
3
  # Adds a git tag to the current commit
4
4
  class AddGitTagAction < Action
5
- def self.run(params)
6
- params = params.first
5
+ def self.run(options)
6
+ lane_name = Actions.lane_context[Actions::SharedValues::LANE_NAME].gsub(' ', '') # no spaces allowed
7
7
 
8
- specified_tag = (params && params[:tag])
9
- grouping = (params && params[:grouping]) || 'builds'
10
- prefix = (params && params[:prefix]) || ''
11
- build_number = (params && params[:build_number]) || Actions.lane_context[Actions::SharedValues::BUILD_NUMBER]
12
-
13
- lane_name = Actions.lane_context[Actions::SharedValues::LANE_NAME]
8
+ tag = options[:tag] || "#{options[:grouping]}/#{lane_name}/#{options[:prefix]}#{options[:build_number].to_s}"
14
9
 
15
- tag = specified_tag || "#{grouping}/#{lane_name}/#{prefix}#{build_number}"
16
-
17
- Helper.log.info 'Adding git tag "#{tag}" 🎯.'
10
+ Helper.log.info "Adding git tag '#{tag}' 🎯."
18
11
  Actions.sh("git tag #{tag}")
19
12
  end
20
13
 
@@ -24,10 +17,23 @@ module Fastlane
24
17
 
25
18
  def self.available_options
26
19
  [
27
- ['tag', 'Define your own tag text. This will replace all other parameters.'],
28
- ['grouping', 'Is used to keep your tags organised under one "folder". Defaults to "builds"'],
29
- ['prefix', 'Anything you want to put in front of the version number (e.g. "v").'],
30
- ['build_number', 'The build number. Defaults to the result of increment_build_number if you\'re using it']
20
+ FastlaneCore::ConfigItem.new(key: :tag,
21
+ env_name: "FL_GIT_TAG_TAG",
22
+ description: "Define your own tag text. This will replace all other parameters",
23
+ optional: true),
24
+ FastlaneCore::ConfigItem.new(key: :grouping,
25
+ env_name: "FL_GIT_TAG_GROUPING",
26
+ description: "Is used to keep your tags organised under one 'folder'. Defaults to 'builds'",
27
+ default_value: 'builds'),
28
+ FastlaneCore::ConfigItem.new(key: :prefix,
29
+ env_name: "FL_GIT_TAG_PREFIX",
30
+ description: "Anything you want to put in front of the version number (e.g. 'v')",
31
+ default_value: ''),
32
+ FastlaneCore::ConfigItem.new(key: :build_number,
33
+ env_name: "FL_GIT_TAG_BUILD_NUMBER",
34
+ description: "The build number. Defaults to the result of increment_build_number if you\'re using it",
35
+ default_value: Actions.lane_context[Actions::SharedValues::BUILD_NUMBER],
36
+ is_string: false)
31
37
  ]
32
38
  end
33
39
 
@@ -12,7 +12,7 @@ module Fastlane
12
12
 
13
13
  return if Helper.test?
14
14
 
15
- FastlaneCore::UpdateChecker.start_looking_for_update('cert')
15
+ FastlaneCore::UpdateChecker.start_looking_for_update('cert') unless Helper.is_test?
16
16
 
17
17
  begin
18
18
  Dir.chdir(FastlaneFolder.path || Dir.pwd) do
@@ -37,7 +37,7 @@ module Fastlane
37
37
 
38
38
  Helper.log.info("Use signing certificate '#{certificate_id}' from now on!".green)
39
39
 
40
- ENV["SIGH_CERTIFICATE_ID"] = certificate_id
40
+ ENV["SIGH_CERTIFICATE_ID"] = certificate_id # for further use in the sigh action
41
41
  end
42
42
  ensure
43
43
  FastlaneCore::UpdateChecker.show_update_status('cert', Cert::VERSION)
@@ -1,7 +1,7 @@
1
1
  module Fastlane
2
2
  module Actions
3
3
  class CleanBuildArtifactsAction < Action
4
- def self.run(_params)
4
+ def self.run(params)
5
5
  [
6
6
  Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH],
7
7
  Actions.lane_context[Actions::SharedValues::SIGH_PROFILE_PATH],
@@ -8,10 +8,7 @@ module Fastlane
8
8
  require 'set'
9
9
  require 'shellwords'
10
10
 
11
- params = params.first
12
-
13
- commit_message = (params && params[:message]) || 'Version Bump'
14
- xcodeproj_path = (params && params[:xcodeproj]) ? File.expand_path(File.join('.', params[:xcodeproj])) : nil
11
+ xcodeproj_path = params[:xcodeproj] ? File.expand_path(File.join('.', params[:xcodeproj])) : nil
15
12
 
16
13
  # find the repo root path
17
14
  repo_path = `git rev-parse --show-toplevel`.strip
@@ -70,9 +67,9 @@ module Fastlane
70
67
 
71
68
  # then create a commit with a message
72
69
  Actions.sh("git add #{git_add_paths.map(&:shellescape).join(' ')}")
73
- Actions.sh("git commit -m '#{commit_message}'")
70
+ Actions.sh("git commit -m '#{params[:message]}'")
74
71
 
75
- Helper.log.info "Committed \"#{commit_message}\" 💾.".green
72
+ Helper.log.info "Committed \"#{params[:message]}\" 💾.".green
76
73
  end
77
74
 
78
75
  def self.description
@@ -81,8 +78,18 @@ module Fastlane
81
78
 
82
79
  def self.available_options
83
80
  [
84
- ['message', 'The commit message. Defaults to "Version Bump"'],
85
- ['xcodeproj', 'The path to your project file (Not the workspace). If you have only one, this is optional']
81
+ FastlaneCore::ConfigItem.new(key: :message,
82
+ env_name: "FL_COMMIT_BUMP_MESSAGE",
83
+ description: "The commit message when committing the version bump",
84
+ default_value: "Version Bump"),
85
+ FastlaneCore::ConfigItem.new(key: :xcodeproj,
86
+ env_name: "FL_BUILD_NUMBER_PROJECT",
87
+ description: "The path to your project file (Not the workspace). If you have only one, this is optional",
88
+ optional: true,
89
+ verify_block: Proc.new do |value|
90
+ raise "Please pass the path to the project, not the workspace".red if value.include?"workspace"
91
+ raise "Could not find Xcode project".red unless File.exists?(value)
92
+ end)
86
93
  ]
87
94
  end
88
95
 
@@ -13,19 +13,7 @@ module Fastlane
13
13
  def self.run(params)
14
14
  require 'shenzhen'
15
15
  require 'shenzhen/plugins/crashlytics'
16
-
17
- assert_params_given!(params)
18
-
19
- params = params.first
20
-
21
- crashlytics_path = params[:crashlytics_path] || ENV["CRASHLYTICS_FRAMEWORK_PATH"]
22
- api_token = params[:api_token] || ENV["CRASHLYTICS_API_TOKEN"]
23
- build_secret = params[:build_secret] || ENV["CRASHLYTICS_BUILD_SECRET"]
24
- ipa_path = params[:ipa_path] || Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
25
- notes_path = params[:notes_path]
26
- emails = params[:emails]
27
- notifications = params[:notifications]
28
-
16
+
29
17
  # can pass groups param either as an Array or a String
30
18
  case params[:groups]
31
19
  when NilClass
@@ -36,15 +24,16 @@ module Fastlane
36
24
  groups = params[:groups]
37
25
  end
38
26
 
39
- assert_valid_params!(crashlytics_path, api_token, build_secret, ipa_path)
40
-
41
27
  Helper.log.info 'Uploading the IPA to Crashlytics. Go for a coffee ☕️.'.green
42
28
 
43
- return if Helper.test?
29
+ if Helper.test?
30
+ # Access all values, to do the verify
31
+ return params[:crashlytics_path], params[:api_token], params[:build_secret], params[:ipa_path], params[:build_secret], params[:ipa_path], params[:notes_path], params[:emails], params[:groups], params[:notifications]
32
+ end
44
33
 
45
- client = Shenzhen::Plugins::Crashlytics::Client.new(crashlytics_path, api_token, build_secret)
34
+ client = Shenzhen::Plugins::Crashlytics::Client.new(params[:crashlytics_path], params[:api_token], params[:build_secret])
46
35
 
47
- response = client.upload_build(ipa_path, file: ipa_path, notes: notes_path, emails: emails, groups: groups, notifications: notifications)
36
+ response = client.upload_build(ipa_path, file: params[:ipa_path], notes: params[:notes_path], emails: params[:emails], groups: params[:groups], notifications: params[:notifications])
48
37
 
49
38
  if response
50
39
  Helper.log.info 'Build successfully uploaded to Crashlytics'.green
@@ -54,66 +43,62 @@ module Fastlane
54
43
  end
55
44
  end
56
45
 
57
- private
58
-
59
- def self.assert_params_given!(params)
60
- return unless params.empty?
61
- raise 'You have to pass Crashlytics parameters to the Crashlytics action, take a look at https://github.com/KrauseFx/fastlane#crashlytics'.red
62
- end
63
-
64
- def self.assert_valid_params!(crashlytics_path, api_token, build_secret, ipa_path)
65
- assert_valid_crashlytics_path!(crashlytics_path)
66
- assert_valid_api_token!(api_token)
67
- assert_valid_build_secret!(build_secret)
68
- assert_valid_ipa_path!(ipa_path)
69
- end
70
-
71
- def self.assert_valid_crashlytics_path!(crashlytics_path)
72
- return if crashlytics_path && File.exist?(crashlytics_path)
73
- raise "No Crashlytics path given or found, pass using `crashlytics_path: 'path'`".red
74
- end
75
-
76
- def self.assert_valid_api_token!(token)
77
- return unless token.nil? || token.empty?
78
- raise "No API token for Crashlytics given, pass using `api_token: 'token'`".red
79
- end
80
-
81
- def self.assert_valid_build_secret!(build_secret)
82
- return unless build_secret.nil? || build_secret.empty?
83
- raise "No build secret for Crashlytics given, pass using `build_secret: 'secret'`".red
84
- end
85
-
86
- def self.assert_valid_ipa_path!(ipa_path)
87
- return if ipa_path && File.exist?(ipa_path)
88
- raise "No IPA file given or found, pass using `ipa_path: 'path/app.ipa'`".red
89
- end
90
-
91
46
  def self.description
92
47
  "Upload a new build to Crashlytics Beta"
93
48
  end
94
49
 
95
50
  def self.available_options
96
51
  [
97
- ['crashlytics_path', 'Path to your Crashlytics bundle', 'CRASHLYTICS_FRAMEWORK_PATH'],
98
- ['api_token', 'Crashlytics Beta API Token', 'CRASHLYTICS_API_TOKEN'],
99
- ['build_secret', 'Crashlytics Build Secret', 'CRASHLYTICS_BUILD_SECRET'],
100
- ['ipa_path', 'Path to your IPA file. Optional if you use the `ipa` or `xcodebuild` action'],
101
- ['notes_path', 'Release Notes'],
102
- ['emails', 'Pass email address'],
103
- ['notifications', 'Crashlytics notification option']
52
+ FastlaneCore::ConfigItem.new(key: :crashlytics_path,
53
+ env_name: "CRASHLYTICS_FRAMEWORK_PATH",
54
+ description: "Path to your Crashlytics bundle",
55
+ verify_block: Proc.new do |value|
56
+ raise "No Crashlytics path given or found, pass using `crashlytics_path: 'path'`".red unless File.exists?(value)
57
+ end),
58
+ FastlaneCore::ConfigItem.new(key: :api_token,
59
+ env_name: "CRASHLYTICS_API_TOKEN",
60
+ description: "Crashlytics Beta API Token",
61
+ verify_block: Proc.new do |value|
62
+ raise "No API token for Crashlytics given, pass using `api_token: 'token'`".red unless (value and not value.empty?)
63
+ end),
64
+ FastlaneCore::ConfigItem.new(key: :build_secret,
65
+ env_name: "CRASHLYTICS_BUILD_SECRET",
66
+ description: "Crashlytics Build Secret",
67
+ verify_block: Proc.new do |value|
68
+ raise "No build secret for Crashlytics given, pass using `build_secret: 'secret'`".red unless (value and not value.empty?)
69
+ end),
70
+ FastlaneCore::ConfigItem.new(key: :ipa_path,
71
+ env_name: "CRASHLYTICS_IPA_PATH",
72
+ description: "Path to your IPA file. Optional if you use the `ipa` or `xcodebuild` action",
73
+ default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
74
+ verify_block: Proc.new do |value|
75
+ raise "No IPA file given or found, pass using `ipa_path: 'path/app.ipa'`".red unless File.exists?(value)
76
+ end),
77
+ FastlaneCore::ConfigItem.new(key: :notes_path,
78
+ env_name: "CRASHLYTICS_NOTES_PATH",
79
+ description: "Path to the release notes",
80
+ optional: true,
81
+ verify_block: Proc.new do |value|
82
+ raise "Path '#{value}' not found".red unless File.exists?(value)
83
+ end),
84
+ FastlaneCore::ConfigItem.new(key: :groups,
85
+ env_name: "CRASHLYTICS_GROUPS",
86
+ description: "The groups used for distribution",
87
+ optional: true),
88
+ FastlaneCore::ConfigItem.new(key: :emails,
89
+ env_name: "CRASHLYTICS_EMAILS",
90
+ description: "Pass email addresses, separated by commas",
91
+ optional: true),
92
+ FastlaneCore::ConfigItem.new(key: :notifications,
93
+ env_name: "CRASHLYTICS_NOTIFICATIONS",
94
+ description: "Crashlytics notification option (true/false)",
95
+ optional: true)
104
96
  ]
105
97
  end
106
98
 
107
99
  def self.author
108
100
  "pedrogimenez"
109
101
  end
110
-
111
- private_class_method :assert_params_given!,
112
- :assert_valid_params!,
113
- :assert_valid_crashlytics_path!,
114
- :assert_valid_api_token!,
115
- :assert_valid_build_secret!,
116
- :assert_valid_ipa_path!
117
102
  end
118
103
  end
119
104
  end
@@ -4,24 +4,20 @@ module Fastlane
4
4
  end
5
5
 
6
6
  class DeliverAction < Action
7
- def self.run(params)
7
+ def self.run(config)
8
8
  require 'deliver'
9
9
 
10
- FastlaneCore::UpdateChecker.start_looking_for_update('deliver')
10
+ FastlaneCore::UpdateChecker.start_looking_for_update('deliver') unless Helper.is_test?
11
11
 
12
12
  begin
13
- ENV['DELIVER_SCREENSHOTS_PATH'] = Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH]
13
+ ENV['DELIVER_SCREENSHOTS_PATH'] = Actions.lane_context[SharedValues::SNAPSHOT_SCREENSHOTS_PATH] # use snapshot's screenshots if there
14
14
 
15
- force = params.include?(:force)
16
- beta = params.include?(:beta)
17
- skip_deploy = params.include?(:skip_deploy)
18
-
19
- Dir.chdir(ENV["DELIVERFILE_PATH"] || FastlaneFolder.path || Dir.pwd) do
15
+ Dir.chdir(config[:deliver_file_path] || FastlaneFolder.path || Dir.pwd) do
20
16
  # This should be executed in the fastlane folder
21
17
  Deliver::Deliverer.new(nil,
22
- force: force,
23
- is_beta_ipa: beta,
24
- skip_deploy: skip_deploy)
18
+ force: config[:force],
19
+ is_beta_ipa: config[:beta],
20
+ skip_deploy: config[:skip_deploy])
25
21
 
26
22
  if ENV['DELIVER_IPA_PATH'] # since IPA upload is optional
27
23
  Actions.lane_context[SharedValues::IPA_OUTPUT_PATH] = File.expand_path(ENV['DELIVER_IPA_PATH']) # deliver will store it in the environment
@@ -38,10 +34,31 @@ module Fastlane
38
34
 
39
35
  def self.available_options
40
36
  [
41
- ['force', 'Set to true to skip PDF verification'],
42
- ['beta', 'Upload a new version to TestFlight'],
43
- ['skip_deploy', 'Skip the submission of the app - it will only be uploaded'],
44
- ['', 'Specify a path to the directory containing the Deliverfile', 'DELIVERFILE_PATH']
37
+ FastlaneCore::ConfigItem.new(key: :force,
38
+ env_name: "FL_DELIVER_FORCE",
39
+ description: "Set to true to skip PDF verification",
40
+ optional: true,
41
+ default_value: false,
42
+ is_string: false),
43
+ FastlaneCore::ConfigItem.new(key: :beta,
44
+ env_name: "FL_DELIVER_BETA",
45
+ description: "Upload a new version to TestFlight",
46
+ optional: true,
47
+ default_value: false,
48
+ is_string: false),
49
+ FastlaneCore::ConfigItem.new(key: :skip_deploy,
50
+ env_name: "FL_DELIVER_SKIP_DEPLOY",
51
+ description: "Skip the submission of the app - it will only be uploaded",
52
+ optional: true,
53
+ default_value: false,
54
+ is_string: false),
55
+ FastlaneCore::ConfigItem.new(key: :deliver_file_path,
56
+ env_name: "FL_DELIVER_CONFIG_PATH",
57
+ description: "Specify a path to the directory containing the Deliverfile",
58
+ default_value: FastlaneFolder.path || Dir.pwd, # defaults to fastlane folder
59
+ verify_block: Proc.new do |value|
60
+ raise "Couldn't find folder '#{value}'. Make sure to pass the path to the directory not the file!".red unless File.directory?(value)
61
+ end)
45
62
  ]
46
63
  end
47
64
 
@@ -17,25 +17,21 @@ module Fastlane
17
17
  platform == :ios
18
18
  end
19
19
 
20
- def self.run(params)
20
+ def self.run(options)
21
21
  require 'shenzhen'
22
22
  require 'shenzhen/plugins/deploygate'
23
23
 
24
24
  # Available options: https://deploygate.com/docs/api
25
- options = {
26
- ipa: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH]
27
- }.merge(params.first || {})
28
- assert_options!(options)
29
-
30
25
  Helper.log.info 'Starting with ipa upload to DeployGate... this could take some time ⏳'.green
26
+
31
27
  client = Shenzhen::Plugins::DeployGate::Client.new(
32
- options.delete(:api_token),
33
- options.delete(:user)
28
+ options[:api_token],
29
+ options[:user]
34
30
  )
35
31
 
36
- return if Helper.test?
32
+ return options[:ipa] if Helper.test?
37
33
 
38
- response = client.upload_build(options.delete(:ipa), options)
34
+ response = client.upload_build(options[:ipa], options)
39
35
  if parse_response(response)
40
36
  Helper.log.info "DeployGate URL: #{Actions.lane_context[SharedValues::DEPLOYGATE_URL]}"
41
37
  Helper.log.info "Build successfully uploaded to DeployGate as revision \##{Actions.lane_context[SharedValues::DEPLOYGATE_REVISION]}!".green
@@ -44,14 +40,6 @@ module Fastlane
44
40
  end
45
41
  end
46
42
 
47
- def self.assert_options!(options)
48
- raise "No API Token for DeployGate given, pass using `api_token: 'token'`".red unless options[:api_token].to_s.length > 0
49
- raise "No User for app given, pass using `user: 'user'`".red unless options[:user].to_s.length > 0
50
- raise "No IPA file given or found, pass using `ipa: 'path.ipa'`".red unless options[:ipa]
51
- raise "IPA file on path '#{File.expand_path(options[:ipa])}' not found".red unless File.exist?(options[:ipa])
52
- end
53
- private_class_method :assert_options!
54
-
55
43
  def self.parse_response(response)
56
44
  if response.body && response.body.key?('error')
57
45
  unless response.body['error']
@@ -94,10 +82,29 @@ module Fastlane
94
82
 
95
83
  def self.available_options
96
84
  [
97
- ['api_token', 'DeployGate API Token'],
98
- ['user', 'Target username or organization name'],
99
- ['ipa', 'Path to your IPA file. Defaults to output of xcodebuild and ipa'],
100
- ['message', 'Text for the uploaded build']
85
+ FastlaneCore::ConfigItem.new(key: :api_token,
86
+ env_name: "DEPLOYGATE_API_TOKEN",
87
+ description: "Deploygate API Token",
88
+ verify_block: Proc.new do |value|
89
+ raise "No API Token for DeployGate given, pass using `api_token: 'token'`".red unless value.to_s.length > 0
90
+ end),
91
+ FastlaneCore::ConfigItem.new(key: :user,
92
+ env_name: "DEPLOYGATE_USER",
93
+ description: "Target username or organization name",
94
+ verify_block: Proc.new do |value|
95
+ raise "No User for app given, pass using `user: 'user'`".red unless value.to_s.length > 0
96
+ end),
97
+ FastlaneCore::ConfigItem.new(key: :ipa,
98
+ env_name: "DEPLOYGATE_IPA_PATH",
99
+ description: "Path to your IPA file. Optional if you use the `ipa` or `xcodebuild` action",
100
+ default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
101
+ verify_block: Proc.new do |value|
102
+ raise "No IPA file given or found, pass using `ipa: 'path.ipa'`".red unless File.exists?(value)
103
+ end),
104
+ FastlaneCore::ConfigItem.new(key: :message,
105
+ env_name: "DEPLOYGATE_MESSAGE",
106
+ description: "Release Notes",
107
+ default_value: "No changelog provided")
101
108
  ]
102
109
  end
103
110