Sha256: 8d69aabe94f4ee1375622e91717d1b4c15a851acb00c42308bea7ab8e5fe1815
Contents?: true
Size: 770 Bytes
Versions: 3
Compression:
Stored size: 770 Bytes
Contents
require 'chef/mash' module Vagabond class Vagabondfile attr_reader :path attr_reader :config def initialize(path=nil) path = discover_path(Dir.pwd) unless path @path = path load_configuration! end def [](k) @config[k] end def load_configuration! raise 'No Vagabondfile file found!' unless @path && File.exists?(@path) @config = Mash.new(self.instance_eval(IO.read(@path), @path, 1)) end def discover_path(path) d_path = Dir.glob(File.join(path, 'Vagabondfile')).first unless(d_path) cut_path = path.split(File::SEPARATOR) cut_path.pop d_path = discover_path(cut_path.join(File::SEPARATOR)) unless cut_path.empty? end d_path end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vagabond-0.1.4 | lib/vagabond/vagabondfile.rb |
vagabond-0.1.2 | lib/vagabond/vagabondfile.rb |
vagabond-0.1.0 | lib/vagabond/vagabondfile.rb |