Class: Shanty::Env
- Inherits:
-
Object
- Object
- Shanty::Env
- Defined in:
- lib/shanty/env.rb
Constant Summary collapse
- CONFIG_FILE =
'.shanty.yml'
- DEFAULT_CONFIG =
{}
Instance Method Summary collapse
- #environment ⇒ Object
-
#initialize ⇒ Env
constructor
A new instance of Env.
- #root ⇒ Object
Constructor Details
#initialize ⇒ Env
Returns a new instance of Env.
10 11 12 13 14 15 16 17 |
# File 'lib/shanty/env.rb', line 10 def initialize Dir.chdir(root) do (config['require'] || {}).each do |requirement| requirement = "#{requirement}/**/*.rb" unless requirement.include?('.rb') Dir[requirement].each { |f| require(File.join(root, f)) } end end end |
Instance Method Details
#environment ⇒ Object
19 20 21 |
# File 'lib/shanty/env.rb', line 19 def environment @environment = ENV['SHANTY_ENV'] || 'local' end |
#root ⇒ Object
23 24 25 |
# File 'lib/shanty/env.rb', line 23 def root @root ||= find_root end |