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
- #apple_id(value) ⇒ Object
- #data ⇒ Object
-
#initialize(path = nil) ⇒ AppfileConfig
constructor
A new instance of AppfileConfig.
Constructor Details
#initialize(path = nil) ⇒ AppfileConfig
Returns a new instance of AppfileConfig.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/credentials_manager/appfile_config.rb', line 21 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
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
32 33 34 |
# File 'lib/credentials_manager/appfile_config.rb', line 32 def data @data ||= {} end |