wriggle 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/wriggle.rb +5 -5
- data/spec/wriggle_spec.rb +8 -8
- data/wriggle.gemspec +1 -1
- metadata +3 -3
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/lib/wriggle.rb
CHANGED
@@ -8,22 +8,22 @@ require 'find'
|
|
8
8
|
#
|
9
9
|
# require 'wriggle'
|
10
10
|
#
|
11
|
-
# wriggle '/path/to/files' do
|
11
|
+
# wriggle '/path/to/files' do |w|
|
12
12
|
#
|
13
13
|
# # Build an array of Ruby code files
|
14
14
|
# ruby_files = []
|
15
|
-
# file :rb do |path|
|
15
|
+
# w.file :rb do |path|
|
16
16
|
# ruby_files << path
|
17
17
|
# end
|
18
18
|
#
|
19
19
|
# # Build an array of video files
|
20
20
|
# video_files = []
|
21
|
-
# file %w(mpg mpeg wmv avi mkv) do |path|
|
21
|
+
# w.file %w(mpg mpeg wmv avi mkv) do |path|
|
22
22
|
# video_files << path
|
23
23
|
# end
|
24
24
|
#
|
25
25
|
# # Delete directories that are empty
|
26
|
-
# directory do |path|
|
26
|
+
# w.directory do |path|
|
27
27
|
# Dir.rmdir(path) unless Dir.entries(path).length > 2
|
28
28
|
# end
|
29
29
|
# end
|
@@ -50,7 +50,7 @@ module Wriggle
|
|
50
50
|
|
51
51
|
def crawl(&block)
|
52
52
|
Find.find(root) do |current|
|
53
|
-
|
53
|
+
yield self
|
54
54
|
|
55
55
|
if File.file?(current)
|
56
56
|
dispatch_file(current)
|
data/spec/wriggle_spec.rb
CHANGED
@@ -22,13 +22,13 @@ describe Wriggle do
|
|
22
22
|
context "given a valid path" do
|
23
23
|
describe "#file" do
|
24
24
|
it "should raise an ArgumentError when not given a block" do
|
25
|
-
lambda { wriggle(valid_dir) { file } }.should raise_error(ArgumentError, /a block is required/)
|
25
|
+
lambda { wriggle(valid_dir) { |w| w.file } }.should raise_error(ArgumentError, /a block is required/)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should not include directories when only a file block is provided" do
|
29
29
|
actual = []
|
30
|
-
wriggle(valid_dir) do
|
31
|
-
file do |path|
|
30
|
+
wriggle(valid_dir) do |w|
|
31
|
+
w.file do |path|
|
32
32
|
actual << path
|
33
33
|
end
|
34
34
|
end
|
@@ -40,8 +40,8 @@ describe Wriggle do
|
|
40
40
|
|
41
41
|
it "should only include files of the type specified" do
|
42
42
|
actual = []
|
43
|
-
wriggle(valid_dir) do
|
44
|
-
file :rb do |path|
|
43
|
+
wriggle(valid_dir) do |w|
|
44
|
+
w.file :rb do |path|
|
45
45
|
actual << path
|
46
46
|
end
|
47
47
|
end
|
@@ -54,13 +54,13 @@ describe Wriggle do
|
|
54
54
|
|
55
55
|
describe "#directory" do
|
56
56
|
it "should raise an ArgumentError when not given a block" do
|
57
|
-
lambda { wriggle(valid_dir) { directory } }.should raise_error(ArgumentError, /a block is required/)
|
57
|
+
lambda { wriggle(valid_dir) { |w| w.directory } }.should raise_error(ArgumentError, /a block is required/)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should not include files when only a directory block is provided" do
|
61
61
|
actual = []
|
62
|
-
wriggle(valid_dir) do
|
63
|
-
directory do |path|
|
62
|
+
wriggle(valid_dir) do |w|
|
63
|
+
w.directory do |path|
|
64
64
|
actual << path
|
65
65
|
end
|
66
66
|
end
|
data/wriggle.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wriggle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- rspeicher
|