Class: Fastlane::Firebase::Manager
- Inherits:
-
Object
- Object
- Fastlane::Firebase::Manager
- Defined in:
- lib/fastlane/plugin/firebase/lib/manager.rb
Instance Method Summary collapse
- #login(username) ⇒ Object
- #select_client(project, client_id) ⇒ Object
- #select_index(text, options) ⇒ Object
- #select_project(project_number) ⇒ Object
- #server_name ⇒ Object
Instance Method Details
#login(username) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/fastlane/plugin/firebase/lib/manager.rb', line 11 def login(username) item = Security::InternetPassword.find(server: server_name(), account: username) password = item.password if item begin password = UI.input("Password for #{username}") unless password #Api instance @api = Firebase::Api.new(username, password) #Store password Security::InternetPassword.add(server_name(), username, password) unless item.password == password @api rescue Firebase::Api::LoginError => e password = nil UI.error e. retry end end |
#select_client(project, client_id) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fastlane/plugin/firebase/lib/manager.rb', line 43 def select_client(project, client_id) clients = project["clientSummary"].sort {|left, right| left["clientId"] <=> right["clientId"] } if client = clients.select {|c| c["clientId"] == client_id }.first then client else = clients.map { |p| "#{p["clientId"]} (#{p["displayName"]})" } index = select_index("Select client:", ) clients[index] end end |
#select_index(text, options) ⇒ Object
55 56 57 58 |
# File 'lib/fastlane/plugin/firebase/lib/manager.rb', line 55 def select_index(text, ) selected = UI.select(text, ) return .index(selected) end |
#select_project(project_number) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/firebase/lib/manager.rb', line 32 def select_project(project_number) projects = @api.project_list() if project = projects.select {|p| p["projectNumber"] == project_number }.first then project else = projects.map { |p| p["displayName"] } index = select_index("Select project:", ) projects[index] end end |
#server_name ⇒ Object
5 6 7 |
# File 'lib/fastlane/plugin/firebase/lib/manager.rb', line 5 def server_name "firebase.google.com" end |