Class: Fastlane::Actions::FirebaseUploadCertificateAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FirebaseUploadCertificateAction
- Defined in:
- lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_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
- .server_name ⇒ Object
Class Method Details
.authors ⇒ Object
57 58 59 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 57 def self. ["Tomas Kohout"] end |
.available_options ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 70 def self. [ FastlaneCore::ConfigItem.new(key: :username, env_name: "FIREBASE_USERNAME", description: "Username for your google account", optional: false), FastlaneCore::ConfigItem.new(key: :p12_path, env_name: "FIREBASE_P12PATH", description: "Path to certificate", optional: false), FastlaneCore::ConfigItem.new(key: :p12_password, env_name: "FIREBASE_PASSWORD", description: "Password to the certicate", optional: true), 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) ] end |
.description ⇒ Object
53 54 55 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 53 def self.description "An unofficial tool to access Firebase" end |
.details ⇒ Object
65 66 67 68 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 65 def self.details # Optional: "Firebase helps you list your projects, create applications, download configuration files and more..." end |
.is_supported?(platform) ⇒ Boolean
95 96 97 98 99 100 101 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 95 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
61 62 63 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 61 def self.return_value # If your method provides a return value, you can describe here what it does 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 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 10 def self.run(params) manager = Firebase::Manager.new # Login api = manager.login(params[:username]) p12_path = params[:p12_path] #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"] #Select certificate type type = UI.select("Select type:", [:development, :production]) #Base64 certificate certificate_value = Base64.encode64(File.open(p12_path, "rb").read).delete!("\n") UI. "Uploading certificate ..." cert_password = params[:p12_password] begin api.upload_certificate(project_number, client_id, type, certificate_value, cert_password) rescue Firebase::Api::BadRequestError => e if e..start_with? "3000" then UI.error e. cert_password = UI.password("Password for certificate") retry elsif e..start_with? "3003" then UI.user_error! "The Bundle ID in the certificate does not match the Bundle ID you entered." return end UI.crash! e. end UI.success "Successfully uploaded certificate" end |
.server_name ⇒ Object
6 7 8 |
# File 'lib/fastlane/plugin/firebase/actions/firebase_upload_certificate_action.rb', line 6 def self.server_name "firebase.google.com" end |