TwP-webby 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +35 -29
- data/{README.txt → README.rdoc} +9 -9
- data/Rakefile +9 -2
- data/examples/webby/content/communicate/index.txt +2 -2
- data/examples/webby/content/index.txt +1 -1
- data/examples/website/content/css/blueprint/ie.css +26 -0
- data/examples/website/content/css/blueprint/plugins/buttons/{Readme → readme.txt} +3 -2
- data/examples/website/content/css/blueprint/plugins/buttons/{buttons.css → screen.css} +1 -1
- data/examples/website/content/css/blueprint/plugins/fancy-type/readme.txt +14 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/{fancy-type.css → screen.css} +71 -74
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/doc.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/email.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/external.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/feed.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/im.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/pdf.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/visited.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/icons/xls.png +0 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/readme.txt +18 -0
- data/examples/website/content/css/blueprint/plugins/link-icons/screen.css +40 -0
- data/examples/website/content/css/blueprint/plugins/rtl/readme.txt +10 -0
- data/examples/website/content/css/blueprint/plugins/rtl/screen.css +109 -0
- data/examples/website/content/css/blueprint/print.css +30 -68
- data/examples/website/content/css/blueprint/screen.css +251 -22
- data/examples/website/content/css/blueprint/src/forms.css +49 -0
- data/examples/website/content/css/blueprint/src/grid.css +212 -0
- data/examples/website/content/css/blueprint/src/ie.css +59 -0
- data/examples/website/content/css/blueprint/src/print.css +85 -0
- data/examples/website/content/css/blueprint/{lib → src}/reset.css +14 -15
- data/examples/website/content/css/blueprint/src/typography.css +105 -0
- data/examples/website/layouts/default.txt +5 -2
- data/lib/webby/apps/main.rb +4 -1
- data/lib/webby/auto_builder.rb +3 -3
- data/lib/webby/builder.rb +5 -13
- data/lib/webby/filters/maruku.rb +16 -0
- data/lib/webby/filters/outline.rb +1 -1
- data/lib/webby/link_validator.rb +59 -51
- data/lib/webby/tasks/create.rake +4 -1
- data/lib/webby/tasks/validate.rake +1 -1
- data/lib/webby.rb +14 -3
- data/spec/data/html/anchor.html +11 -0
- data/spec/data/html/external.html +10 -0
- data/spec/data/html/invalid-relative.html +10 -0
- data/spec/data/html/relative-anchor.html +10 -0
- data/spec/data/html/relative-invalid-anchor.html +10 -0
- data/spec/data/html/relative.html +10 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/webby/filters/maruku_spec.rb +31 -0
- data/spec/webby/filters/textile_spec.rb +15 -4
- data/spec/webby/link_validator_spec.rb +154 -0
- data/tasks/mswin32.rake +38 -0
- data/tasks/website.rake +0 -1
- metadata +52 -24
- data/examples/website/content/css/blueprint/License.txt +0 -21
- data/examples/website/content/css/blueprint/Readme.txt +0 -100
- data/examples/website/content/css/blueprint/compressed/print.css +0 -76
- data/examples/website/content/css/blueprint/compressed/screen.css +0 -696
- data/examples/website/content/css/blueprint/lib/forms.css +0 -45
- data/examples/website/content/css/blueprint/lib/grid.css +0 -193
- data/examples/website/content/css/blueprint/lib/ie.css +0 -30
- data/examples/website/content/css/blueprint/lib/typography.css +0 -116
- data/examples/website/content/css/blueprint/plugins/css-classes/Readme +0 -14
- data/examples/website/content/css/blueprint/plugins/css-classes/css-classes.css +0 -24
- data/examples/website/content/css/blueprint/plugins/fancy-type/Readme +0 -22
- data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +0 -5
- data/tasks/ann.rake +0 -81
- data/tasks/bones.rake +0 -21
- data/tasks/gem.rake +0 -187
- data/tasks/git.rake +0 -41
- data/tasks/manifest.rake +0 -48
- data/tasks/notes.rake +0 -28
- data/tasks/post_load.rake +0 -39
- data/tasks/rdoc.rake +0 -51
- data/tasks/rubyforge.rake +0 -55
- data/tasks/setup.rb +0 -268
- data/tasks/spec.rake +0 -55
- /data/examples/website/content/css/blueprint/{lib → src}/grid.png +0 -0
data/lib/webby/link_validator.rb
CHANGED
@@ -56,18 +56,18 @@ class LinkValidator
|
|
56
56
|
@log.info "validating #{fn}"
|
57
57
|
|
58
58
|
dir = ::File.dirname(fn)
|
59
|
-
|
59
|
+
doc = Hpricot(::File.read(fn))
|
60
60
|
|
61
61
|
::Webby.site.xpaths.each do |xpath|
|
62
62
|
@attr_name = nil
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
uri = URI.parse(element.get_attribute(
|
67
|
-
validate_uri(uri, dir)
|
64
|
+
doc.search(xpath).each do |element|
|
65
|
+
attr_name ||= @attr_rgxp.match(xpath)[1]
|
66
|
+
uri = URI.parse(element.get_attribute(attr_name))
|
67
|
+
validate_uri(uri, dir, doc)
|
68
68
|
end
|
69
69
|
end
|
70
|
-
|
70
|
+
return nil # side effect of original implementation
|
71
71
|
end
|
72
72
|
|
73
73
|
# Validate the the page the _uri_ refers to actually exists. The directory
|
@@ -80,54 +80,15 @@ class LinkValidator
|
|
80
80
|
# will only take place if the LinkValidator was created with the :external
|
81
81
|
# flag set to true.
|
82
82
|
#
|
83
|
-
def validate_uri( uri, dir )
|
84
|
-
#
|
85
|
-
if uri.
|
86
|
-
return validate_anchor(uri, @doc) if uri.path.empty?
|
87
|
-
|
88
|
-
path = if uri.path =~ %r/^\//
|
89
|
-
::File.join(::Webby.site.output_dir, uri.path)
|
90
|
-
else
|
91
|
-
::File.join(dir, uri.path)
|
92
|
-
end
|
93
|
-
path = ::File.join(path, 'index.html') if ::File.extname(path).empty?
|
94
|
-
|
95
|
-
uri_str = path.dup
|
96
|
-
(uri_str << '#' << uri.fragment) if uri.fragment
|
97
|
-
return if @valid_uris.include? uri_str
|
98
|
-
|
99
|
-
if test ?f, path
|
100
|
-
valid = if uri.fragment
|
101
|
-
validate_anchor(uri, Hpricot(::File.read(path)))
|
102
|
-
else true end
|
103
|
-
@valid_uris << uri_str if valid
|
104
|
-
else
|
105
|
-
@log.error "invalid URI '#{uri.to_s}'"
|
106
|
-
end
|
107
|
-
|
108
|
-
# if the URI responds to the open mehod, then try to access the URI
|
109
|
-
elsif uri.respond_to? :open
|
110
|
-
return unless @validate_externals
|
111
|
-
return if @valid_uris.include? uri.to_s
|
83
|
+
def validate_uri( uri, dir, doc )
|
84
|
+
# do not retry external uris that have already been validated
|
85
|
+
return if @valid_uris.include? uri.to_s
|
112
86
|
|
113
|
-
|
114
|
-
|
115
|
-
return
|
116
|
-
end
|
117
|
-
|
118
|
-
begin
|
119
|
-
uri.open {|_| nil}
|
120
|
-
@valid_uris << uri.to_s
|
121
|
-
rescue Exception
|
122
|
-
@log.error "could not open URI '#{uri.to_s}'"
|
123
|
-
@invalid_uris << uri.to_s
|
124
|
-
end
|
87
|
+
return validate_relative_uri(uri, dir, doc) if uri.relative?
|
88
|
+
return validate_external_uri(uri, dir, doc) if uri.respond_to? :open
|
125
89
|
|
126
90
|
# otherwise, post a warning that the URI could not be validated
|
127
|
-
|
128
|
-
return if @valid_uris.include? uri.to_s
|
129
|
-
@log.warn "could not validate URI '#{uri.to_s}'"
|
130
|
-
end
|
91
|
+
@log.warn "could not validate URI '#{uri.to_s}'"
|
131
92
|
end
|
132
93
|
|
133
94
|
# Validate that the anchor fragment of the URI exists in the given
|
@@ -146,6 +107,53 @@ class LinkValidator
|
|
146
107
|
else true end
|
147
108
|
end
|
148
109
|
|
110
|
+
# Validate that the file pointed to by the relative URI exists in the output
|
111
|
+
# directory. If the URI has an anchor, validate that the anchor exists as
|
112
|
+
# well.
|
113
|
+
#
|
114
|
+
def validate_relative_uri( uri, dir, doc )
|
115
|
+
return validate_anchor(uri, doc) if uri.path.empty?
|
116
|
+
|
117
|
+
path = if uri.path =~ %r/^\//
|
118
|
+
::File.join(::Webby.site.output_dir, uri.path)
|
119
|
+
else
|
120
|
+
::File.join(dir, uri.path)
|
121
|
+
end
|
122
|
+
path = ::File.join(path, 'index.html') if ::File.extname(path).empty?
|
123
|
+
|
124
|
+
uri_str = path.dup
|
125
|
+
(uri_str << '#' << uri.fragment) if uri.fragment
|
126
|
+
return if @valid_uris.include? uri_str
|
127
|
+
|
128
|
+
if test ?f, path
|
129
|
+
valid = if uri.fragment
|
130
|
+
validate_anchor(uri, Hpricot(::File.read(path)))
|
131
|
+
else true end
|
132
|
+
@valid_uris << uri_str if valid
|
133
|
+
else
|
134
|
+
@log.error "invalid URI '#{uri.to_s}'"
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Validate that an external URI can be opened
|
139
|
+
#
|
140
|
+
def validate_external_uri( uri, dir, doc )
|
141
|
+
return unless @validate_externals
|
142
|
+
|
143
|
+
if @invalid_uris.include? uri.to_s
|
144
|
+
@log.error "could not open URI '#{uri.to_s}'"
|
145
|
+
return
|
146
|
+
end
|
147
|
+
|
148
|
+
begin
|
149
|
+
uri.open {|_| nil}
|
150
|
+
@valid_uris << uri.to_s
|
151
|
+
rescue Exception
|
152
|
+
@log.error "could not open URI '#{uri.to_s}'"
|
153
|
+
@invalid_uris << uri.to_s
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
149
157
|
end # class LinkValidator
|
150
158
|
end # module Webby
|
151
159
|
|
data/lib/webby/tasks/create.rake
CHANGED
@@ -13,7 +13,10 @@ namespace :create do
|
|
13
13
|
page, title, dir = Webby::Builder.new_page_info
|
14
14
|
page = Webby::Builder.create(page, :from => template,
|
15
15
|
:locals => {:title => title, :directory => dir})
|
16
|
-
|
16
|
+
unless ::Webby.editor.nil?
|
17
|
+
args = [::Webby.editor.split, page].flatten
|
18
|
+
exec(*args)
|
19
|
+
end
|
17
20
|
end
|
18
21
|
end # each
|
19
22
|
|
data/lib/webby.rb
CHANGED
@@ -10,7 +10,7 @@ require 'date'
|
|
10
10
|
module Webby
|
11
11
|
|
12
12
|
# :stopdoc:
|
13
|
-
VERSION = '0.9.
|
13
|
+
VERSION = '0.9.4' # :nodoc:
|
14
14
|
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
|
15
15
|
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
|
16
16
|
YAML_SEP = '---'
|
@@ -42,9 +42,9 @@ module Webby
|
|
42
42
|
:blog_dir => 'blog',
|
43
43
|
:tumblog_dir => 'tumblog',
|
44
44
|
|
45
|
-
# Items for running the
|
45
|
+
# Items for running the embedded webserver
|
46
46
|
:use_web_server => true,
|
47
|
-
:
|
47
|
+
:web_port => 4331,
|
48
48
|
|
49
49
|
# Items used to deploy the website
|
50
50
|
:user => ENV['USER'] || ENV['USERNAME'],
|
@@ -192,6 +192,17 @@ module Webby
|
|
192
192
|
Logging::Logger['Webby'].warn msg
|
193
193
|
end
|
194
194
|
|
195
|
+
# Scan the <code>layouts/</code> folder and the <code>content/</code>
|
196
|
+
# folder and create a new Resource object for each file found there.
|
197
|
+
#
|
198
|
+
def self.load_files
|
199
|
+
::Find.find(site.layout_dir, site.content_dir) do |path|
|
200
|
+
next unless test ?f, path
|
201
|
+
next if path =~ ::Webby.exclude
|
202
|
+
Resources.new path
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
195
206
|
end # module Webby
|
196
207
|
|
197
208
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="#anchor"></a>
|
9
|
+
<a id="anchor"></a>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="http://www.google.com"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="/invalid.html"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="/anchor.html#anchor"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="/anchor.html#invalid"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Anchor</title>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<a href="/anchor.html"></a>
|
9
|
+
</body>
|
10
|
+
</html>
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,13 @@ require 'rubygems'
|
|
7
7
|
require 'fileutils'
|
8
8
|
require 'stringio'
|
9
9
|
|
10
|
+
begin
|
11
|
+
require 'fake_web'
|
12
|
+
$test_externals = true
|
13
|
+
rescue LoadError
|
14
|
+
$test_externals = false
|
15
|
+
end
|
16
|
+
|
10
17
|
require File.expand_path(
|
11
18
|
File.join(File.dirname(__FILE__), %w[.. lib webby]))
|
12
19
|
|
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
require ::File.expand_path(
|
3
|
+
::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
|
4
|
+
|
5
|
+
# ---------------------------------------------------------------------------
|
6
|
+
describe 'Webby::Filters::Maruku' do
|
7
|
+
|
8
|
+
it 'should regsiter the maruku filter handler' do
|
9
|
+
Webby::Filters._handlers['maruku'].should_not be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
if try_require('maruku')
|
13
|
+
|
14
|
+
it 'processes maruku markup into HTML' do
|
15
|
+
input = "## Heading Two\n\nAnd some text about this heading."
|
16
|
+
output = Webby::Filters._handlers['maruku'].call(input)
|
17
|
+
|
18
|
+
output.should == %Q{<h2 id='heading_two'>Heading Two</h2>\n\n<p>And some text about this heading.</p>}
|
19
|
+
end
|
20
|
+
|
21
|
+
else
|
22
|
+
|
23
|
+
it 'raises an error when maruku is used but not installed' do
|
24
|
+
input = "## Heading Two\n\nAnd some text about this heading."
|
25
|
+
lambda {Webby::Filters._handlers['maruku'].call(input)}.should raise_error(Webby::Error, "'maruku' must be installed to use the maruku filter")
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# EOF
|
@@ -9,11 +9,22 @@ describe 'Webby::Filters::Textile' do
|
|
9
9
|
Webby::Filters._handlers['textile'].should_not be_nil
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
if try_require('redcloth')
|
13
|
+
|
14
|
+
it 'processes textile markup into HTML' do
|
15
|
+
input = "p(foo). this is a paragraph of text"
|
16
|
+
output = Webby::Filters._handlers['textile'].call(input)
|
17
|
+
|
18
|
+
output.should == %q{<p class="foo">this is a paragraph of text</p>}
|
19
|
+
end
|
20
|
+
|
21
|
+
else
|
22
|
+
|
23
|
+
it 'raises an error when RedCloth is used but not installed' do
|
24
|
+
input = "p(foo). this is a paragraph of text"
|
25
|
+
lambda {Webby::Filters._handlers['textile'].call(input)}.should raise_error(Webby::Error, "'RedCloth' must be installed to use the textile filter")
|
26
|
+
end
|
15
27
|
|
16
|
-
output.should == %q{<p class="foo">this is a paragraph of text</p>}
|
17
28
|
end
|
18
29
|
end
|
19
30
|
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require File.expand_path(
|
2
|
+
File.join(File.dirname(__FILE__), %w[.. spec_helper]))
|
3
|
+
|
4
|
+
# ---------------------------------------------------------------------------
|
5
|
+
describe Webby::LinkValidator do
|
6
|
+
before do
|
7
|
+
@validator = Webby::LinkValidator.new
|
8
|
+
@@old = Webby.site.output_dir
|
9
|
+
Webby.site.output_dir = Webby.datapath('html')
|
10
|
+
end
|
11
|
+
|
12
|
+
after do
|
13
|
+
Webby.site.output_dir = @@old
|
14
|
+
end
|
15
|
+
|
16
|
+
describe ".validate" do
|
17
|
+
it "passes options to a new validator" do
|
18
|
+
new_validator = stub('validator', :validate => true)
|
19
|
+
Webby::LinkValidator.should_receive(:new).with(:options).and_return(new_validator)
|
20
|
+
Webby::LinkValidator.validate(:options)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "checks each file" do
|
24
|
+
#TODO: test fake site
|
25
|
+
files = ["a file", "another file"]
|
26
|
+
Dir.stub!(:glob).and_return(files)
|
27
|
+
|
28
|
+
validator = Webby::LinkValidator.new
|
29
|
+
files.each do |file|
|
30
|
+
validator.should_receive(:check_file).with(file)
|
31
|
+
end
|
32
|
+
validator.validate
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "checking a file" do
|
37
|
+
describe "with an anchor" do
|
38
|
+
before do
|
39
|
+
@filename = Webby.datapath('html', 'anchor.html')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "validates the anchor" do
|
43
|
+
@validator.should_receive(:validate_anchor)
|
44
|
+
@validator.check_file(@filename)
|
45
|
+
end
|
46
|
+
|
47
|
+
it "does not add the file to the valid uri list" do
|
48
|
+
lambda { @validator.check_file(@filename) }.should_not change(@validator.instance_variable_get('@valid_uris'), :size)
|
49
|
+
end
|
50
|
+
|
51
|
+
it "***CURRENTLY*** returns nil" do
|
52
|
+
@validator.check_file(@filename).should be_nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "with a valid relative href" do
|
57
|
+
before do
|
58
|
+
@filename = Webby.datapath('html', 'relative.html')
|
59
|
+
end
|
60
|
+
|
61
|
+
it "adds the file to the valid uri list" do
|
62
|
+
lambda { @validator.check_file(@filename) }.should change(@validator.instance_variable_get('@valid_uris'), :size).by(1)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "***CURRENTLY*** returns nil" do
|
66
|
+
@validator.check_file(@filename).should be_nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "with an invalid relative href" do
|
71
|
+
before do
|
72
|
+
@filename = Webby.datapath('html', 'invalid-relative.html')
|
73
|
+
end
|
74
|
+
|
75
|
+
it "does not add the file to the invalid uri list" do
|
76
|
+
lambda { @validator.check_file(@filename) }.should_not change(@validator.instance_variable_get('@valid_uris'), :size)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "***CURRENTLY*** returns nil" do
|
80
|
+
@validator.check_file(@filename).should be_nil
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "with a valid relative href that contains an anchor" do
|
85
|
+
before do
|
86
|
+
@filename = Webby.datapath('html', 'relative-anchor.html')
|
87
|
+
end
|
88
|
+
|
89
|
+
it "adds the file to the valid uri list" do
|
90
|
+
lambda { @validator.check_file(@filename) }.should change(@validator.instance_variable_get('@valid_uris'), :size).by(1)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "***CURRENTLY*** returns nil" do
|
94
|
+
@validator.check_file(@filename).should be_nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "with a valid relative href that contains an invalid anchor" do
|
99
|
+
before do
|
100
|
+
@filename = Webby.datapath('html', 'relative-invalid-anchor.html')
|
101
|
+
end
|
102
|
+
|
103
|
+
it "does not the file to the valid uri list" do
|
104
|
+
lambda { @validator.check_file(@filename) }.should_not change(@validator.instance_variable_get('@valid_uris'), :size)
|
105
|
+
end
|
106
|
+
|
107
|
+
it "***CURRENTLY*** returns nil" do
|
108
|
+
@validator.check_file(@filename).should be_nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
if $test_externals
|
113
|
+
describe "with a valid external href" do
|
114
|
+
before do
|
115
|
+
FakeWeb.register_uri('http://www.google.com/', :string => 'google')
|
116
|
+
@filename = Webby.datapath('html', 'external.html')
|
117
|
+
@validator.validate_externals = true
|
118
|
+
end
|
119
|
+
|
120
|
+
it "adds the file to the valid uri list" do
|
121
|
+
lambda { @validator.check_file(@filename) }.should change(@validator.instance_variable_get('@valid_uris'), :size).by(1)
|
122
|
+
end
|
123
|
+
|
124
|
+
it "does not add the file to the invalid uri list" do
|
125
|
+
lambda { @validator.check_file(@filename) }.should_not change(@validator.instance_variable_get('@invalid_uris'), :size)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "***CURRENTLY*** returns nil" do
|
129
|
+
@validator.check_file(@filename).should be_nil
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
describe "with an invalid external href" do
|
134
|
+
before do
|
135
|
+
FakeWeb.register_uri('http://www.google.com/', :string => 'google', :status => [ 404, "Not Found" ])
|
136
|
+
@filename = Webby.datapath('html', 'external.html')
|
137
|
+
@validator.validate_externals = true
|
138
|
+
end
|
139
|
+
|
140
|
+
it "does not add the file to the valid uri list" do
|
141
|
+
lambda { @validator.check_file(@filename) }.should_not change(@validator.instance_variable_get('@valid_uris'), :size)
|
142
|
+
end
|
143
|
+
|
144
|
+
it "adds the file to the invalid uri list" do
|
145
|
+
lambda { @validator.check_file(@filename) }.should change(@validator.instance_variable_get('@invalid_uris'), :size).by(1)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "***CURRENTLY*** returns nil" do
|
149
|
+
@validator.check_file(@filename).should be_nil
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
data/tasks/mswin32.rake
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
require 'find'
|
3
|
+
|
4
|
+
namespace 'gem:mswin32' do
|
5
|
+
|
6
|
+
win32_spec = PROJ.gem._spec.dup
|
7
|
+
win32_spec.platform = 'x86-mswin32'
|
8
|
+
win32_spec.files = PROJ.gem.files
|
9
|
+
|
10
|
+
pkg = Bones::GemPackageTask.new(win32_spec)
|
11
|
+
class << pkg
|
12
|
+
def package_dir_path() "#{package_dir}/#{package_name}-x86-mswin32"; end
|
13
|
+
end
|
14
|
+
pkg.define
|
15
|
+
|
16
|
+
file "#{pkg.package_dir_path}/#{pkg.gem_file}" => :unix2dos
|
17
|
+
|
18
|
+
task :unix2dos do
|
19
|
+
reject = %w[.gif .jpg .jpeg]
|
20
|
+
Find.find(File.join(pkg.package_dir_path, 'examples')) do |fn|
|
21
|
+
next unless test(?f, fn)
|
22
|
+
next if reject.include?(File.extname(fn))
|
23
|
+
sh %{unix2dos #{fn}}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end # namespace 'gem:mswin32'
|
27
|
+
|
28
|
+
|
29
|
+
task :gem => 'gem:mswin32:package'
|
30
|
+
task :clobber => 'gem:mswin32:clobber_package'
|
31
|
+
|
32
|
+
remove_desc_for_task(%w[
|
33
|
+
gem:mswin32:clobber_package
|
34
|
+
gem:mswin32:package
|
35
|
+
gem:mswin32:repackage
|
36
|
+
])
|
37
|
+
|
38
|
+
# EOF
|
data/tasks/website.rake
CHANGED