Class: Mimas::Config
- Inherits:
-
Object
- Object
- Mimas::Config
- Defined in:
- lib/mimas/config.rb
Defined Under Namespace
Classes: DSL, InvalidConfiguration, Options, Services, Site
Constant Summary collapse
- DEFAULT_DIRECTORY =
"deploy"
Instance Attribute Summary collapse
-
#hooks ⇒ Object
readonly
Returns the value of attribute hooks.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#sites ⇒ Object
readonly
Returns the value of attribute sites.
Class Method Summary collapse
- .build(source) ⇒ Object
- .current ⇒ Object
- .load(path = File.join(Dir.pwd, DEFAULT_DIRECTORY, "mimas.rb")) ⇒ Object
- .open(&block) ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #ruby_version ⇒ Object
Constructor Details
Instance Attribute Details
#hooks ⇒ Object (readonly)
Returns the value of attribute hooks.
24 25 26 |
# File 'lib/mimas/config.rb', line 24 def hooks @hooks end |
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
24 25 26 |
# File 'lib/mimas/config.rb', line 24 def servers @servers end |
#sites ⇒ Object (readonly)
Returns the value of attribute sites.
24 25 26 |
# File 'lib/mimas/config.rb', line 24 def sites @sites end |
Class Method Details
.build(source) ⇒ Object
20 21 22 |
# File 'lib/mimas/config.rb', line 20 def self.build(source) DSL.new(source).config end |
.current ⇒ Object
5 6 7 |
# File 'lib/mimas/config.rb', line 5 def self.current @current ||= load end |
.load(path = File.join(Dir.pwd, DEFAULT_DIRECTORY, "mimas.rb")) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/mimas/config.rb', line 9 def self.load(path = File.join(Dir.pwd, DEFAULT_DIRECTORY, "mimas.rb")) if File.exist?(path) source = File.read(path) @current = build(source) end end |
Instance Method Details
#ruby_version ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/mimas/config.rb', line 32 def ruby_version @ruby_version ||= begin File.read(File.join(Dir.pwd, ".ruby-version")).chomp rescue Errno::ENOENT RUBY_VERSION end end |