nanoc 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -11
- data/NEWS.md +8 -0
- data/lib/nanoc.rb +1 -1
- data/lib/nanoc/base/source_data/item_array.rb +10 -1
- data/lib/nanoc/cli/command_runner.rb +1 -1
- data/lib/nanoc/cli/commands/create-site.rb +1 -1
- data/lib/nanoc/cli/error_handler.rb +1 -1
- data/lib/nanoc/filters/sass.rb +1 -22
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +28 -0
- data/test/cli/commands/test_watch.rb +35 -8
- data/test/filters/test_less.rb +1 -1
- data/test/filters/test_uglify_js.rb +2 -2
- metadata +3 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (3.6.
|
4
|
+
nanoc (3.6.1)
|
5
5
|
cri (~> 2.3)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,18 +11,18 @@ GEM
|
|
11
11
|
adsf (1.1.1)
|
12
12
|
rack (>= 1.0.0)
|
13
13
|
bluecloth (2.2.0)
|
14
|
-
builder (3.
|
15
|
-
coderay (1.0.
|
14
|
+
builder (3.2.0)
|
15
|
+
coderay (1.0.9)
|
16
16
|
coffee-script (2.2.0)
|
17
17
|
coffee-script-source
|
18
18
|
execjs
|
19
|
-
coffee-script-source (1.
|
19
|
+
coffee-script-source (1.5.0)
|
20
20
|
colored (1.2)
|
21
21
|
commonjs (0.2.6)
|
22
22
|
cri (2.3.0)
|
23
23
|
colored (>= 1.2)
|
24
24
|
erubis (2.7.0)
|
25
|
-
excon (0.
|
25
|
+
excon (0.18.5)
|
26
26
|
execjs (1.4.0)
|
27
27
|
multi_json (~> 1.0)
|
28
28
|
fog (1.9.0)
|
@@ -38,7 +38,7 @@ GEM
|
|
38
38
|
formatador (0.2.4)
|
39
39
|
haml (4.0.0)
|
40
40
|
tilt
|
41
|
-
handlebars (0.
|
41
|
+
handlebars (0.4.0)
|
42
42
|
commonjs (~> 0.2.3)
|
43
43
|
therubyracer (~> 0.11.1)
|
44
44
|
json (1.7.7)
|
@@ -46,7 +46,7 @@ GEM
|
|
46
46
|
less (2.2.2)
|
47
47
|
commonjs (~> 0.2.6)
|
48
48
|
libv8 (3.11.8.13)
|
49
|
-
listen (0.7.
|
49
|
+
listen (0.7.3)
|
50
50
|
markaby (0.7.2)
|
51
51
|
builder (>= 2.0.0)
|
52
52
|
maruku (0.6.1)
|
@@ -69,20 +69,20 @@ GEM
|
|
69
69
|
coderay (~> 1.0.5)
|
70
70
|
method_source (~> 0.8)
|
71
71
|
slop (~> 3.4)
|
72
|
-
pygments.rb (0.
|
72
|
+
pygments.rb (0.4.2)
|
73
73
|
posix-spawn (~> 0.3.6)
|
74
74
|
yajl-ruby (~> 1.1.0)
|
75
75
|
rack (1.5.2)
|
76
76
|
rainpress (1.0)
|
77
77
|
rake (10.0.3)
|
78
78
|
rdiscount (2.0.7)
|
79
|
-
rdoc (
|
79
|
+
rdoc (4.0.0)
|
80
80
|
json (~> 1.4)
|
81
81
|
redcarpet (2.2.2)
|
82
82
|
ref (1.0.2)
|
83
83
|
ruby-hmac (0.4.0)
|
84
84
|
rubypants (0.2.0)
|
85
|
-
sass (3.2.
|
85
|
+
sass (3.2.6)
|
86
86
|
slim (1.3.6)
|
87
87
|
temple (~> 0.5.5)
|
88
88
|
tilt (~> 1.3.3)
|
@@ -103,7 +103,7 @@ GEM
|
|
103
103
|
json
|
104
104
|
nokogiri
|
105
105
|
yajl-ruby (1.1.0)
|
106
|
-
yard (0.8.
|
106
|
+
yard (0.8.5)
|
107
107
|
yuicompressor (1.2.0)
|
108
108
|
|
109
109
|
PLATFORMS
|
data/NEWS.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.6.1 (2013-02-25)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed bug which could cause the Sass filter to raise a load error [Damien Pollet]
|
8
|
+
* Fixed warnings about `__send__` and `object_id` being redefined [Justin Hileman]
|
9
|
+
* Made `files_to_watch` contain `nanoc.yaml`, not `config.yaml` by default
|
10
|
+
|
3
11
|
## 3.6 (2013-02-24)
|
4
12
|
|
5
13
|
Features:
|
data/lib/nanoc.rb
CHANGED
@@ -9,7 +9,16 @@ module Nanoc
|
|
9
9
|
|
10
10
|
extend Forwardable
|
11
11
|
|
12
|
-
|
12
|
+
EXCLUDED_METHODS = [
|
13
|
+
:[], :at, :slice, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone,
|
14
|
+
:freeze, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods,
|
15
|
+
:instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?,
|
16
|
+
:instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?,
|
17
|
+
:extend, :display, :method, :public_method, :define_singleton_method, :object_id, :equal?,
|
18
|
+
:instance_eval, :instance_exec, :__send__, :__id__
|
19
|
+
]
|
20
|
+
|
21
|
+
DELEGATED_METHODS = Array.instance_methods + Enumerable.instance_methods - EXCLUDED_METHODS
|
13
22
|
def_delegators :@items, *DELEGATED_METHODS
|
14
23
|
|
15
24
|
def initialize
|
@@ -53,7 +53,7 @@ module Nanoc::CLI
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
# Asserts that the current
|
56
|
+
# Asserts that the current working directory contains a site (just like
|
57
57
|
# {#require_site}) and loads the site into memory.
|
58
58
|
#
|
59
59
|
# @return [void]
|
@@ -97,7 +97,7 @@ watcher:
|
|
97
97
|
|
98
98
|
# A list of single files to watch for changes. As mentioned above, don’t put
|
99
99
|
# any files from the “output/” or “tmp/” directories in here.
|
100
|
-
files_to_watch: [ '
|
100
|
+
files_to_watch: [ 'nanoc.yaml', 'Rules' ]
|
101
101
|
|
102
102
|
# When to send notifications (using Growl or notify-send).
|
103
103
|
notify_on_compilation_success: true
|
@@ -238,7 +238,7 @@ module Nanoc::CLI
|
|
238
238
|
# Build message
|
239
239
|
if gem_name
|
240
240
|
if self.using_bundler?
|
241
|
-
"Make sure the gem is added to Gemfile and run `bundle
|
241
|
+
"Make sure the gem is added to Gemfile and run `bundle install`."
|
242
242
|
else
|
243
243
|
"Install the '#{gem_name}' gem using `gem install #{gem_name}`."
|
244
244
|
end
|
data/lib/nanoc/filters/sass.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Nanoc::Filters
|
4
4
|
class Sass < Nanoc::Filter
|
5
5
|
|
6
|
-
requires 'sass'
|
6
|
+
requires 'sass', 'nanoc/filters/sass/sass_filesystem_importer'
|
7
7
|
|
8
8
|
class << self
|
9
9
|
# The current filter. This is definitely going to bite me if I ever get
|
@@ -11,27 +11,6 @@ module Nanoc::Filters
|
|
11
11
|
attr_accessor :current
|
12
12
|
end
|
13
13
|
|
14
|
-
# Essentially the `Sass::Importers::Filesystem` but registering each
|
15
|
-
# import file path.
|
16
|
-
class SassFilesystemImporter < ::Sass::Importers::Filesystem
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def _find(dir, name, options)
|
21
|
-
full_filename, syntax = ::Sass::Util.destructure(find_real_file(dir, name, options))
|
22
|
-
return unless full_filename && File.readable?(full_filename)
|
23
|
-
|
24
|
-
filter = Nanoc::Filters::Sass.current # FIXME ew global
|
25
|
-
item = filter.imported_filename_to_item(full_filename)
|
26
|
-
filter.depend_on([ item ]) unless item.nil?
|
27
|
-
|
28
|
-
options[:syntax] = syntax
|
29
|
-
options[:filename] = full_filename
|
30
|
-
options[:importer] = self
|
31
|
-
::Sass::Engine.new(File.read(full_filename), options)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
14
|
# Runs the content through [Sass](http://sass-lang.com/).
|
36
15
|
# Parameters passed to this filter will be passed on to Sass.
|
37
16
|
#
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc::Filters
|
4
|
+
class Sass
|
5
|
+
|
6
|
+
# Essentially the `Sass::Importers::Filesystem` but registering each
|
7
|
+
# import file path.
|
8
|
+
class SassFilesystemImporter < ::Sass::Importers::Filesystem
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def _find(dir, name, options)
|
13
|
+
full_filename, syntax = ::Sass::Util.destructure(find_real_file(dir, name, options))
|
14
|
+
return unless full_filename && File.readable?(full_filename)
|
15
|
+
|
16
|
+
filter = Nanoc::Filters::Sass.current # FIXME ew global
|
17
|
+
item = filter.imported_filename_to_item(full_filename)
|
18
|
+
filter.depend_on([ item ]) unless item.nil?
|
19
|
+
|
20
|
+
options[:syntax] = syntax
|
21
|
+
options[:filename] = full_filename
|
22
|
+
options[:importer] = self
|
23
|
+
::Sass::Engine.new(File.read(full_filename), options)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -20,22 +20,42 @@ class Nanoc::CLI::Commands::WatchTest < MiniTest::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
def test_change_nanoc_dot_yaml
|
24
|
+
Nanoc::CLI.run %w( create-site bleh )
|
25
|
+
Dir.chdir('bleh') do
|
26
|
+
File.open('Rules', 'w') do |io|
|
27
|
+
io.write("compile '*' do ; filter :erb ; end\n")
|
28
|
+
io.write("route '*' do ; item.identifier + 'index.html' ; end\n")
|
29
|
+
end
|
30
|
+
|
31
|
+
config_contents = File.read('nanoc.yaml')
|
32
|
+
|
33
|
+
watch_thread = Thread.new do
|
34
|
+
Nanoc::CLI.run %w( watch )
|
35
|
+
end
|
36
|
+
|
37
|
+
File.open('content/index.html', 'w') { |io| io.write('<%= @config[:blah].inspect %>!!!') }
|
38
|
+
self.wait_until_content_equals('output/index.html', 'nil!!!')
|
39
|
+
|
40
|
+
File.open('nanoc.yaml', 'w') { |io| io.write(config_contents + "\nblah: 456\n") }
|
41
|
+
self.wait_until_content_equals('output/index.html', '456!!!')
|
42
|
+
|
43
|
+
watch_thread.kill
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
23
47
|
def test_notify
|
24
|
-
old_path = ENV['PATH']
|
25
48
|
with_site do |s|
|
26
49
|
watch_thread = Thread.new do
|
27
50
|
Nanoc::CLI.run %w( watch )
|
28
51
|
end
|
29
52
|
|
30
|
-
ENV['PATH'] = '.' # so that neither which nor where can be found
|
31
53
|
File.open('content/index.html', 'w') { |io| io.write('Hello there!') }
|
32
54
|
self.wait_until_exists('output/index.html')
|
33
55
|
assert_equal 'Hello there!', File.read('output/index.html')
|
34
56
|
|
35
57
|
watch_thread.kill
|
36
58
|
end
|
37
|
-
ensure
|
38
|
-
ENV['PATH'] = old_path
|
39
59
|
end
|
40
60
|
|
41
61
|
def wait_until_exists(filename)
|
@@ -48,16 +68,23 @@ class Nanoc::CLI::Commands::WatchTest < MiniTest::Unit::TestCase
|
|
48
68
|
end
|
49
69
|
end
|
50
70
|
|
51
|
-
def wait_until_content_equals(filename,
|
71
|
+
def wait_until_content_equals(filename, expected_content)
|
52
72
|
self.wait_until_exists(filename)
|
53
73
|
|
54
74
|
20.times do
|
55
|
-
break if File.read(filename) ==
|
75
|
+
break if File.read(filename) == expected_content
|
56
76
|
sleep 0.5
|
57
77
|
end
|
58
|
-
|
59
|
-
|
78
|
+
|
79
|
+
actual_content = File.read(filename)
|
80
|
+
if actual_content != expected_content
|
81
|
+
raise RuntimeError, "Expected #{filename} to have " \
|
82
|
+
"content #{expected_content.inspect} but it had " \
|
83
|
+
"content #{actual_content.inspect} instead :("
|
60
84
|
end
|
85
|
+
|
86
|
+
# Ugly, but seems to be necessary or changes are not picked up. :(
|
87
|
+
sleep 0.5
|
61
88
|
end
|
62
89
|
|
63
90
|
end
|
data/test/filters/test_less.rb
CHANGED
@@ -120,7 +120,7 @@ class Nanoc::Filters::LessTest < MiniTest::Unit::TestCase
|
|
120
120
|
|
121
121
|
# Run filter with compress option
|
122
122
|
result = filter.setup_and_run('.foo { bar: a; } .bar { foo: b; }', :compress => true)
|
123
|
-
assert_match(/^\.foo{bar:a
|
123
|
+
assert_match(/^\.foo\{bar:a;\}\n\.bar\{foo:b;\}/, result)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -11,7 +11,7 @@ class Nanoc::Filters::UglifyJSTest < MiniTest::Unit::TestCase
|
|
11
11
|
|
12
12
|
# Run filter
|
13
13
|
result = filter.setup_and_run("foo = 1; (function(bar) { if (true) alert(bar); })(foo)")
|
14
|
-
assert_match(/foo=1,function\((.)\){alert\(\1\)}\(foo\);/, result)
|
14
|
+
assert_match(/foo=1,function\((.)\)\{alert\(\1\)\}\(foo\);/, result)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -23,7 +23,7 @@ class Nanoc::Filters::UglifyJSTest < MiniTest::Unit::TestCase
|
|
23
23
|
|
24
24
|
# Run filter
|
25
25
|
result = filter.setup_and_run("foo = 1; (function(bar) { if (true) alert(bar); })(foo)", :toplevel => true)
|
26
|
-
assert_match(/foo=1,function\((.)\){alert\(\1\)}\(foo\);/, result)
|
26
|
+
assert_match(/foo=1,function\((.)\)\{alert\(\1\)\}\(foo\);/, result)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cri
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/nanoc/filters/redcloth.rb
|
265
265
|
- lib/nanoc/filters/relativize_paths.rb
|
266
266
|
- lib/nanoc/filters/rubypants.rb
|
267
|
+
- lib/nanoc/filters/sass/sass_filesystem_importer.rb
|
267
268
|
- lib/nanoc/filters/sass.rb
|
268
269
|
- lib/nanoc/filters/slim.rb
|
269
270
|
- lib/nanoc/filters/typogruby.rb
|