Class: Fastlane::Actions::UpdateUrbanAirshipConfigurationAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::UpdateUrbanAirshipConfigurationAction
- Defined in:
- lib/fastlane/actions/update_urban_airship_configuration.rb
Constant Summary
Constants inherited from Fastlane::Action
Fastlane::Action::AVAILABLE_CATEGORIES
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .category ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
action_name, author, lane_context, method_missing, other_action, output, return_value, sample_return_value, sh, step_text
Class Method Details
.authors ⇒ Object
63 64 65 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 63 def self. ["kcharwood"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 31 def self. [ FastlaneCore::ConfigItem.new(key: :plist_path, env_name: "URBAN_AIRSHIP_PLIST_PATH", description: "Path to Urban Airship configuration Plist", verify_block: proc do |value| UI.user_errror!("Could not find Urban Airship plist file") unless File.exist?(value) end), FastlaneCore::ConfigItem.new(key: :development_app_key, optional: true, env_name: "URBAN_AIRSHIP_DEVELOPMENT_APP_KEY", description: "The development app key"), FastlaneCore::ConfigItem.new(key: :development_app_secret, optional: true, env_name: "URBAN_AIRSHIP_DEVELOPMENT_APP_SECRET", description: "The development app secret"), FastlaneCore::ConfigItem.new(key: :production_app_key, optional: true, env_name: "URBAN_AIRSHIP_PRODUCTION_APP_KEY", description: "The production app key"), FastlaneCore::ConfigItem.new(key: :production_app_secret, optional: true, env_name: "URBAN_AIRSHIP_PRODUCTION_APP_SECRET", description: "The production app secret"), FastlaneCore::ConfigItem.new(key: :detect_provisioning_mode, env_name: "URBAN_AIRSHIP_DETECT_PROVISIONING_MODE", is_string: false, optional: true, description: "Automatically detect provisioning mode") ] end |
.category ⇒ Object
81 82 83 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 81 def self.category :push end |
.description ⇒ Object
23 24 25 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 23 def self.description "Set the Urban Airship plist configuration values" end |
.details ⇒ Object
27 28 29 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 27 def self.details "This action updates the AirshipConfig.plist need to configure the Urban Airship SDK at runtime, allowing keys and secrets to easily be set for Enterprise and Production versions of the application." end |
.example_code ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 71 def self.example_code [ 'update_urban_airship_configuration( plist_path: "AirshipConfig.plist", production_app_key: "PRODKEY", production_app_secret: "PRODSECRET" )' ] end |
.is_supported?(platform) ⇒ Boolean
67 68 69 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 67 def self.is_supported?(platform) platform == :ios end |
.run(params) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fastlane/actions/update_urban_airship_configuration.rb', line 4 def self.run(params) require "plist" begin path = File.(params[:plist_path]) plist = Plist.parse_xml(path) plist['developmentAppKey'] = params[:development_app_key] unless params[:development_app_key].nil? plist['developmentAppSecret'] = params[:development_app_secret] unless params[:development_app_secret].nil? plist['productionAppKey'] = params[:production_app_key] unless params[:production_app_key].nil? plist['productionAppSecret'] = params[:production_app_secret] unless params[:production_app_secret].nil? plist['detectProvisioningMode'] = params[:detect_provisioning_mode] unless params[:detect_provisioning_mode].nil? new_plist = plist.to_plist File.write(path, new_plist) rescue => ex UI.error(ex) UI.error("Unable to update Urban Airship configuration for plist file at '#{path}'") end end |