Sha256: bc48c7f7ea4afc81f0eca34b1487f81c6a7ecfc4584321be00d3b63047dc8224

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

module TomatoHarvest
  class Config
    CONFIG_PATH = File.expand_path("#{ENV['$HOME']}/.tomaconfig")
    LOCAL_CONFIG_PATH = File.join(Dir.pwd, '.tomaconfig')

    def self.load(options = {})
      if !(File.exists? CONFIG_PATH)
        File.open(CONFIG_PATH, 'w') do |file|
          YAML.dump({}, file)
        end
      end

      hash = YAML.load_file(CONFIG_PATH)
      if File.exists? LOCAL_CONFIG_PATH
        hash.merge!(YAML.load_file(LOCAL_CONFIG_PATH))
      end

      hash
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tomatoharvest-0.0.1 lib/tomatoharvest/config.rb