module StraightServer::Initializer::ConfigDir

Public Class Methods

path() click to toggle source
# File lib/straight-server/initializer.rb, line 29
def path
  @@config_dir
end
set!(path=nil) click to toggle source

Determine config dir or set default. Useful when we want to have different settings for production or staging or development environments.

# 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.expand_path(a.sub('--config-dir=', ''))
      break
    elsif a =~ /\A-c .+/
      @@config_dir = File.expand_path(a.sub('-c ', ''))
      break
    end
  end
  puts "Setting config dir to #{@@config_dir}"
end