Class: Syrup::ConfigStore
- Inherits:
-
Object
- Object
- Syrup::ConfigStore
- Includes:
- WithFabric
- Defined in:
- lib/syrup/config_store.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
-
#applications ⇒ Object
Retrieves all of the applications that are configured within the system.
-
#create_application(name) ⇒ Object
Creates a new application.
- #fabric_fn ⇒ Object
-
#initialize(path) ⇒ ConfigStore
constructor
Initializes the configuration store with the given storage directory.
Methods included from WithFabric
Constructor Details
#initialize(path) ⇒ ConfigStore
Initializes the configuration store with the given storage directory.
25 26 27 28 |
# File 'lib/syrup/config_store.rb', line 25 def initialize(path) @path = path @properties = StoredHash.new File.join(@path, 'props') end |
Instance Attribute Details
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
22 23 24 |
# File 'lib/syrup/config_store.rb', line 22 def properties @properties end |
Instance Method Details
#applications ⇒ Object
Retrieves all of the applications that are configured within the system
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/syrup/config_store.rb', line 31 def applications apps = {} Dir[File.join(@path, '*')].each do |store_dir| name = File.basename(store_dir) apps[name] = ApplicationConfiguration.new name, store_dir end apps end |
#create_application(name) ⇒ Object
Creates a new application
43 44 45 46 47 48 |
# File 'lib/syrup/config_store.rb', line 43 def create_application(name) store_dir = File.join(@path, name) FileUtils.mkdir_p store_dir ApplicationConfiguration.new name, store_dir end |
#fabric_fn ⇒ Object
50 51 52 |
# File 'lib/syrup/config_store.rb', line 50 def fabric_fn File.join(@path, 'fabric') end |