lib/ro/root.rb in ro-1.1.1 vs lib/ro/root.rb in ro-1.2.0

- old
+ new

@@ -24,7 +24,29 @@ 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