Class: CredentialsManager::AppfileConfig
- Inherits:
-
Object
- Object
- CredentialsManager::AppfileConfig
- Defined in:
- lib/credentials_manager/appfile_config.rb
Overview
Access the content of the app file (e.g. app identifier and Apple ID)
Class Method Summary collapse
Instance Method Summary collapse
-
#app_identifier(value) ⇒ Object
Setters.
- #apple_id(value) ⇒ Object
- #data ⇒ Object
-
#initialize(path = nil) ⇒ AppfileConfig
constructor
A new instance of AppfileConfig.
- #team_id(value) ⇒ Object
- #team_name(value) ⇒ Object
Constructor Details
#initialize(path = nil) ⇒ AppfileConfig
Returns a new instance of AppfileConfig.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/credentials_manager/appfile_config.rb', line 19 def initialize(path = nil) path ||= self.class.default_path raise "Could not find Appfile at path '#{path}'".red unless File.exists?(path) full_path = File.(path) Dir.chdir(File.('..', path)) do eval(File.read(full_path)) end end |
Class Method Details
.default_path ⇒ Object
12 13 14 15 16 17 |
# File 'lib/credentials_manager/appfile_config.rb', line 12 def self.default_path ["./fastlane/Appfile", "./Appfile"].each do |current| return current if File.exists?current end nil end |
.try_fetch_value(key) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/credentials_manager/appfile_config.rb', line 5 def self.try_fetch_value(key) if self.default_path return self.new.data[key] end nil end |
Instance Method Details
#app_identifier(value) ⇒ Object
Setters
36 37 38 39 |
# File 'lib/credentials_manager/appfile_config.rb', line 36 def app_identifier(value) value ||= yield if block_given? data[:app_identifier] = value if value end |
#apple_id(value) ⇒ Object
41 42 43 44 |
# File 'lib/credentials_manager/appfile_config.rb', line 41 def apple_id(value) value ||= yield if block_given? data[:apple_id] = value if value end |
#data ⇒ Object
30 31 32 |
# File 'lib/credentials_manager/appfile_config.rb', line 30 def data @data ||= {} end |
#team_id(value) ⇒ Object
46 47 48 49 |
# File 'lib/credentials_manager/appfile_config.rb', line 46 def team_id(value) value ||= yield if block_given? data[:team_id] = value if value end |
#team_name(value) ⇒ Object
51 52 53 54 |
# File 'lib/credentials_manager/appfile_config.rb', line 51 def team_name(value) value ||= yield if block_given? data[:team_name] = value if value end |