Sha256: caf8019088d32a44afed434f9dd76df99c480850424f0a74717ea3b9cd522bb4
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
module Ro class Root < ::String def initialize(root) super(Ro.realpath(root.to_s)) ensure raise ArgumentError.new("root=#{ root.inspect }") if root.nil? raise ArgumentError.new("root=#{ root.inspect }") unless test(?d, self) end def root self end def nodes Node::List.new(root) do |list| node_directories do |path| list.load(path) end end end def directories(&block) Dir.glob(File.join(root, '*/'), &block) end def node_directories(&block) Dir.glob(File.join(root, '*/*/'), &block) end def git @git ||= Git.new(self) end def patch(*args, &block) git.patch(*args, &block) end def dotdir File.join(self, '.ro') end def lockpath File.join(dotdir, 'lock') end def lock(&block) FileUtils.mkdir_p(File.dirname(lockpath)) @lock ||= Lock.new(lockpath) block ? @lock.lock(&block) : @lock end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ro-1.4.6 | lib/ro/root.rb |