Module: StraightServer::Initializer::ConfigDir
- Defined in:
- lib/straight-server/initializer.rb
Class Method Summary collapse
- .path ⇒ Object
-
.set!(path = nil) ⇒ Object
Determine config dir or set default.
Class Method Details
.path ⇒ Object
29 30 31 |
# File 'lib/straight-server/initializer.rb', line 29 def path @@config_dir end |
.set!(path = nil) ⇒ Object
Determine config dir or set default. Useful when we want to have different settings for production or staging or development environments.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/straight-server/initializer.rb', line 14 def set!(path=nil) @@config_dir = path and return if path @@config_dir = ENV['HOME'] + '/.straight' ARGV.each do |a| if a =~ /\A--config-dir=.+/ @@config_dir = File.(a.sub('--config-dir=', '')) break elsif a =~ /\A-c .+/ @@config_dir = File.(a.sub('-c ', '')) break end end puts "Setting config dir to #{@@config_dir}" end |