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 CHANGED
@@ -36,4 +36,4 @@ A simple directory crawler DSL.
36
36
 
37
37
  ## Copyright
38
38
 
39
- Copyright (c) 2010 rspeicher. See LICENSE for details.
39
+ Copyright (c) 2010 Robert Speicher. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -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
- instance_eval(&block)
53
+ yield self
54
54
 
55
55
  if File.file?(current)
56
56
  dispatch_file(current)
@@ -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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wriggle}
8
- s.version = "1.0.0"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["rspeicher"]
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: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 0
10
- version: 1.0.0
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - rspeicher