Class: Fastlane::Actions::FirebaseAddClientAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FirebaseAddClientAction
- Defined in:
- lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
52 53 54 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 52 def self. ["Tomas Kohout"] end |
.available_options ⇒ Object
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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 65 def self. [ FastlaneCore::ConfigItem.new(key: :username, env_name: "FIREBASE_USERNAME", description: "Username for your google account", optional: false), FastlaneCore::ConfigItem.new(key: :project_number, env_name: "FIREBASE_PROJECT_NUMBER", description: "Project number", optional: true), FastlaneCore::ConfigItem.new(key: :download_config, env_name: "FIREBASE_DOWNLOAD_CONFIG", description: "Should download config for created client", optional: false, is_string: false, default_value: true), FastlaneCore::ConfigItem.new(key: :type, env_name: "FIREBASE_TYPE", description: "Type of client (ios, android)", verify_block: proc do |value| types = [:ios, :android] UI.user_error!("Type must be in #{types}") unless types.include?(value.to_sym) end ), FastlaneCore::ConfigItem.new(key: :bundle_id, env_name: "FIREBASE_BUNDLE_ID", description: "Bundle ID (package name)", optional: false), FastlaneCore::ConfigItem.new(key: :name, env_name: "FIREBASE_BUNDLE_ID", description: "Display name", optional: true), FastlaneCore::ConfigItem.new(key: :appstore_id, env_name: "FIREBASE_APPSTORE_ID", description: "AppStore ID", optional: true), FastlaneCore::ConfigItem.new(key: :output_path, env_name: "FIREBASE_OUTPUT_PATH", description: "Path for the downloaded config", optional: false, default_value: "./"), FastlaneCore::ConfigItem.new(key: :output_name, env_name: "FIREBASE_OUTPUT_NAME", description: "Name of the downloaded file", optional: true) ] end |
.description ⇒ Object
48 49 50 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 48 def self.description "An unofficial tool to access Firebase" end |
.details ⇒ Object
60 61 62 63 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 60 def self.details # Optional: "Firebase helps you list your projects, create applications, download configuration files and more..." end |
.is_supported?(platform) ⇒ Boolean
113 114 115 116 117 118 119 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 113 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md # # [:ios, :mac, :android].include?(platform) true end |
.return_value ⇒ Object
56 57 58 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 56 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
5 6 7 8 9 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 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 5 def self.run(params) manager = Firebase::Manager.new #Login api = manager.login(params[:username]) #Select project project = manager.select_project(params[:project_number]) # Client input type = params[:type].to_sym bundle_id = params[:bundle_id] name = params[:name] appstore_id = params[:appstore_id] begin # Add client client = api.add_client(project["projectNumber"], type, bundle_id, name, appstore_id) rescue Firebase::Api::BadRequestError => e if e.code == 409 then client = project["clientSummary"].select { |client| client["clientId"] == "#{type}:#{bundle_id}" }.first if client then UI.success "Client already exists, skipping ..." else raise end else raise end end if params[:download_config] then #Download config config = api.download_config_file(project["projectNumber"], client["clientId"]) path = File.join(params[:output_path], params[:output_name] || config.filename) config.save!(path) UI.success "Successfuly saved config at #{path}" end end |