class Fastlane::Actions::FirebaseDownloadConfigAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 31
def self.authors
  ["Tomas Kohout"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 44
def self.available_options
  [
    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: :client_id,
                            env_name: "FIREBASE_CLIENT_ID",
                         description: "Project client 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() click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 27
def self.description
  "An unofficial tool to access Firebase"
end
details() click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 39
def self.details
  # Optional:
  "Firebase helps you list your projects, create applications, download configuration files and more..."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 70
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() click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_action.rb, line 35
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/firebase/actions/firebase_download_config_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])
  project_number = project["projectNumber"]

  #Select client
  client = manager.select_client(project, params[:client_id])
  client_id = client["clientId"]

  #Download
  config = api.download_config_file(project_number, client_id)
  path = File.join(params[:output_path], params[:output_name] || config.filename)
  config.save!(path)

  UI.success "Successfuly saved config at #{path}"
end