require ‘pom/core_ext/try_dup’
Where in project to store backups.
Root directory is indicated by the presence of either a PACKAGE file or as a fallback a lib/ directory.
Raw access to project metedata, e.g. VERSION.
# File lib/pom.rb, line 6 def self.const_missing(name) file = File.dirname(__FILE__) + "/pom/meta/#{name.to_s.downcase}" if File.exist?(file) File.read(file).strip else super(name) end end
This method supplements root. It does the actual ascention for each root indicator.
# File lib/pom/root.rb, line 24 def self.locate_root_at(indicator) root = nil dir = Dir.pwd while !root && dir != '/' find = File.join(dir, indicator) mark = Dir.glob(find, File::FNM_CASEFOLD).first root = dir if mark dir = File.dirname(dir) end root ? Pathname.new(root) : nil end
Locate the project’s root directory. This is determined by ascending up the directory tree from the current position until the ROOT_INDICATORS is matched. Returns nil if not found.
# File lib/pom/root.rb, line 11 def self.root(local=Dir.pwd) local ||= Dir.pwd Dir.chdir(local) do dir = nil ROOT_INDICATORS.find do |i| dir = locate_root_at(i) end dir ? Pathname.new(dir) : nil end end
Generated with the Darkfish Rdoc Generator 2.