nanoc3 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS.md +7 -0
- data/lib/nanoc3/cli/commands/create_layout.rb +1 -1
- data/lib/nanoc3/cli/commands/create_site.rb +1 -1
- data/lib/nanoc3/cli/commands/info.rb +1 -1
- data/lib/nanoc3/cli/commands/update.rb +1 -1
- data/lib/nanoc3/cli/commands/watch.rb +4 -7
- data/lib/nanoc3/filters/colorize_syntax.rb +2 -2
- data/lib/nanoc3/filters/relativize_paths.rb +2 -2
- data/lib/nanoc3.rb +1 -1
- data/test/filters/test_colorize_syntax.rb +57 -0
- data/test/filters/test_relativize_paths.rb +48 -0
- data/test/helper.rb +8 -0
- metadata +89 -81
- data/Gemfile.lock +0 -92
data/NEWS.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.2.2 (2011-09-04)
|
4
|
+
|
5
|
+
* Fixed command usage printing
|
6
|
+
* Made relativize_paths filter handle Windows network paths [Ruben Verborgh]
|
7
|
+
* Made watcher use correct configuration
|
8
|
+
* Allowed code blocks to start with a non-language shebang line
|
9
|
+
|
3
10
|
## 3.2.1 (2011-07-27)
|
4
11
|
|
5
12
|
* Made `@config` available in rules file
|
@@ -18,6 +18,8 @@ module Nanoc3::CLI::Commands
|
|
18
18
|
require 'fssm'
|
19
19
|
require 'pathname'
|
20
20
|
|
21
|
+
watcher_config = self.site.config[:watcher] || {}
|
22
|
+
|
21
23
|
@notifier = Notifier.new
|
22
24
|
|
23
25
|
# Define rebuilder
|
@@ -43,9 +45,7 @@ module Nanoc3::CLI::Commands
|
|
43
45
|
site.compile
|
44
46
|
|
45
47
|
# TODO include icon (--image misc/success-icon.png)
|
46
|
-
notify_on_compilation_success =
|
47
|
-
site.config[:notify_on_compilation_success] :
|
48
|
-
true
|
48
|
+
notify_on_compilation_success = watcher_config.fetch(:notify_on_compilation_success) { true }
|
49
49
|
if notify_on_compilation_success
|
50
50
|
@notifier.notify('Compilation complete')
|
51
51
|
end
|
@@ -54,9 +54,7 @@ module Nanoc3::CLI::Commands
|
|
54
54
|
puts "done in #{format '%is %ims', *(time_spent.divmod(1000))}"
|
55
55
|
rescue Exception => e
|
56
56
|
# TODO include icon (--image misc/error-icon.png)
|
57
|
-
notify_on_compilation_failure =
|
58
|
-
site.config[:notify_on_compilation_failure] :
|
59
|
-
true
|
57
|
+
notify_on_compilation_failure = watcher_config.fetch(:notify_on_compilation_failure) { true }
|
60
58
|
if notify_on_compilation_failure
|
61
59
|
@notifier.notify('Compilation failed')
|
62
60
|
end
|
@@ -71,7 +69,6 @@ module Nanoc3::CLI::Commands
|
|
71
69
|
rebuilder.call(nil, nil)
|
72
70
|
|
73
71
|
# Get directories to watch
|
74
|
-
watcher_config = self.site.config[:watcher] || {}
|
75
72
|
dirs_to_watch = watcher_config[:dirs_to_watch] || %w( content layouts lib )
|
76
73
|
files_to_watch = watcher_config[:files_to_watch] || %w( config.yaml Rules rules Rules.rb rules.rb' )
|
77
74
|
files_to_watch.delete_if { |f| !File.file?(f) }
|
@@ -102,9 +102,9 @@ module Nanoc3::Filters
|
|
102
102
|
has_class = true if language
|
103
103
|
else
|
104
104
|
# Get language from comment line
|
105
|
-
match = element.inner_text.match(/^#!([^\n]
|
105
|
+
match = element.inner_text.match(/^#!([^\/][^\n]*)$/)
|
106
106
|
language = match[1] if match
|
107
|
-
element.content = element.content.sub(/^#!([^\n]
|
107
|
+
element.content = element.content.sub(/^#!([^\/][^\n]*)$\n/, '') if language
|
108
108
|
end
|
109
109
|
|
110
110
|
# Give up if there is no hope left
|
@@ -26,11 +26,11 @@ module Nanoc3::Filters
|
|
26
26
|
# FIXME use nokogiri or csspool instead of regular expressions
|
27
27
|
case params[:type]
|
28
28
|
when :html
|
29
|
-
content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(
|
29
|
+
content.gsub(/(<[^>]+\s+(src|href))=(['"]?)(\/(?:[^\/].*?)?)\3([\s\/>])/) do
|
30
30
|
$1 + '=' + $3 + relative_path_to($4) + $3 + $5
|
31
31
|
end
|
32
32
|
when :css
|
33
|
-
content.gsub(/url\((['"]?)(
|
33
|
+
content.gsub(/url\((['"]?)(\/(?:[^\/].*?)?)\1\)/) do
|
34
34
|
'url(' + $1 + relative_path_to($2) + $1 + ')'
|
35
35
|
end
|
36
36
|
else
|
data/lib/nanoc3.rb
CHANGED
@@ -193,4 +193,61 @@ class Nanoc3::Filters::ColorizeSyntaxTest < MiniTest::Unit::TestCase
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
+
def test_colorize_syntax_with_non_language_shebang_line
|
197
|
+
if_have 'coderay', 'nokogiri' do
|
198
|
+
# Create filter
|
199
|
+
filter = ::Nanoc3::Filters::ColorizeSyntax.new
|
200
|
+
|
201
|
+
# Get input and expected output
|
202
|
+
input = <<EOS
|
203
|
+
before
|
204
|
+
<pre><code>
|
205
|
+
#!/usr/bin/env ruby
|
206
|
+
puts 'hi!'
|
207
|
+
</code></pre>
|
208
|
+
after
|
209
|
+
EOS
|
210
|
+
expected_output = <<EOS
|
211
|
+
before
|
212
|
+
<pre><code>
|
213
|
+
#!/usr/bin/env ruby
|
214
|
+
puts 'hi!'
|
215
|
+
</code></pre>
|
216
|
+
after
|
217
|
+
EOS
|
218
|
+
|
219
|
+
# Run filter
|
220
|
+
actual_output = filter.run(input)
|
221
|
+
assert_equal(expected_output, actual_output)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_colorize_syntax_with_non_language_shebang_line_and_language_line
|
226
|
+
if_have 'coderay', 'nokogiri' do
|
227
|
+
# Create filter
|
228
|
+
filter = ::Nanoc3::Filters::ColorizeSyntax.new
|
229
|
+
|
230
|
+
# Get input and expected output
|
231
|
+
input = <<EOS
|
232
|
+
before
|
233
|
+
<pre><code>
|
234
|
+
#!ruby
|
235
|
+
#!/usr/bin/env ruby
|
236
|
+
puts 'hi!'
|
237
|
+
</code></pre>
|
238
|
+
after
|
239
|
+
EOS
|
240
|
+
expected_output = <<EOS
|
241
|
+
before
|
242
|
+
<pre><code class=\"language-ruby\"><span class=\"dt\">#!/usr/bin/env ruby</span>
|
243
|
+
puts <span class=\"s\"><span class=\"dl\">'</span><span class=\"k\">hi!</span><span class=\"dl\">'</span></span></code></pre>
|
244
|
+
after
|
245
|
+
EOS
|
246
|
+
|
247
|
+
# Run filter
|
248
|
+
actual_output = filter.run(input)
|
249
|
+
assert_equal(expected_output, actual_output)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
196
253
|
end
|
@@ -148,6 +148,30 @@ class Nanoc3::Filters::RelativizePathsTest < MiniTest::Unit::TestCase
|
|
148
148
|
assert_equal(expected_content, actual_content)
|
149
149
|
end
|
150
150
|
|
151
|
+
def test_filter_html_network_path
|
152
|
+
# Create filter with mock item
|
153
|
+
filter = Nanoc3::Filters::RelativizePaths.new
|
154
|
+
|
155
|
+
# Mock item
|
156
|
+
filter.instance_eval do
|
157
|
+
@item_rep = Nanoc3::ItemRep.new(
|
158
|
+
Nanoc3::Item.new(
|
159
|
+
'content',
|
160
|
+
{},
|
161
|
+
'/foo/bar/baz/'),
|
162
|
+
:blah)
|
163
|
+
@item_rep.path = '/woof/meow/'
|
164
|
+
end
|
165
|
+
|
166
|
+
# Set content
|
167
|
+
raw_content = %[<a href="//example.com/">example.com</a>]
|
168
|
+
expected_content = %[<a href="//example.com/">example.com</a>]
|
169
|
+
|
170
|
+
# Test
|
171
|
+
actual_content = filter.run(raw_content, :type => :html)
|
172
|
+
assert_equal(expected_content, actual_content)
|
173
|
+
end
|
174
|
+
|
151
175
|
def test_filter_implicit
|
152
176
|
# Create filter with mock item
|
153
177
|
filter = Nanoc3::Filters::RelativizePaths.new
|
@@ -281,4 +305,28 @@ class Nanoc3::Filters::RelativizePathsTest < MiniTest::Unit::TestCase
|
|
281
305
|
assert_equal(expected_content, actual_content)
|
282
306
|
end
|
283
307
|
|
308
|
+
def test_filter_css_network_path
|
309
|
+
# Create filter with mock item
|
310
|
+
filter = Nanoc3::Filters::RelativizePaths.new
|
311
|
+
|
312
|
+
# Mock item
|
313
|
+
filter.instance_eval do
|
314
|
+
@item_rep = Nanoc3::ItemRep.new(
|
315
|
+
Nanoc3::Item.new(
|
316
|
+
'content',
|
317
|
+
{},
|
318
|
+
'/foo/bar/baz/'),
|
319
|
+
:blah)
|
320
|
+
@item_rep.path = '/woof/meow/'
|
321
|
+
end
|
322
|
+
|
323
|
+
# Set content
|
324
|
+
raw_content = %[background: url(//example.com);]
|
325
|
+
expected_content = %[background: url(//example.com);]
|
326
|
+
|
327
|
+
# Test
|
328
|
+
actual_content = filter.run(raw_content, :type => :css)
|
329
|
+
assert_equal(expected_content, actual_content)
|
330
|
+
end
|
331
|
+
|
284
332
|
end
|
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc3
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.2
|
4
5
|
prerelease:
|
5
|
-
version: 3.2.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Denis Defreyne
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-04 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: cri
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70348754969400 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
18
|
+
requirements:
|
21
19
|
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version:
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: minitest
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70348754969400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: minitest
|
27
|
+
requirement: &70348754968620 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
35
33
|
type: :development
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: mocha
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *70348754968620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: mocha
|
38
|
+
requirement: &70348754967200 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
46
44
|
type: :development
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: rake
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *70348754967200
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rake
|
49
|
+
requirement: &70348754966620 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
57
55
|
type: :development
|
58
|
-
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: rdiscount
|
61
56
|
prerelease: false
|
62
|
-
|
57
|
+
version_requirements: *70348754966620
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rdiscount
|
60
|
+
requirement: &70348754965880 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version:
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
68
66
|
type: :development
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: yard
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
version_requirements: *70348754965880
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: &70348754964820 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version:
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
79
77
|
type: :development
|
80
|
-
|
81
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70348754964820
|
80
|
+
description: nanoc is a simple but very flexible static site generator written in
|
81
|
+
Ruby. It operates on local files, and therefore does not run on the server. nanoc
|
82
|
+
“compiles” the local source files into HTML (usually), by evaluating eRuby, Markdown,
|
83
|
+
etc.
|
82
84
|
email: denis.defreyne@stoneship.org
|
83
|
-
executables:
|
85
|
+
executables:
|
84
86
|
- nanoc3
|
85
87
|
extensions: []
|
86
|
-
|
87
|
-
extra_rdoc_files:
|
88
|
+
extra_rdoc_files:
|
88
89
|
- ChangeLog
|
89
90
|
- LICENSE
|
90
91
|
- README.md
|
91
92
|
- NEWS.md
|
92
|
-
files:
|
93
|
+
files:
|
93
94
|
- ChangeLog
|
94
95
|
- Gemfile
|
95
|
-
- Gemfile.lock
|
96
96
|
- LICENSE
|
97
97
|
- NEWS.md
|
98
98
|
- Rakefile
|
@@ -303,46 +303,54 @@ files:
|
|
303
303
|
- .gemtest
|
304
304
|
homepage: http://nanoc.stoneship.org/
|
305
305
|
licenses: []
|
306
|
+
post_install_message: ! '------------------------------------------------------------------------------
|
306
307
|
|
307
|
-
post_install_message: |
|
308
|
-
------------------------------------------------------------------------------
|
309
308
|
Thanks for installing nanoc 3.2! Here are some resources to help you get
|
309
|
+
|
310
310
|
started:
|
311
|
-
|
311
|
+
|
312
|
+
|
312
313
|
* The web site at <http://nanoc.stoneship.org/>
|
314
|
+
|
313
315
|
* The tutorial at <http://nanoc.stoneship.org/docs/3-getting-started/>
|
316
|
+
|
314
317
|
* The manual at <http://nanoc.stoneship.org/docs/4-basic-concepts/>
|
315
|
-
|
318
|
+
|
319
|
+
|
316
320
|
If you have questions, issues or simply want to share ideas, join the
|
321
|
+
|
317
322
|
discussion at <http://groups.google.com/group/nanoc> or stop by in the IRC
|
323
|
+
|
318
324
|
channel on irc.freenode.net, channel #nanoc. See you there!
|
319
|
-
|
325
|
+
|
326
|
+
|
320
327
|
Enjoy!
|
328
|
+
|
321
329
|
------------------------------------------------------------------------------
|
322
330
|
|
323
|
-
|
331
|
+
'
|
332
|
+
rdoc_options:
|
324
333
|
- --main
|
325
334
|
- README.md
|
326
|
-
require_paths:
|
335
|
+
require_paths:
|
327
336
|
- lib
|
328
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
337
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
329
338
|
none: false
|
330
|
-
requirements:
|
331
|
-
- -
|
332
|
-
- !ruby/object:Gem::Version
|
333
|
-
version:
|
334
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
|
+
requirements:
|
340
|
+
- - ! '>='
|
341
|
+
- !ruby/object:Gem::Version
|
342
|
+
version: '0'
|
343
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
335
344
|
none: false
|
336
|
-
requirements:
|
337
|
-
- -
|
338
|
-
- !ruby/object:Gem::Version
|
339
|
-
version:
|
345
|
+
requirements:
|
346
|
+
- - ! '>='
|
347
|
+
- !ruby/object:Gem::Version
|
348
|
+
version: '0'
|
340
349
|
requirements: []
|
341
|
-
|
342
350
|
rubyforge_project:
|
343
|
-
rubygems_version: 1.8.
|
351
|
+
rubygems_version: 1.8.10
|
344
352
|
signing_key:
|
345
353
|
specification_version: 3
|
346
|
-
summary: a web publishing system written in Ruby for building small to medium-sized
|
354
|
+
summary: a web publishing system written in Ruby for building small to medium-sized
|
355
|
+
websites.
|
347
356
|
test_files: []
|
348
|
-
|
data/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
nanoc3 (3.2.0)
|
5
|
-
cri (~> 2.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
RedCloth (4.2.7)
|
11
|
-
bluecloth (2.1.0)
|
12
|
-
builder (3.0.0)
|
13
|
-
coderay (0.9.8)
|
14
|
-
cri (2.0.2)
|
15
|
-
erubis (2.7.0)
|
16
|
-
execjs (1.2.0)
|
17
|
-
multi_json (~> 1.0)
|
18
|
-
haml (3.1.2)
|
19
|
-
kramdown (0.13.3)
|
20
|
-
less (2.0.5)
|
21
|
-
therubyracer (~> 0.9.2)
|
22
|
-
libv8 (3.3.10.2)
|
23
|
-
markaby (0.7.1)
|
24
|
-
builder (>= 2.0.0)
|
25
|
-
maruku (0.6.0)
|
26
|
-
syntax (>= 1.0.0)
|
27
|
-
mime-types (1.16)
|
28
|
-
minitest (2.3.1)
|
29
|
-
mocha (0.9.12)
|
30
|
-
multi_json (1.0.3)
|
31
|
-
mustache (0.99.4)
|
32
|
-
nokogiri (1.5.0)
|
33
|
-
rack (1.3.2)
|
34
|
-
rainpress (1.0)
|
35
|
-
rake (0.9.2)
|
36
|
-
rdiscount (1.6.8)
|
37
|
-
rdoc (3.8)
|
38
|
-
redcarpet (1.17.2)
|
39
|
-
rubypants (0.2.0)
|
40
|
-
sass (3.1.5)
|
41
|
-
slim (1.0.0)
|
42
|
-
temple (~> 0.3.0)
|
43
|
-
tilt (~> 1.2)
|
44
|
-
syntax (1.0.0)
|
45
|
-
systemu (2.2.0)
|
46
|
-
temple (0.3.2)
|
47
|
-
therubyracer (0.9.2)
|
48
|
-
libv8 (~> 3.3.10)
|
49
|
-
tilt (1.3.2)
|
50
|
-
typogruby (1.0.12)
|
51
|
-
rubypants
|
52
|
-
uglifier (1.0.0)
|
53
|
-
execjs (>= 0.3.0)
|
54
|
-
multi_json (>= 1.0.2)
|
55
|
-
w3c_validators (1.1.1)
|
56
|
-
nokogiri
|
57
|
-
yard (0.7.2)
|
58
|
-
|
59
|
-
PLATFORMS
|
60
|
-
ruby
|
61
|
-
|
62
|
-
DEPENDENCIES
|
63
|
-
RedCloth
|
64
|
-
bluecloth
|
65
|
-
builder
|
66
|
-
coderay
|
67
|
-
erubis
|
68
|
-
haml
|
69
|
-
kramdown
|
70
|
-
less (~> 2.0)
|
71
|
-
markaby
|
72
|
-
maruku
|
73
|
-
mime-types
|
74
|
-
minitest
|
75
|
-
mocha
|
76
|
-
mustache
|
77
|
-
nanoc3!
|
78
|
-
nokogiri
|
79
|
-
rack
|
80
|
-
rainpress
|
81
|
-
rake
|
82
|
-
rdiscount
|
83
|
-
rdoc
|
84
|
-
redcarpet
|
85
|
-
rubypants
|
86
|
-
sass (~> 3.1)
|
87
|
-
slim
|
88
|
-
systemu
|
89
|
-
typogruby
|
90
|
-
uglifier
|
91
|
-
w3c_validators
|
92
|
-
yard
|