Class: Ro::Root
- Inherits:
-
String
- Object
- String
- Ro::Root
- Defined in:
- lib/ro/root.rb
Instance Method Summary collapse
- #directories(&block) ⇒ Object
- #dotdir ⇒ Object
- #git ⇒ Object
-
#initialize(root) ⇒ Root
constructor
A new instance of Root.
- #lock(&block) ⇒ Object
- #lockpath ⇒ Object
- #node_directories(&block) ⇒ Object
- #nodes ⇒ Object
- #patch(*args, &block) ⇒ Object
- #root ⇒ Object
Constructor Details
Instance Method Details
#directories(&block) ⇒ Object
22 23 24 |
# File 'lib/ro/root.rb', line 22 def directories(&block) Dir.glob(File.join(root, '*/'), &block) end |
#dotdir ⇒ Object
38 39 40 |
# File 'lib/ro/root.rb', line 38 def dotdir File.join(self, '.ro') end |
#lock(&block) ⇒ Object
46 47 48 49 50 |
# File 'lib/ro/root.rb', line 46 def lock(&block) FileUtils.mkdir_p(File.dirname(lockpath)) @lock ||= Lock.new(lockpath) block ? @lock.lock(&block) : @lock end |
#lockpath ⇒ Object
42 43 44 |
# File 'lib/ro/root.rb', line 42 def lockpath File.join(dotdir, 'lock') end |
#node_directories(&block) ⇒ Object
26 27 28 |
# File 'lib/ro/root.rb', line 26 def node_directories(&block) Dir.glob(File.join(root, '*/*/'), &block) end |
#nodes ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/ro/root.rb', line 14 def nodes Node::List.new(root) do |list| node_directories do |path| list.load(path) end end end |
#patch(*args, &block) ⇒ Object
34 35 36 |
# File 'lib/ro/root.rb', line 34 def patch(*args, &block) git.patch(*args, &block) end |
#root ⇒ Object
10 11 12 |
# File 'lib/ro/root.rb', line 10 def root self end |