Sha256: 12d7e7766984f3f84e0e49b94378fd795fda74975b29b51c65ac70e79c5888aa

Contents?: true

Size: 862 Bytes

Versions: 2

Compression:

Stored size: 862 Bytes

Contents

require 'yaml'
require 'nano/hash/traverse'
require 'nano/string/tabto'
require 'nano/binding/local_variables'

module ProjectInfo
  extend self

  attr_writer :info_file

  def info_file
    @info_file ||= 'ProjectInfo'
  end

  def info_stream
    unless @info_stream
      if File.file?( info_file ) and !File.directory?( info_file )
        @info_stream = File.read( info_file )
      end
    end
    @info_stream
  end

  def info
    @info ||= YAML::load(info_stream).traverse{ |k,v| [k.downcase, v] }
  end

  # not using at the moment
  def validate
    # required main parameters
    #raise "TITLE is a required configuration field" unless info['title']
    raise "NAME is a required piece of information" unless info['name']
    raise "VERSION is a required piece of informatiomn" unless info['version']
  end

  def [](name)
    info[name]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reap-3.01 lib/reap/projectinfo.rb
reap-03.01 lib/reap/projectinfo.rb