Class: Fastlane::Actions::CrashlyticsAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::CrashlyticsAction
- Defined in:
- lib/fastlane/actions/crashlytics.rb
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, authors, details, output, sh, step_text
Class Method Details
.author ⇒ Object
121 122 123 |
# File 'lib/fastlane/actions/crashlytics.rb', line 121 def self. "pedrogimenez" end |
.available_options ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/fastlane/actions/crashlytics.rb', line 68 def self. [ FastlaneCore::ConfigItem.new(key: :crashlytics_path, env_name: "CRASHLYTICS_FRAMEWORK_PATH", description: "Path to the submit binary in the Crashlytics bundle", verify_block: proc do |value| raise "No Crashlytics path given or found, pass using `crashlytics_path: 'path'`".red unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :api_token, env_name: "CRASHLYTICS_API_TOKEN", description: "Crashlytics Beta API Token", verify_block: proc do |value| raise "No API token for Crashlytics given, pass using `api_token: 'token'`".red unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :build_secret, env_name: "CRASHLYTICS_BUILD_SECRET", description: "Crashlytics Build Secret", verify_block: proc do |value| raise "No build secret for Crashlytics given, pass using `build_secret: 'secret'`".red unless value and !value.empty? end), FastlaneCore::ConfigItem.new(key: :ipa_path, env_name: "CRASHLYTICS_IPA_PATH", description: "Path to your IPA file. Optional if you use the `ipa` or `xcodebuild` action", default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH], verify_block: proc do |value| raise "Couldn't find ipa file at path '#{value}'".red unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :notes_path, env_name: "CRASHLYTICS_NOTES_PATH", description: "Path to the release notes", optional: true, verify_block: proc do |value| raise "Path '#{value}' not found".red unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :groups, env_name: "CRASHLYTICS_GROUPS", description: "The groups used for distribution", optional: true), FastlaneCore::ConfigItem.new(key: :emails, env_name: "CRASHLYTICS_EMAILS", description: "Pass email addresses, separated by commas", optional: true), FastlaneCore::ConfigItem.new(key: :notifications, env_name: "CRASHLYTICS_NOTIFICATIONS", description: "Crashlytics notification option (true/false)", optional: true, is_string: false, verify_block: proc do |value| raise "Crashlytics supported notifications options: TrueClass, FalseClass, 'true', 'false', 'YES', 'NO'".red unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass) || value.kind_of?(String) end) ] end |
.description ⇒ Object
64 65 66 |
# File 'lib/fastlane/actions/crashlytics.rb', line 64 def self.description "Upload a new build to Crashlytics Beta" end |
.is_supported?(platform) ⇒ Boolean
9 10 11 |
# File 'lib/fastlane/actions/crashlytics.rb', line 9 def self.is_supported?(platform) [:ios, :mac].include? platform end |
.run(params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fastlane/actions/crashlytics.rb', line 13 def self.run(params) require 'shenzhen' require 'shenzhen/plugins/crashlytics' # can pass groups param either as an Array or a String case params[:groups] when NilClass groups = nil when Array groups = params[:groups].join(',') when String groups = params[:groups] end # Normalized notification to Crashlytics notification parameter requirement # 'YES' or 'NO' - String case params[:notifications] when String if params[:notifications] == 'YES' || params[:notifications] == 'NO' notifications = params[:notifications] else notifications = 'YES' if params[:notifications] == 'true' notifications = 'NO' if params[:notifications] == 'false' end when TrueClass notifications = 'YES' when FalseClass notifications = 'NO' else notifications = nil end Helper.log.info 'Uploading the IPA to Crashlytics. Go for a coffee ☕️.'.green if Helper.test? # Access all values, to do the verify return params[:crashlytics_path], params[:api_token], params[:build_secret], params[:ipa_path], params[:build_secret], params[:ipa_path], params[:notes_path], params[:emails], groups, notifications end client = Shenzhen::Plugins::Crashlytics::Client.new(params[:crashlytics_path], params[:api_token], params[:build_secret]) response = client.upload_build(params[:ipa_path], file: params[:ipa_path], notes: params[:notes_path], emails: params[:emails], groups: groups, notifications: notifications) if response Helper.log.info 'Build successfully uploaded to Crashlytics'.green else Helper.log.fatal 'Error uploading to Crashlytics.' raise 'Error when trying to upload ipa to Crashlytics'.red end end |