Class: Configuration
- Inherits:
-
Object
- Object
- Configuration
- Defined in:
- lib/brisk/configuration.rb
Class Method Summary collapse
- .add(key, value) ⇒ Object
- .install ⇒ Object
- .path ⇒ Object
- .remove(key, value) ⇒ Object
- .update_domain(domain) ⇒ Object
Class Method Details
.add(key, value) ⇒ Object
18 19 20 21 22 |
# File 'lib/brisk/configuration.rb', line 18 def self.add(key, value) config = JSON.parse(FileSystem.read(Configuration.path)) config[key].push(value) FileSystem.write(Configuration.path, config.to_json) end |
.install ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/brisk/configuration.rb', line 8 def self.install FileSystem.create_dir(Constants.valet_home) FileSystem.create_dir(Constants.valet_home + '/Certificates') unless FileSystem.file_exists?(path) config = {:domain => 'dev', 'paths' => [], 'secured' => []} FileSystem.write(path, config.to_json) end end |
.path ⇒ Object
36 37 38 |
# File 'lib/brisk/configuration.rb', line 36 def self.path return Constants.valet_home + '/config.json' end |
.remove(key, value) ⇒ Object
24 25 26 27 28 |
# File 'lib/brisk/configuration.rb', line 24 def self.remove(key, value) config = JSON.parse(FileSystem.read(path)) config[key].delete_if {|i| i == value} FileSystem.write(Configuration.path, config.to_json) end |
.update_domain(domain) ⇒ Object
30 31 32 33 34 |
# File 'lib/brisk/configuration.rb', line 30 def self.update_domain(domain) config = JSON.parse(FileSystem.read(path)) config['domain'] = domain FileSystem.write(Configuration.path, config.to_json) end |