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, details, output, sh
Class Method Details
.author ⇒ Object
99 100 101 |
# File 'lib/fastlane/actions/crashlytics.rb', line 99 def self. "pedrogimenez" end |
.available_options ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 |
# File 'lib/fastlane/actions/crashlytics.rb', line 50 def self. [ FastlaneCore::ConfigItem.new(key: :crashlytics_path, env_name: "CRASHLYTICS_FRAMEWORK_PATH", description: "Path to your Crashlytics bundle", verify_block: Proc.new do |value| raise "No Crashlytics path given or found, pass using `crashlytics_path: 'path'`".red unless File.exists?(value) end), FastlaneCore::ConfigItem.new(key: :api_token, env_name: "CRASHLYTICS_API_TOKEN", description: "Crashlytics Beta API Token", verify_block: Proc.new do |value| raise "No API token for Crashlytics given, pass using `api_token: 'token'`".red unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :build_secret, env_name: "CRASHLYTICS_BUILD_SECRET", description: "Crashlytics Build Secret", verify_block: Proc.new do |value| raise "No build secret for Crashlytics given, pass using `build_secret: 'secret'`".red unless (value and not 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.new do |value| raise "No IPA file given or found, pass using `ipa_path: 'path/app.ipa'`".red unless File.exists?(value) end), FastlaneCore::ConfigItem.new(key: :notes_path, env_name: "CRASHLYTICS_NOTES_PATH", description: "Path to the release notes", optional: true, verify_block: Proc.new do |value| raise "Path '#{value}' not found".red unless File.exists?(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) ] end |
.description ⇒ Object
46 47 48 |
# File 'lib/fastlane/actions/crashlytics.rb', line 46 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) platform == :ios 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 |
# 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 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], params[:groups], params[:notifications] end client = Shenzhen::Plugins::Crashlytics::Client.new(params[:crashlytics_path], params[:api_token], params[:build_secret]) response = client.upload_build(ipa_path, file: params[:ipa_path], notes: params[:notes_path], emails: params[:emails], groups: params[:groups], notifications: params[: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 |