Sha256: 8728b79ef12a967e801617c33c9eccfcb1e7789dd83c11992179e63f921416e1

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

class Nachos
  class Config

    def repo_root
      Pathname(config.repo_root)
    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

4 entries across 4 versions & 1 rubygems

Version Path
nachos-0.0.5 lib/nachos/config.rb
nachos-0.0.4 lib/nachos/config.rb
nachos-0.0.3 lib/nachos/config.rb
nachos-0.0.2 lib/nachos/config.rb