Class: Fastlane::Actions::SendBuildToBugsnagAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::SendBuildToBugsnagAction
- Defined in:
- lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb
Constant Summary collapse
- BUILD_TOOL =
"bugsnag-fastlane-plugin"
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .missing_api_key_message(params) ⇒ Object
- .missing_app_version_message(params) ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
93 94 95 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 93 def self. ["cawllec"] end |
.available_options ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 117 def self. = load_default_values [ FastlaneCore::ConfigItem.new(key: :config_file, description: "AndroidManifest.xml/Info.plist location", optional: true, default_value: [:config_file]), FastlaneCore::ConfigItem.new(key: :api_key, description: "Bugsnag API Key", optional: true, default_value: [:apiKey]), FastlaneCore::ConfigItem.new(key: :app_version, description: "App version being built", optional: true, default_value: [:appVersion]), FastlaneCore::ConfigItem.new(key: :android_version_code, description: "Android app version code", optional: true, default_value: [:appVersionCode]), FastlaneCore::ConfigItem.new(key: :ios_bundle_version, description: "iOS/macOS/tvOS bundle version", optional: true, default_value: [:appBundleVersion]), FastlaneCore::ConfigItem.new(key: :release_stage, description: "Release stage being built, i.e. staging, production", optional: true, default_value: [:releaseStage] || "production"), FastlaneCore::ConfigItem.new(key: :builder, description: "The name of the entity triggering the build", optional: true, default_value: `whoami`.chomp), FastlaneCore::ConfigItem.new(key: :repository, description: "The source control repository URL for this application", optional: true, default_value: [:repository]), FastlaneCore::ConfigItem.new(key: :revision, description: "The source control revision id", optional: true, default_value: [:revision]), FastlaneCore::ConfigItem.new(key: :provider, description: "The source control provider, one of 'github-enterprise', 'gitlab-onpremise', or 'bitbucket-server', if any", optional: true, default_value: nil, verify_block: proc do |value| valid = ['github-enterprise', 'gitlab-onpremise', 'bitbucket-server'].include? value unless valid UI.user_error!("Provider must be one of 'github-enterprise', 'gitlab-onpremise', 'bitbucket-server', or unspecified") end end), FastlaneCore::ConfigItem.new(key: :endpoint, description: "Bugsnag deployment endpoint", optional: true, default_value: "https://build.bugsnag.com") ] end |
.category ⇒ Object
101 102 103 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 101 def self.category :building end |
.description ⇒ Object
89 90 91 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 89 def self.description "Notifies Bugsnag of a build" end |
.details ⇒ Object
109 110 111 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 109 def self.details "Notifies Bugsnag of a new build being released including app version and source control details" end |
.example_code ⇒ Object
97 98 99 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 97 def self.example_code ['send_build_to_bugsnag'] end |
.is_supported?(platform) ⇒ Boolean
113 114 115 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 113 def self.is_supported?(platform) [:ios, :mac, :android].include?(platform) end |
.missing_api_key_message(params) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 53 def self.(params) = "A Bugsnag API key is required to release a build. " if lane_context[:PLATFORM_NAME] == :android if params[:config_file] << "Set com.bugsnag.android.API_KEY in your AndroidManifest.xml to detect API key automatically." else << "Set the config_file option with the path to your AndroidManifest.xml and set com.bugsnag.android.API_KEY in it to detect API key automatically." end else if params[:config_file] << "Set BugsnagAPIKey in your Info.plist file to detect API key automatically." else << "Set the config_file option with the path to your Info.plist and set BugsnagAPIKey in it to detect API key automatically." end end end |
.missing_app_version_message(params) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 71 def self.(params) = "An app version must be specified release a build." if lane_context[:PLATFORM_NAME] == :android if params[:config_file] << "Set com.bugsnag.android.APP_VERSION in your AndroidManifest.xml to detect this value automatically." else << "Set the config_file option with the path to your AndroidManifest.xml and set com.bugsnag.android.APP_VERSION in it to detect this value automatically." end else if params[:config_file] << "Set the app_version option with your app version or set config_file to update the path to your Info.plist" else << "Set the config_file option with the path to your Info.plist" end end end |
.return_value ⇒ Object
105 106 107 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 105 def self.return_value nil end |
.run(params) ⇒ Object
10 11 12 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 |
# File 'lib/fastlane/plugin/bugsnag/actions/send_build_to_bugsnag.rb', line 10 def self.run(params) payload = {buildTool: BUILD_TOOL, sourceControl: {}} if lane_context[:PLATFORM_NAME] == :android payload.merge!((params[:config_file])) if params[:config_file] else payload.merge!((params[:config_file])) if params[:config_file] end default_plist = default_info_plist_path default_manifest = default_android_manifest_path if (lane_context[:PLATFORM_NAME] == :android and params[:config_file] == default_manifest) or (lane_context[:PLATFORM_NAME] != :android and params[:config_file] == default_plist) # Load custom API key and version properties only if config file has not been overridden payload[:apiKey] = params[:api_key] unless params[:api_key].nil? payload[:appVersion] = params[:app_version] unless params[:app_version].nil? payload[:appVersionCode] = params[:android_version_code] unless params[:android_version_code].nil? payload[:appBundleVersion] = params[:ios_bundle_version] unless params[:ios_bundle_version].nil? else # Print which file is populating version and API key information since the value has been # overridden UI.("Loading API key and app version info from #{params[:config_file]}") end payload.delete(:config_file) # Overwrite automated options with configured if set payload[:releaseStage] = params[:release_stage] unless params[:release_stage].nil? payload[:builderName] = params[:builder] payload[:sourceControl][:revision] = params[:revision] if params[:revision] payload[:sourceControl][:repository] = params[:repository] if params[:repository] payload[:sourceControl][:provider] = params[:provider] if params[:provider] payload.reject! {|k,v| v == nil || (v.is_a?(Hash) && v.empty?)} if payload[:apiKey].nil? || !payload[:apiKey].is_a?(String) UI.user_error! (params) end if payload[:appVersion].nil? UI.user_error! (params) end send_notification(params[:endpoint], ::JSON.dump(payload)) end |