stowaway 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -2
- data/VERSION.yml +1 -1
- data/bin/.stowaway.swp +0 -0
- data/bin/stowaway +2 -2
- data/lib/stowaway/locator.rb +1 -1
- data/lib/stowaway/sweeper.rb +3 -3
- data/pkg/stowaway-0.0.1.gem +0 -0
- data/spec/lib/sweeper_spec.rb +4 -3
- data/spec/runner_spec.rb +1 -1
- data/stowaway.gemspec +4 -2
- metadata +4 -2
data/README.md
CHANGED
@@ -11,8 +11,9 @@ Stowaway is a gem that searches a web project for files that aren't being used.
|
|
11
11
|
|
12
12
|
## Installing
|
13
13
|
|
14
|
-
sudo gem install
|
14
|
+
sudo gem install stowaway
|
15
15
|
|
16
16
|
## Note
|
17
17
|
|
18
|
-
I'll be adding support for matching on relative and absolute paths. Currently, only file names are being checked for matches. If you have two files with the same name but they reside in different directories, they will be treated as one.
|
18
|
+
I'll be adding support for matching on relative and absolute paths (Comparing by path will preserve the uniqueness of the file). Currently, only file names are being checked for matches. If you have two files with the same name but they reside in different directories, they will be treated as one. In other words, if you have multiple files with the *same name*, stowaway won't work right.
|
19
|
+
|
data/VERSION.yml
CHANGED
data/bin/.stowaway.swp
ADDED
Binary file
|
data/bin/stowaway
CHANGED
data/lib/stowaway/locator.rb
CHANGED
data/lib/stowaway/sweeper.rb
CHANGED
@@ -6,18 +6,18 @@ module Stowaway
|
|
6
6
|
|
7
7
|
def initialize(files_to_find, ext_to_ignore = nil)
|
8
8
|
@files_to_find = files_to_find
|
9
|
-
@ignore = ext_to_ignore || [
|
9
|
+
@ignore = ext_to_ignore || [/^\.|\.jpg$|\.gif$|.png$/i]
|
10
10
|
end
|
11
11
|
|
12
12
|
def inspect_file(file)
|
13
13
|
File.open(file, 'r') do |i|
|
14
14
|
while line = i.gets
|
15
|
-
|
15
|
+
remove_match(line)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def remove_match(line)
|
21
21
|
@files_to_find.delete_if { |file| line.include?(file.name) }
|
22
22
|
end
|
23
23
|
|
Binary file
|
data/spec/lib/sweeper_spec.rb
CHANGED
@@ -8,7 +8,8 @@ describe Stowaway::Sweeper do
|
|
8
8
|
@f1 = Stowaway::FileObj.new('/fake/file1.jpg')
|
9
9
|
@f2 = Stowaway::FileObj.new('/fake/file2.gif')
|
10
10
|
@f3 = Stowaway::FileObj.new('/fake/file3.js')
|
11
|
-
@
|
11
|
+
@f4 = Stowaway::FileObj.new('/fake/also/file3.js')
|
12
|
+
@files = [@f1, @f2, @f3, @f4]
|
12
13
|
@sweeper = Stowaway::Sweeper.new(@files)
|
13
14
|
end
|
14
15
|
|
@@ -24,12 +25,12 @@ describe Stowaway::Sweeper do
|
|
24
25
|
|
25
26
|
it "should read through the file looking for matches" do
|
26
27
|
@sweeper.inspect_file('spec/data/testfile1.txt')
|
27
|
-
@files.should == [@f3]
|
28
|
+
@files.should == [@f3, @f4]
|
28
29
|
end
|
29
30
|
|
30
31
|
it "should remove matches from the list of files to find" do
|
31
32
|
line = 'file2.gif, file3.js'
|
32
|
-
@sweeper.
|
33
|
+
@sweeper.remove_match line
|
33
34
|
@files.should == [@f1]
|
34
35
|
end
|
35
36
|
|
data/spec/runner_spec.rb
CHANGED
data/stowaway.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{stowaway}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Emilio Cavazos"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-10-02}
|
13
13
|
s.default_executable = %q{stowaway}
|
14
14
|
s.email = %q{ejcavazos@gmail.com}
|
15
15
|
s.executables = ["stowaway"]
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"Rakefile",
|
24
24
|
"TODO.txt",
|
25
25
|
"VERSION.yml",
|
26
|
+
"bin/.stowaway.swp",
|
26
27
|
"bin/stowaway",
|
27
28
|
"lib/stowaway/file.rb",
|
28
29
|
"lib/stowaway/fshelpyhelp.rb",
|
@@ -30,6 +31,7 @@ Gem::Specification.new do |s|
|
|
30
31
|
"lib/stowaway/options.rb",
|
31
32
|
"lib/stowaway/runner.rb",
|
32
33
|
"lib/stowaway/sweeper.rb",
|
34
|
+
"pkg/stowaway-0.0.1.gem",
|
33
35
|
"spec/data/testfile1.txt",
|
34
36
|
"spec/data/testfile2.txt",
|
35
37
|
"spec/lib/file_spec.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stowaway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emilio Cavazos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-02 00:00:00 -07:00
|
13
13
|
default_executable: stowaway
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -28,6 +28,7 @@ files:
|
|
28
28
|
- Rakefile
|
29
29
|
- TODO.txt
|
30
30
|
- VERSION.yml
|
31
|
+
- bin/.stowaway.swp
|
31
32
|
- bin/stowaway
|
32
33
|
- lib/stowaway/file.rb
|
33
34
|
- lib/stowaway/fshelpyhelp.rb
|
@@ -35,6 +36,7 @@ files:
|
|
35
36
|
- lib/stowaway/options.rb
|
36
37
|
- lib/stowaway/runner.rb
|
37
38
|
- lib/stowaway/sweeper.rb
|
39
|
+
- pkg/stowaway-0.0.1.gem
|
38
40
|
- spec/data/testfile1.txt
|
39
41
|
- spec/data/testfile2.txt
|
40
42
|
- spec/lib/file_spec.rb
|