Sha256: 81043455a79893337483fde2ccdeb0b169bea793210db7438efc1ced36459c10

Contents?: true

Size: 651 Bytes

Versions: 1

Compression:

Stored size: 651 Bytes

Contents

class Nachos
  class Config

    def repo_root
      Pathname(config.repo_root).expand_path
    end
    
    def config
      config_exists? ? load_config : default_config
    end

    def display_config
      config_exists? ? load_config : "No config found - run nachos config to create one"    
    end
    
    def config_exists?
      config_path.exist?
    end
    
    def config_path
      Pathname(ENV["HOME"]).join(".nachos")
    end

    def default_config
      @default_config ||= Hashie::Mash.new("repo_root" => "#{ENV["HOME"]}/src")
    end

    def load_config
      Hashie::Mash.new(YAML.load_file(config_path))
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nachos-0.0.6 lib/nachos/config.rb