revtree 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/revtree.rb +10 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7467c75fbcedb571b34585f6f91f6c41454819402da7b476725f0928486f5e7
|
4
|
+
data.tar.gz: b00a508bafaae9f6cb4e6aea55ea7e83091a7cea7a84bb12f079581465d6e38b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff58e04caa7b1afac85ceb19b2076e2cffbb28f6cd38dfe1b9f8b2b45824a70b80743fe2b6b3c42e1691b945f639f605c531d17a06aa546e26973bbe779c7a76
|
7
|
+
data.tar.gz: 35cfb5161ae3d0a8edfbf7a80cef8b5d4e7a56f6e80005d5cbabe6ecb430113725a7a68dde43a7efa0b082fb682ef8903e3ea93e15940f7dcfb5e555e2f1298e
|
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# RevTree
|
2
|
+
[](https://badge.fury.io/rb/revtree)
|
2
3
|
|
3
4
|
## Introduction
|
4
5
|
|
@@ -41,7 +42,7 @@ sudo make install
|
|
41
42
|
git clone https://github.com/juliankahlert/revtree.git
|
42
43
|
cd revtree
|
43
44
|
gem build revtree.gemspec
|
44
|
-
sudo gem install --local revtree-0.1.
|
45
|
+
sudo gem install --local revtree-0.1.4.gem
|
45
46
|
```
|
46
47
|
|
47
48
|
## API Documentation
|
data/lib/revtree.rb
CHANGED
@@ -123,7 +123,7 @@ class RevTree
|
|
123
123
|
def for_each(status_whitelist = [:unmodified, :modified, :added, :removed], &block)
|
124
124
|
return unless block_given?
|
125
125
|
|
126
|
-
RevTree.traverse_tree(self, status_whitelist, @path, &block)
|
126
|
+
RevTree.traverse_tree(self, status_whitelist, @path, nil, &block)
|
127
127
|
end
|
128
128
|
|
129
129
|
# Watches the tree for changes
|
@@ -342,20 +342,25 @@ class RevTree
|
|
342
342
|
#
|
343
343
|
# @param node [RevTree] the current node being traversed
|
344
344
|
# @param status_whitelist [Array<Symbol>] the list of statuses to match
|
345
|
+
# @param root [Pathname] the root path
|
345
346
|
# @param current_path [Pathname] the current path
|
346
347
|
# @yield [node, full_path] the block to be executed for each matching file
|
347
348
|
# @yieldparam node [RevTree] the current node being traversed
|
348
349
|
# @yieldparam full_path [String] the full path of the current node
|
349
350
|
# @return [void]
|
350
|
-
def self.traverse_tree(node, status_whitelist, current_path, &block)
|
351
|
+
def self.traverse_tree(node, status_whitelist, root, current_path, &block)
|
352
|
+
full_path = if current_path
|
353
|
+
File.join(current_path.to_s, node.name.to_s)
|
354
|
+
else
|
355
|
+
root
|
356
|
+
end
|
357
|
+
|
351
358
|
if node.type == :file && status_whitelist.include?(node.status)
|
352
359
|
block.call(node, File.expand_path(current_path.to_s))
|
353
360
|
end
|
354
361
|
|
355
|
-
full_path = File.join(current_path.to_s, node.name.to_s)
|
356
|
-
|
357
362
|
node.children.each do |child|
|
358
|
-
traverse_tree(child, status_whitelist, full_path, &block)
|
363
|
+
traverse_tree(child, status_whitelist, root, full_path, &block)
|
359
364
|
end
|
360
365
|
end
|
361
366
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revtree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Kahlert
|
@@ -66,7 +66,7 @@ licenses:
|
|
66
66
|
- MIT
|
67
67
|
metadata:
|
68
68
|
homepage_uri: https://juliankahlert.github.io/revtree/
|
69
|
-
documentation_uri: https://www.rubydoc.info/gems/revtree/0.1.
|
69
|
+
documentation_uri: https://www.rubydoc.info/gems/revtree/0.1.4
|
70
70
|
source_code_uri: https://github.com/juliankahlert/revtree
|
71
71
|
post_install_message:
|
72
72
|
rdoc_options: []
|