nanoc 3.6.3 → 3.6.4
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.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/NEWS.md +11 -0
- data/TODO.md +25 -6
- data/lib/nanoc/base/compilation/compiler.rb +1 -0
- data/lib/nanoc/base/core_ext/array.rb +4 -2
- data/lib/nanoc/base/core_ext/hash.rb +6 -2
- data/lib/nanoc/cli/commands/autocompile.rb +2 -0
- data/lib/nanoc/cli/commands/watch.rb +21 -19
- data/lib/nanoc/extra/checking/checks/internal_links.rb +5 -0
- data/lib/nanoc/filters/coffeescript.rb +1 -1
- data/lib/nanoc.rb +1 -1
- data/test/base/core_ext/hash_spec.rb +6 -0
- data/test/base/test_compiler.rb +16 -0
- data/test/cli/commands/test_watch.rb +0 -24
- data/test/extra/checking/checks/test_internal_links.rb +11 -0
- data/test/filters/test_uglify_js.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzhlOGM4MmEyNTNlMTNmZGU1Y2MzN2E1MzBjNzE2ZTdmNjgxYTQ2OA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmY2MDVlNjQyMGViOTdlZDg4NDA3YWUzN2E4YjcwODI3YjUwOTZhMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzU3ZGNlMTcwOGExMTgzNGQzNmFhNzc2OTc2ZmU2NDJlMDFhZjc0YzMxNGQz
|
10
|
+
NTRiNzk3OWU4ZWIyNTRjMTU2MzRjZDg5YmFmNzQ3MGFkZWNlYmQ1NjYzNzM4
|
11
|
+
ZTY1MjhlN2EzZmQyMTFlOWNkZmFiNDNiNWVlNGU1ZWNiYjcwZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzNiMjNjOTA0NTI5NTc0ZjhlOGYwNGIxNTgzZTZkOTNiMGNmMjZhM2MzYmM3
|
14
|
+
ODQwMmQ3NTYwMThhN2QzZTUzMTQ5MmY3MmVmMDAwODEyOWQwMTg4MWNhZDll
|
15
|
+
YjRiMzA3MmJhMTIzMjZiNzYzNTczMGNhNDQ1ZDA5MDhhYmFlNmE=
|
data/Gemfile.lock
CHANGED
data/NEWS.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.6.4 (2013-05-29)
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Deprecated `watch` and `autocompile` commands in favour of [`guard-nanoc`](https://github.com/nanoc/guard-nanoc)
|
8
|
+
|
9
|
+
Fixes:
|
10
|
+
|
11
|
+
* Fixed bug which could cause the `tmp/` dir to blow up in size
|
12
|
+
* Unescaped URLs when checking internal links
|
13
|
+
|
3
14
|
## 3.6.3 (2013-04-24)
|
4
15
|
|
5
16
|
Fixes:
|
data/TODO.md
CHANGED
@@ -5,10 +5,29 @@ New
|
|
5
5
|
---
|
6
6
|
|
7
7
|
* [3.x] assert that textual filter must return string
|
8
|
-
* Get rid of notification center
|
8
|
+
* Get rid of notification center (use delegation)
|
9
9
|
* Get rid of core ext
|
10
10
|
* Don't recursively clean attributes
|
11
11
|
* All stores should be pluggable
|
12
|
+
* filters should accept content, not a string
|
13
|
+
* Layouts could be binary too! (maybe not super useful)
|
14
|
+
|
15
|
+
Proxies
|
16
|
+
-------
|
17
|
+
|
18
|
+
Item should not contain a list of item reps
|
19
|
+
Instead, there should be an ItemRepsCollection that you can query
|
20
|
+
item_reps_for(item)
|
21
|
+
|
22
|
+
Item-per-item compilation
|
23
|
+
-------------------------
|
24
|
+
|
25
|
+
There should be a transaction around each item compilation, instead of around the entire site.
|
26
|
+
|
27
|
+
True partials?
|
28
|
+
--------------
|
29
|
+
|
30
|
+
Rendering layouts is ugly! What about partial layouts though? (render box do ... end)
|
12
31
|
|
13
32
|
Populate in data sources
|
14
33
|
------------------------
|
@@ -22,16 +41,16 @@ Finding modified items
|
|
22
41
|
|
23
42
|
Data sources should be queried to find out removed, added and changed items.
|
24
43
|
|
25
|
-
Abstractions
|
26
|
-
------------
|
27
|
-
|
28
|
-
ItemRepWriter
|
29
|
-
|
30
44
|
Item proxies
|
31
45
|
------------
|
32
46
|
|
33
47
|
Maybe this can be implemented as decorators.
|
34
48
|
|
49
|
+
* core
|
50
|
+
* proxies
|
51
|
+
* while in rules
|
52
|
+
* while being filtered
|
53
|
+
|
35
54
|
### Core
|
36
55
|
|
37
56
|
Nanoc::Core::Item
|
@@ -8,9 +8,11 @@ module Nanoc::ArrayExtensions
|
|
8
8
|
#
|
9
9
|
# @return [Array] The converted array
|
10
10
|
def symbolize_keys_recursively
|
11
|
-
|
12
|
-
|
11
|
+
array = []
|
12
|
+
self.each do |element|
|
13
|
+
array << (element.respond_to?(:symbolize_keys_recursively) ? element.symbolize_keys_recursively : element)
|
13
14
|
end
|
15
|
+
array
|
14
16
|
end
|
15
17
|
|
16
18
|
# @deprecated Renamed to {#symbolize_keys_recursively}
|
@@ -8,9 +8,13 @@ module Nanoc::HashExtensions
|
|
8
8
|
#
|
9
9
|
# @return [Hash] The converted hash
|
10
10
|
def symbolize_keys_recursively
|
11
|
-
|
12
|
-
|
11
|
+
hash = {}
|
12
|
+
self.each_pair do |key, value|
|
13
|
+
new_key = key.respond_to?(:to_sym) ? key.to_sym : key
|
14
|
+
new_value = value.respond_to?(:symbolize_keys_recursively) ? value.symbolize_keys_recursively : value
|
15
|
+
hash[new_key] = new_value
|
13
16
|
end
|
17
|
+
hash
|
14
18
|
end
|
15
19
|
|
16
20
|
# @deprecated Renamed to {#symbolize_keys_recursively}
|
@@ -27,6 +27,8 @@ module Nanoc::CLI::Commands
|
|
27
27
|
class AutoCompile < ::Nanoc::CLI::CommandRunner
|
28
28
|
|
29
29
|
def run
|
30
|
+
warn 'WARNING: The `autocompile` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).'
|
31
|
+
|
30
32
|
require 'rack'
|
31
33
|
|
32
34
|
# Make sure we are in a nanoc site directory
|
@@ -11,6 +11,8 @@ module Nanoc::CLI::Commands
|
|
11
11
|
class Watch < ::Nanoc::CLI::CommandRunner
|
12
12
|
|
13
13
|
def run
|
14
|
+
warn 'WARNING: The `watch` command is deprecated. Please consider using `guard-nanoc` instead (see https://github.com/nanoc/guard-nanoc).'
|
15
|
+
|
14
16
|
require 'listen'
|
15
17
|
require 'pathname'
|
16
18
|
|
@@ -66,30 +68,30 @@ module Nanoc::CLI::Commands
|
|
66
68
|
rebuilder.call(nil)
|
67
69
|
|
68
70
|
# Get directories to watch
|
69
|
-
dirs_to_watch = watcher_config[:dirs_to_watch] || ['content', 'layouts', 'lib']
|
70
|
-
files_to_watch = watcher_config[:files_to_watch] || ['nanoc.yaml', 'config.yaml', 'Rules', 'rules', 'Rules.rb', 'rules.rb']
|
71
|
-
files_to_watch = Regexp.new(files_to_watch.map { |name|
|
72
|
-
ignore_dir = Regexp.new(Dir.glob(
|
71
|
+
dirs_to_watch = watcher_config[:dirs_to_watch] || [ 'content', 'layouts', 'lib' ]
|
72
|
+
files_to_watch = watcher_config[:files_to_watch] || [ 'nanoc.yaml', 'config.yaml', 'Rules', 'rules', 'Rules.rb', 'rules.rb' ]
|
73
|
+
files_to_watch = Regexp.new(files_to_watch.map { |name| Regexp.quote(name) + '$' }.join('|'))
|
74
|
+
ignore_dir = Regexp.new(Dir.glob('*').map { |dir| dir if File.dir?(dir) }.compact.join('|'))
|
73
75
|
|
74
76
|
# Watch
|
75
77
|
puts "Watching for changes…"
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
callback = Proc.new do |modified, added, removed|
|
80
|
+
rebuilder.call(modified[0]) if modified[0]
|
81
|
+
rebuilder.call(added[0]) if added[0]
|
82
|
+
rebuilder.call(removed[0]) if removed[0]
|
83
|
+
end
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
+
listener = Listen::Listener.new(*dirs_to_watch).change(&callback)
|
86
|
+
listener_root = Listen::Listener.new('.', :filter => files_to_watch, :ignore => ignore_dir).change(&callback)
|
85
87
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
88
|
+
begin
|
89
|
+
listener_root.start
|
90
|
+
listener.start!
|
91
|
+
rescue Interrupt
|
92
|
+
listener.stop
|
93
|
+
listener_root.stop
|
94
|
+
end
|
93
95
|
end
|
94
96
|
|
95
97
|
# Allows sending user notifications in a cross-platform way.
|
@@ -111,7 +113,7 @@ module Nanoc::CLI::Commands
|
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
114
|
-
|
116
|
+
protected
|
115
117
|
|
116
118
|
def have_tool_nix?(tool)
|
117
119
|
!`which #{tool}`.empty?
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
require 'uri'
|
4
|
+
|
3
5
|
module Nanoc::Extra::Checking::Checks
|
4
6
|
|
5
7
|
# A check that verifies that all internal links point to a location that exists.
|
@@ -38,6 +40,9 @@ module Nanoc::Extra::Checking::Checks
|
|
38
40
|
path = path.sub(/\?.*$/, '')
|
39
41
|
return true if path.empty?
|
40
42
|
|
43
|
+
# Decode URL (e.g. '%20' -> ' ')
|
44
|
+
path = URI.unescape(path)
|
45
|
+
|
41
46
|
# Make absolute
|
42
47
|
if path[0, 1] == '/'
|
43
48
|
path = @site.config[:output_dir] + path
|
data/lib/nanoc.rb
CHANGED
@@ -8,6 +8,12 @@ describe 'Hash#symbolize_keys_recursively' do
|
|
8
8
|
hash_old.symbolize_keys_recursively.must_equal hash_new
|
9
9
|
end
|
10
10
|
|
11
|
+
it 'should not require string keys' do
|
12
|
+
hash_old = { Time.now => 'abc' }
|
13
|
+
hash_new = hash_old
|
14
|
+
hash_old.symbolize_keys_recursively.must_equal hash_new
|
15
|
+
end
|
16
|
+
|
11
17
|
end
|
12
18
|
|
13
19
|
describe 'Hash#stringify_keys_recursively' do
|
data/test/base/test_compiler.rb
CHANGED
@@ -540,4 +540,20 @@ class Nanoc::CompilerTest < Nanoc::TestCase
|
|
540
540
|
end
|
541
541
|
end
|
542
542
|
|
543
|
+
def test_tmp_text_items_are_removed_after_compilation
|
544
|
+
with_site do |site|
|
545
|
+
# Create item
|
546
|
+
File.open('content/index.html', 'w') do |io|
|
547
|
+
io.write('stuff')
|
548
|
+
end
|
549
|
+
|
550
|
+
# Compile
|
551
|
+
site = Nanoc::Site.new('.')
|
552
|
+
site.compile
|
553
|
+
|
554
|
+
# Check
|
555
|
+
assert Dir['tmp/text_items/*'].empty?
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
543
559
|
end
|
@@ -18,30 +18,6 @@ class Nanoc::CLI::Commands::WatchTest < Nanoc::TestCase
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def test_change_nanoc_dot_yaml
|
22
|
-
Nanoc::CLI.run %w( create-site bleh )
|
23
|
-
Dir.chdir('bleh') do
|
24
|
-
File.open('Rules', 'w') do |io|
|
25
|
-
io.write("compile '*' do ; filter :erb ; end\n")
|
26
|
-
io.write("route '*' do ; item.identifier + 'index.html' ; end\n")
|
27
|
-
end
|
28
|
-
|
29
|
-
config_contents = File.read('nanoc.yaml')
|
30
|
-
|
31
|
-
watch_thread = Thread.new do
|
32
|
-
Nanoc::CLI.run %w( watch )
|
33
|
-
end
|
34
|
-
|
35
|
-
File.open('content/index.html', 'w') { |io| io.write('<%= @config[:blah].inspect %>!!!') }
|
36
|
-
self.wait_until_content_equals('output/index.html', 'nil!!!')
|
37
|
-
|
38
|
-
File.open('nanoc.yaml', 'w') { |io| io.write(config_contents + "\nblah: 456\n") }
|
39
|
-
self.wait_until_content_equals('output/index.html', '456!!!')
|
40
|
-
|
41
|
-
watch_thread.kill
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
21
|
def test_notify
|
46
22
|
with_site do |s|
|
47
23
|
watch_thread = Thread.new do
|
@@ -53,4 +53,15 @@ class Nanoc::Extra::Checking::Checks::InternalLinksTest < Nanoc::TestCase
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
def test_unescape_url
|
57
|
+
with_site do |site|
|
58
|
+
FileUtils.mkdir_p('output/stuff')
|
59
|
+
File.open('output/stuff/right foo', 'w') { |io| io.write('hi') }
|
60
|
+
|
61
|
+
check = Nanoc::Extra::Checking::Checks::InternalLinks.new(site)
|
62
|
+
|
63
|
+
assert check.send(:valid?, 'stuff/right%20foo', 'output/origin')
|
64
|
+
refute check.send(:valid?, 'stuff/wrong%20foo', 'output/origin')
|
65
|
+
end
|
66
|
+
end
|
56
67
|
end
|
@@ -19,10 +19,10 @@ class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
|
|
19
19
|
filter = ::Nanoc::Filters::UglifyJS.new
|
20
20
|
input = "if(donkey) alert('It is a donkey!');"
|
21
21
|
|
22
|
-
result = filter.setup_and_run(input, output
|
22
|
+
result = filter.setup_and_run(input, :output => { :beautify => false })
|
23
23
|
assert_equal 'donkey&&alert("It is a donkey!");', result
|
24
24
|
|
25
|
-
result = filter.setup_and_run(input, output
|
25
|
+
result = filter.setup_and_run(input, :output => { :beautify => true })
|
26
26
|
assert_equal 'donkey && alert("It is a donkey!");', result
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|