stowaway 0.2.2 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/stowaway +2 -2
- data/lib/stowaway/{file.rb → file_marker.rb} +2 -1
- data/lib/stowaway/locator.rb +7 -7
- data/lib/stowaway/matcher.rb +1 -1
- data/lib/stowaway/runner.rb +23 -17
- data/lib/stowaway/sweeper.rb +8 -14
- data/lib/stowaway/target_context.rb +14 -0
- data/spec/lib/file_spec.rb +9 -10
- data/spec/lib/locator_spec.rb +16 -16
- data/spec/lib/matcher_spec.rb +16 -16
- data/spec/lib/sweeper_spec.rb +29 -26
- data/spec/lib/target_context_spec.rb +22 -0
- data/spec/runner_spec.rb +4 -9
- data/spec/spec_helper.rb +8 -1
- data/stowaway.gemspec +6 -3
- metadata +6 -3
data/VERSION.yml
CHANGED
data/bin/stowaway
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "lib/stowaway/runner"
|
4
4
|
|
5
5
|
options = Stowaway::Options.new(ARGV)
|
6
6
|
locator = Stowaway::Locator.new(options.file_types)
|
7
7
|
sweeper = Stowaway::Sweeper.new
|
8
|
-
runner = Stowaway::Runner.new(options, locator, sweeper)
|
8
|
+
runner = Stowaway::Runner.new(options, locator, sweeper)
|
9
9
|
runner.run
|
data/lib/stowaway/locator.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require_relative
|
2
|
-
require_relative
|
1
|
+
require_relative "fshelpyhelp"
|
2
|
+
require_relative "file_marker"
|
3
3
|
|
4
4
|
module Stowaway
|
5
5
|
class Locator
|
@@ -10,18 +10,18 @@ module Stowaway
|
|
10
10
|
@ignore = [/^\./]
|
11
11
|
end
|
12
12
|
|
13
|
-
def find_all(
|
14
|
-
@
|
13
|
+
def find_all(target_context)
|
14
|
+
@context = target_context
|
15
15
|
@files = []
|
16
|
-
ignore_special_directories(@root)
|
17
|
-
recursively(
|
16
|
+
ignore_special_directories(@context.root)
|
17
|
+
recursively(@context.root) do |file_p|
|
18
18
|
push_if_ext_match(file_p)
|
19
19
|
end
|
20
20
|
@files
|
21
21
|
end
|
22
22
|
|
23
23
|
def push_if_ext_match(file_p)
|
24
|
-
@files <<
|
24
|
+
@files << FileMarker.new(file_p, @context.root) if type?(file_p)
|
25
25
|
end
|
26
26
|
|
27
27
|
def type?(file)
|
data/lib/stowaway/matcher.rb
CHANGED
data/lib/stowaway/runner.rb
CHANGED
@@ -1,30 +1,37 @@
|
|
1
|
-
require_relative
|
2
|
-
require_relative
|
3
|
-
require_relative
|
1
|
+
require_relative "options"
|
2
|
+
require_relative "locator"
|
3
|
+
require_relative "sweeper"
|
4
|
+
require_relative "target_context"
|
4
5
|
|
5
6
|
module Stowaway
|
6
7
|
class Runner
|
7
|
-
|
8
|
+
|
8
9
|
def initialize(options, locator, sweeper)
|
9
10
|
@options = options
|
10
11
|
@locator = locator
|
11
12
|
@sweeper = sweeper
|
12
13
|
end
|
13
|
-
|
14
|
+
|
15
|
+
#TODO: clean-up all the print and puts methods and use
|
14
16
|
def run
|
15
|
-
|
17
|
+
context = TargetContext.new(@options.path)
|
18
|
+
assets = locate_assets(context)
|
19
|
+
Dir.chdir(context.root)
|
20
|
+
puts "sweeping: #{Dir.pwd}"
|
21
|
+
display_results(@sweeper.sweep(context, assets))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def locate_assets(context)
|
16
27
|
print "\nLocating files ... "
|
17
|
-
assets = @locator.find_all(
|
28
|
+
assets = @locator.find_all(context)
|
18
29
|
print "#{assets.length} files located"
|
19
30
|
blank_lines
|
20
|
-
|
21
|
-
puts "sweeping: #{Dir.pwd}"
|
22
|
-
respond @sweeper.sweep(path, assets)
|
31
|
+
assets
|
23
32
|
end
|
24
|
-
|
25
|
-
private
|
26
33
|
|
27
|
-
def
|
34
|
+
def display_results(result)
|
28
35
|
files = result.files
|
29
36
|
name_only_matches = result.name_only_matches
|
30
37
|
|
@@ -37,23 +44,22 @@ module Stowaway
|
|
37
44
|
blank_lines
|
38
45
|
return
|
39
46
|
end
|
40
|
-
|
47
|
+
|
41
48
|
damage(result)
|
42
49
|
end
|
43
|
-
|
50
|
+
|
44
51
|
def damage(result)
|
45
52
|
files = result.files
|
46
53
|
name_only_matches = result.name_only_matches
|
47
54
|
|
48
55
|
print "\nYou have #{files.length} stowaway(s) ... scurvy dogs!\n"
|
49
|
-
warn name_only_matches
|
56
|
+
warn name_only_matches unless name_only_matches.empty?
|
50
57
|
60.times { print "-" }
|
51
58
|
blank_lines
|
52
59
|
files.each_with_index { |f, i| print "#{i+1}: #{f.root_path}\n" }
|
53
60
|
end
|
54
61
|
|
55
62
|
def warn name_only_matches
|
56
|
-
return if name_only_matches.empty?
|
57
63
|
print "WARNING: #{name_only_matches.length} file(s) partially matched on name only\n"
|
58
64
|
end
|
59
65
|
|
data/lib/stowaway/sweeper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require_relative "fshelpyhelp"
|
2
2
|
require_relative "output"
|
3
3
|
require_relative "matcher"
|
4
|
-
require_relative "
|
4
|
+
require_relative "file_marker"
|
5
5
|
require "ostruct"
|
6
6
|
|
7
7
|
module Stowaway
|
@@ -14,24 +14,23 @@ module Stowaway
|
|
14
14
|
include FSHelpyHelp
|
15
15
|
include Output
|
16
16
|
|
17
|
-
def initialize(matcher = Matcher.new
|
17
|
+
def initialize(matcher = Matcher.new)
|
18
18
|
@matcher = matcher
|
19
|
-
@ignore =
|
20
|
-
@ignore << /^\.|\.jpg$|\.jpeg$|\.gif$|\.png$|\.ico$|\.bmp$/i
|
19
|
+
@ignore = [/^\.|\.jpg$|\.jpeg$|\.gif$|\.png$|\.ico$|\.bmp$/i]
|
21
20
|
end
|
22
21
|
|
23
|
-
def sweep(
|
24
|
-
@
|
22
|
+
def sweep(target_context, files)
|
23
|
+
@context = target_context
|
25
24
|
@result = OpenStruct.new({ :files => files, :name_only_matches => []})
|
26
|
-
ignore_special_directories(@root)
|
27
|
-
recursively(
|
25
|
+
ignore_special_directories(@context.root)
|
26
|
+
recursively(@context.root) { |fp| inspect_file(fp) }
|
28
27
|
@result
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
32
31
|
|
33
32
|
def inspect_file(file_p)
|
34
|
-
clr_print(" => #{path_relative_to_root(file_p)}")
|
33
|
+
clr_print(" => #{@context.path_relative_to_root(file_p)}")
|
35
34
|
File.open(file_p, "r") do |i|
|
36
35
|
while line = i.gets
|
37
36
|
next unless line.valid_encoding?
|
@@ -41,11 +40,6 @@ module Stowaway
|
|
41
40
|
flush
|
42
41
|
end
|
43
42
|
|
44
|
-
def path_relative_to_root(file_p)
|
45
|
-
root = @root.split("/").last
|
46
|
-
file_p.sub(/^.+\/(#{root})/, "")
|
47
|
-
end
|
48
|
-
|
49
43
|
def remove_match(line)
|
50
44
|
@result.files.delete_if do |file|
|
51
45
|
if @matcher.match?(line, file)
|
data/spec/lib/file_spec.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "spec/spec_helper"
|
2
|
+
require "lib/stowaway/file_marker"
|
3
3
|
|
4
|
-
describe Stowaway::
|
5
|
-
|
4
|
+
describe Stowaway::FileMarker do
|
6
5
|
before(:all) do
|
7
|
-
@file = Stowaway::
|
6
|
+
@file = Stowaway::FileMarker.new('/fake/path/test.rb')
|
8
7
|
end
|
9
8
|
|
10
9
|
it "should return full path" do
|
@@ -19,11 +18,11 @@ describe Stowaway::FileObj do
|
|
19
18
|
@file.path.should == '/fake/path'
|
20
19
|
end
|
21
20
|
|
22
|
-
it "should be
|
23
|
-
@file.should == Stowaway::
|
21
|
+
it "should be equal if paths are the same" do
|
22
|
+
@file.should == Stowaway::FileMarker.new('/fake/path/test.rb')
|
24
23
|
end
|
25
24
|
|
26
|
-
it "should not be
|
27
|
-
@file.should_not == Stowaway::
|
25
|
+
it "should not be equal if paths are different" do
|
26
|
+
@file.should_not == Stowaway::FileMarker.new('/blah/test.rb')
|
28
27
|
end
|
29
|
-
end
|
28
|
+
end
|
data/spec/lib/locator_spec.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "spec/spec_helper"
|
2
|
+
require "lib/stowaway/file_marker"
|
3
|
+
require "lib/stowaway/locator"
|
4
|
+
require "lib/stowaway/target_context"
|
4
5
|
|
5
6
|
describe Stowaway::Locator do
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
let(:locator) { Stowaway::Locator.new(%w{.txt}) }
|
9
|
+
let(:context) { Stowaway::TargetContext.new("spec/data") }
|
10
|
+
|
11
11
|
it "should be initialized with an array of file extensions to locate" do
|
12
|
-
locator.find_all(
|
12
|
+
locator.find_all(context).length.should == 2
|
13
13
|
end
|
14
14
|
|
15
|
-
it "should return an array of
|
16
|
-
@f1 = Stowaway::
|
17
|
-
locator.find_all(
|
15
|
+
it "should return an array of FileMarker" do
|
16
|
+
@f1 = Stowaway::FileMarker.new("spec/data/testfile1.txt")
|
17
|
+
locator.find_all(context)[1].instance_of?(Stowaway::FileMarker).should be_true
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should return all matched files" do
|
21
|
-
@f1 = Stowaway::
|
22
|
-
@f2 = Stowaway::
|
23
|
-
locator.find_all(
|
21
|
+
@f1 = Stowaway::FileMarker.new("spec/data/testfile1.txt", "spec/data")
|
22
|
+
@f2 = Stowaway::FileMarker.new("spec/data/testfile2.txt", "spec/data")
|
23
|
+
locator.find_all(context).should == [@f1, @f2]
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should return true when file has the correct extension" do
|
27
|
-
locator.type?(
|
27
|
+
locator.type?("poop.txt").should be_true
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should return false when file doesn't have the correct extension" do
|
31
|
-
locator.type?(
|
31
|
+
locator.type?("poop.stink").should be_false
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
data/spec/lib/matcher_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "spec/spec_helper"
|
2
|
-
require "lib/stowaway/
|
2
|
+
require "lib/stowaway/file_marker"
|
3
3
|
require "lib/stowaway/matcher"
|
4
4
|
|
5
5
|
describe Stowaway::Matcher do
|
@@ -11,25 +11,25 @@ describe Stowaway::Matcher do
|
|
11
11
|
describe "when given html" do
|
12
12
|
it "should match files referenced from a src attribute" do
|
13
13
|
line = "test html: <img src='/images/foo.jpg' />"
|
14
|
-
file = Stowaway::
|
14
|
+
file = Stowaway::FileMarker.new("/images/foo.jpg")
|
15
15
|
@matcher.match?(line, file).should be_true
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should match files stored in /public referenced from a src attribute" do
|
19
19
|
line = "test html: <img src='/images/foo.jpg' />"
|
20
|
-
file = Stowaway::
|
20
|
+
file = Stowaway::FileMarker.new("/public/images/foo.jpg")
|
21
21
|
@matcher.match?(line, file).should be_true
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should match files referenced from an href attribute" do
|
25
25
|
line = "test html: <a href='/images/foo.gif'>bar</a>"
|
26
|
-
file = Stowaway::
|
26
|
+
file = Stowaway::FileMarker.new("/images/foo.gif")
|
27
27
|
@matcher.match?(line, file).should be_true
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should match files stored in /public referenced from an href attribute" do
|
31
31
|
line = "test html: <a href='/images/foo.gif'>bar</a>"
|
32
|
-
file = Stowaway::
|
32
|
+
file = Stowaway::FileMarker.new("/public/images/foo.gif")
|
33
33
|
@matcher.match?(line, file).should be_true
|
34
34
|
end
|
35
35
|
end
|
@@ -37,25 +37,25 @@ describe Stowaway::Matcher do
|
|
37
37
|
describe "when given haml" do
|
38
38
|
it "should match files referenced from a src attribute" do
|
39
39
|
line = "test haml: %img{ :src => '/images/foo.jpg', :alt => 'foo' }"
|
40
|
-
file = Stowaway::
|
40
|
+
file = Stowaway::FileMarker.new("/images/foo.jpg")
|
41
41
|
@matcher.match?(line, file).should be_true
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should match files stored in /public referenced from a src attribute" do
|
45
45
|
line = "test haml: %img{ :src => '/images/foo.jpg', :alt => 'foo' }"
|
46
|
-
file = Stowaway::
|
46
|
+
file = Stowaway::FileMarker.new("/public/images/foo.jpg")
|
47
47
|
@matcher.match?(line, file).should be_true
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should match files referenced from an href attribute" do
|
51
51
|
line = "%link{:href => '/styles/reset.css', :type => 'text/css'}"
|
52
|
-
file = Stowaway::
|
52
|
+
file = Stowaway::FileMarker.new("/styles/reset.css")
|
53
53
|
@matcher.match?(line, file).should be_true
|
54
54
|
end
|
55
55
|
|
56
56
|
it "should match files stored in /public referenced from a href attribute" do
|
57
57
|
line = "%link{:href => '/styles/reset.css', :type => 'text/css'}"
|
58
|
-
file = Stowaway::
|
58
|
+
file = Stowaway::FileMarker.new("/public/styles/reset.css")
|
59
59
|
@matcher.match?(line, file).should be_true
|
60
60
|
end
|
61
61
|
end
|
@@ -63,13 +63,13 @@ describe Stowaway::Matcher do
|
|
63
63
|
describe "when given javascript_include_tag" do
|
64
64
|
it "should match files referenced" do
|
65
65
|
line = "test rails: %=javascript_include_tag 'foo.js'"
|
66
|
-
file = Stowaway::
|
66
|
+
file = Stowaway::FileMarker.new("/public/javascripts/foo.js")
|
67
67
|
@matcher.match?(line, file).should be_true
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should match files referenced with multiple arguments" do
|
71
71
|
line = "test rails: =javascript_include_tag 'foo.js', 'test/bar.js'"
|
72
|
-
file = Stowaway::
|
72
|
+
file = Stowaway::FileMarker.new("/public/javascripts/test/bar.js")
|
73
73
|
@matcher.match?(line, file).should be_true
|
74
74
|
end
|
75
75
|
end
|
@@ -77,32 +77,32 @@ describe Stowaway::Matcher do
|
|
77
77
|
describe "when given stylesheet_link_tag" do
|
78
78
|
it "should match files referenced" do
|
79
79
|
line = "test rails: %=stylesheet_link_tag 'foo.css'"
|
80
|
-
file = Stowaway::
|
80
|
+
file = Stowaway::FileMarker.new("/public/stylesheets/foo.css")
|
81
81
|
@matcher.match?(line, file).should be_true
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should match files referenced" do
|
85
85
|
line = "test rails: %=stylesheet_link_tag 'foo.css', 'to/file/bar.css'"
|
86
|
-
file = Stowaway::
|
86
|
+
file = Stowaway::FileMarker.new("/public/stylesheets/to/file/bar.css")
|
87
87
|
@matcher.match?(line, file).should be_true
|
88
88
|
end
|
89
89
|
|
90
90
|
describe "when given css" do
|
91
91
|
it "should match files referenced in url()" do
|
92
92
|
line = "background: url('/images/foo.png') no-repeat"
|
93
|
-
file = Stowaway::
|
93
|
+
file = Stowaway::FileMarker.new("/images/foo.png")
|
94
94
|
@matcher.match?(line, file).should be_true
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should match files stored in /public referenced in url()" do
|
98
98
|
line = "background: url(\"/images/foo.png\") no-repeat"
|
99
|
-
file = Stowaway::
|
99
|
+
file = Stowaway::FileMarker.new("/public/images/foo.png")
|
100
100
|
@matcher.match?(line, file).should be_true
|
101
101
|
end
|
102
102
|
|
103
103
|
it "should match files referenced in url() without quotes" do
|
104
104
|
line = "background: url(/images/foo.png) no-repeat"
|
105
|
-
file = Stowaway::
|
105
|
+
file = Stowaway::FileMarker.new("/images/foo.png")
|
106
106
|
@matcher.match?(line, file).should be_true
|
107
107
|
end
|
108
108
|
end
|
data/spec/lib/sweeper_spec.rb
CHANGED
@@ -1,76 +1,79 @@
|
|
1
1
|
require "spec/spec_helper"
|
2
|
-
require "lib/stowaway/
|
2
|
+
require "lib/stowaway/file_marker"
|
3
3
|
require "lib/stowaway/sweeper"
|
4
4
|
require "lib/stowaway/matcher"
|
5
|
+
require "lib/stowaway/target_context"
|
5
6
|
require "spec/lib/io_mock.rb"
|
6
7
|
|
7
8
|
describe Stowaway::Sweeper do
|
8
9
|
|
9
|
-
Stowaway::
|
10
|
-
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:sweeper) { Stowaway::Sweeper.new(Stowaway::Matcher.new, @ignore) }
|
10
|
+
let(:sweeper) { Stowaway::Sweeper.new(Stowaway::Matcher.new) }
|
11
|
+
let(:context) { Stowaway::TargetContext.new("spec/data") }
|
14
12
|
|
15
13
|
before(:each) do
|
16
|
-
|
14
|
+
ignore(/^\.|\.rb$/)
|
15
|
+
sweeper.extend Silencer
|
16
|
+
end
|
17
|
+
|
18
|
+
def ignore(pattern)
|
19
|
+
sweeper.instance_eval { @ignore << pattern }
|
17
20
|
end
|
18
21
|
|
19
22
|
it "should remove files when a reference to the file is found in source" do
|
20
|
-
files = [Stowaway::
|
21
|
-
sweeper.sweep(
|
23
|
+
files = [Stowaway::FileMarker.new("/fake/path1/button.jpg")]
|
24
|
+
sweeper.sweep(context, files)
|
22
25
|
files.should be_empty
|
23
26
|
end
|
24
27
|
|
25
28
|
it "should return an OpenStruct with the result of the sweeping" do
|
26
|
-
result = sweeper.sweep(
|
29
|
+
result = sweeper.sweep(context, [])
|
27
30
|
result.files.should be_an_instance_of Array
|
28
31
|
result.name_only_matches.should be_an_instance_of Array
|
29
32
|
end
|
30
33
|
|
31
34
|
it "should not sweep through ignored file types" do
|
32
|
-
|
33
|
-
files = [Stowaway::
|
34
|
-
sweeper.sweep(
|
35
|
+
ignore(/\.txt$/)
|
36
|
+
files = [Stowaway::FileMarker.new("/fake/path1/button.jpg")]
|
37
|
+
sweeper.sweep(context, files)
|
35
38
|
files.length.should == 1
|
36
39
|
end
|
37
40
|
|
38
41
|
it "should print the path to the file (relative to root) being swept through" do
|
39
|
-
|
42
|
+
ignore(/testfile2/)
|
40
43
|
sweeper.should_receive(:clr_print).once.with(" => /testfile1.txt")
|
41
|
-
sweeper.sweep(
|
44
|
+
sweeper.sweep(context, [])
|
42
45
|
end
|
43
46
|
|
44
47
|
it "should flush the output after sweeping through a file" do
|
45
|
-
|
48
|
+
ignore(/testfile2/)
|
46
49
|
sweeper.should_receive(:flush).once
|
47
|
-
sweeper.sweep(
|
50
|
+
sweeper.sweep(context, [])
|
48
51
|
end
|
49
52
|
|
50
53
|
it "should files of the same name but with different paths as last resort" do
|
51
|
-
files = [Stowaway::
|
52
|
-
Stowaway::
|
53
|
-
sweeper.sweep(
|
54
|
+
files = [Stowaway::FileMarker.new("/fake/path1/button.jpg"),
|
55
|
+
Stowaway::FileMarker.new("/fake/path2/button.jpg")]
|
56
|
+
sweeper.sweep(context, files)
|
54
57
|
files.should be_empty
|
55
58
|
end
|
56
59
|
|
57
60
|
it "should add a file to an array of partially matched files when matched on name only" do
|
58
|
-
files = [Stowaway::
|
59
|
-
sweeper.sweep(
|
61
|
+
files = [Stowaway::FileMarker.new("/missing/button.jpg")]
|
62
|
+
sweeper.sweep(context, files).should have(1).name_only_matches
|
60
63
|
end
|
61
64
|
|
62
65
|
it "should not remove files that were not found" do
|
63
|
-
files = [Stowaway::
|
64
|
-
sweeper.sweep(
|
66
|
+
files = [Stowaway::FileMarker.new("/a/stowaway.txt")]
|
67
|
+
sweeper.sweep(context, files)
|
65
68
|
files.should_not be_empty
|
66
69
|
files.first.fullpath.should == "/a/stowaway.txt"
|
67
70
|
end
|
68
71
|
|
69
72
|
it "should ignore lines with invalid encoding" do
|
70
|
-
files = [Stowaway::
|
73
|
+
files = [Stowaway::FileMarker.new("/fake/path1/button.jpg")]
|
71
74
|
File.stub!(:open).and_yield(IOMock.new)
|
72
75
|
sweeper.should_not_receive(:remove_match)
|
73
|
-
sweeper.sweep(
|
76
|
+
sweeper.sweep(context, files)
|
74
77
|
end
|
75
78
|
|
76
79
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec/spec_helper"
|
2
|
+
require "lib/stowaway/target_context"
|
3
|
+
|
4
|
+
describe Stowaway::TargetContext do
|
5
|
+
|
6
|
+
let(:context) do
|
7
|
+
Stowaway::TargetContext.new(@root)
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
@root = "/fake/path/to/root/"
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return the path the object was intialized with" do
|
15
|
+
context.root.should == @root
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should transform path to be relative to the root directory" do
|
19
|
+
file_p = @root + "public/images/monkey_skull.gif"
|
20
|
+
context.path_relative_to_root(file_p).should == "/public/images/monkey_skull.gif"
|
21
|
+
end
|
22
|
+
end
|
data/spec/runner_spec.rb
CHANGED
@@ -1,11 +1,5 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
|
4
|
-
class Stowaway::Status
|
5
|
-
# mock so I don't look at noise
|
6
|
-
def out(msg); end
|
7
|
-
def flush; end
|
8
|
-
end
|
1
|
+
require "spec/spec_helper"
|
2
|
+
require "lib/stowaway/runner"
|
9
3
|
|
10
4
|
describe Stowaway::Runner do
|
11
5
|
|
@@ -18,6 +12,7 @@ describe Stowaway::Runner do
|
|
18
12
|
def runner
|
19
13
|
sweeper = Stowaway::Sweeper.new
|
20
14
|
@runner ||= Stowaway::Runner.new(@options, @locator, sweeper)
|
15
|
+
@runner.extend Silencer
|
21
16
|
end
|
22
17
|
|
23
18
|
describe "output" do
|
@@ -47,7 +42,7 @@ describe Stowaway::Runner do
|
|
47
42
|
end
|
48
43
|
|
49
44
|
it "should locate all assets" do
|
50
|
-
@locator.should_receive(:find_all).
|
45
|
+
@locator.should_receive(:find_all).and_return([])
|
51
46
|
runner.run
|
52
47
|
end
|
53
48
|
end
|
data/spec/spec_helper.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.2.
|
8
|
+
s.version = "0.2.5"
|
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{2010-03-
|
12
|
+
s.date = %q{2010-03-06}
|
13
13
|
s.default_executable = %q{stowaway}
|
14
14
|
s.email = %q{ejcavazos@gmail.com}
|
15
15
|
s.executables = ["stowaway"]
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
25
25
|
"TODO.txt",
|
26
26
|
"VERSION.yml",
|
27
27
|
"bin/stowaway",
|
28
|
-
"lib/stowaway/
|
28
|
+
"lib/stowaway/file_marker.rb",
|
29
29
|
"lib/stowaway/fshelpyhelp.rb",
|
30
30
|
"lib/stowaway/locator.rb",
|
31
31
|
"lib/stowaway/matcher.rb",
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/stowaway/output.rb",
|
34
34
|
"lib/stowaway/runner.rb",
|
35
35
|
"lib/stowaway/sweeper.rb",
|
36
|
+
"lib/stowaway/target_context.rb",
|
36
37
|
"spec/data/testfile1.txt",
|
37
38
|
"spec/data/testfile2.txt",
|
38
39
|
"spec/lib/file_spec.rb",
|
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
"spec/lib/options_spec.rb",
|
43
44
|
"spec/lib/output_spec.rb",
|
44
45
|
"spec/lib/sweeper_spec.rb",
|
46
|
+
"spec/lib/target_context_spec.rb",
|
45
47
|
"spec/runner_spec.rb",
|
46
48
|
"spec/spec.opts",
|
47
49
|
"spec/spec_helper.rb",
|
@@ -60,6 +62,7 @@ Gem::Specification.new do |s|
|
|
60
62
|
"spec/lib/options_spec.rb",
|
61
63
|
"spec/lib/output_spec.rb",
|
62
64
|
"spec/lib/sweeper_spec.rb",
|
65
|
+
"spec/lib/target_context_spec.rb",
|
63
66
|
"spec/runner_spec.rb",
|
64
67
|
"spec/spec_helper.rb"
|
65
68
|
]
|
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.2.
|
4
|
+
version: 0.2.5
|
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: 2010-03-
|
12
|
+
date: 2010-03-06 00:00:00 -08:00
|
13
13
|
default_executable: stowaway
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -30,7 +30,7 @@ files:
|
|
30
30
|
- TODO.txt
|
31
31
|
- VERSION.yml
|
32
32
|
- bin/stowaway
|
33
|
-
- lib/stowaway/
|
33
|
+
- lib/stowaway/file_marker.rb
|
34
34
|
- lib/stowaway/fshelpyhelp.rb
|
35
35
|
- lib/stowaway/locator.rb
|
36
36
|
- lib/stowaway/matcher.rb
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/stowaway/output.rb
|
39
39
|
- lib/stowaway/runner.rb
|
40
40
|
- lib/stowaway/sweeper.rb
|
41
|
+
- lib/stowaway/target_context.rb
|
41
42
|
- spec/data/testfile1.txt
|
42
43
|
- spec/data/testfile2.txt
|
43
44
|
- spec/lib/file_spec.rb
|
@@ -47,6 +48,7 @@ files:
|
|
47
48
|
- spec/lib/options_spec.rb
|
48
49
|
- spec/lib/output_spec.rb
|
49
50
|
- spec/lib/sweeper_spec.rb
|
51
|
+
- spec/lib/target_context_spec.rb
|
50
52
|
- spec/runner_spec.rb
|
51
53
|
- spec/spec.opts
|
52
54
|
- spec/spec_helper.rb
|
@@ -87,5 +89,6 @@ test_files:
|
|
87
89
|
- spec/lib/options_spec.rb
|
88
90
|
- spec/lib/output_spec.rb
|
89
91
|
- spec/lib/sweeper_spec.rb
|
92
|
+
- spec/lib/target_context_spec.rb
|
90
93
|
- spec/runner_spec.rb
|
91
94
|
- spec/spec_helper.rb
|