Class: Bow::Config
- Inherits:
-
Object
- Object
- Bow::Config
- Defined in:
- lib/bow/config.rb
Constant Summary collapse
- HOST_BASE_DIR =
File.dirname(File.dirname(File.dirname(__FILE__)))
- GUEST_BASE_DIR =
"#{Dir.home}/.bow"- GUEST_FROM_HOST_BASE_DIR =
'~/.bow'- PATHS =
{ guest: { base_dir: '%s', rake_dir: '%s/rake', history: '%s/.history', pre_script: '%s/provision.sh' }, host: { base_dir: '%s', pre_script: '%s/src/provision.sh' } }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
- #get(name) ⇒ Object
-
#initialize(type, base_dir) ⇒ Config
constructor
A new instance of Config.
- #substitude_dir(orig) ⇒ Object
Constructor Details
#initialize(type, base_dir) ⇒ Config
38 39 40 41 |
# File 'lib/bow/config.rb', line 38 def initialize(type, base_dir) @type = type @base_dir = base_dir end |
Class Method Details
.guest ⇒ Object
10 11 12 |
# File 'lib/bow/config.rb', line 10 def guest @guest ||= Config.new(:guest, GUEST_BASE_DIR) end |
.guest_from_host ⇒ Object
14 15 16 |
# File 'lib/bow/config.rb', line 14 def guest_from_host @guest_from_host ||= Config.new(:guest, '~') end |
.host ⇒ Object
6 7 8 |
# File 'lib/bow/config.rb', line 6 def host @host ||= Config.new(:host, HOST_BASE_DIR) end |
Instance Method Details
#[](name) ⇒ Object
53 54 55 |
# File 'lib/bow/config.rb', line 53 def [](name) get(name) end |
#get(name) ⇒ Object
43 44 45 46 47 |
# File 'lib/bow/config.rb', line 43 def get(name) name.to_sym value = PATHS[@type][name] substitude_dir(value) end |
#substitude_dir(orig) ⇒ Object
49 50 51 |
# File 'lib/bow/config.rb', line 49 def substitude_dir(orig) format(orig, @base_dir) if orig end |