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
38 39 40 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 38 def self. ["Tomas Kohout"] end |
.available_options ⇒ Object
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 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 51 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, 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
34 35 36 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 34 def self.description "An unofficial tool to access Firebase" end |
.details ⇒ Object
46 47 48 49 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 46 def self.details # Optional: "Firebase helps you list your projects, create applications, download configuration files and more..." end |
.is_supported?(platform) ⇒ Boolean
98 99 100 101 102 103 104 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 98 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
42 43 44 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_add_client_action.rb', line 42 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 |
# 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] # Add client client = api.add_client(project["projectNumber"], type, bundle_id, name, appstore_id) 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 |