Class: Shanty::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/shanty/env.rb

Constant Summary collapse

CONFIG_FILE =
'.shanty.yml'
DEFAULT_CONFIG =
{}

Instance Method Summary collapse

Constructor Details

#initializeEnv

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

#environmentObject



19
20
21
# File 'lib/shanty/env.rb', line 19

def environment
  @environment = ENV['SHANTY_ENV'] || 'local'
end

#rootObject



23
24
25
# File 'lib/shanty/env.rb', line 23

def root
  @root ||= find_root
end