nanoc 3.6.5 → 3.6.6
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 +15 -2
- data/lib/nanoc.rb +1 -3
- data/lib/nanoc/base/source_data/item.rb +2 -1
- data/lib/nanoc/cli.rb +2 -2
- data/lib/nanoc/cli/commands/create-site.rb +1 -19
- data/lib/nanoc/cli/commands/view.rb +8 -4
- data/lib/nanoc/filters/sass.rb +6 -12
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
- data/lib/nanoc/helpers/capturing.rb +3 -3
- data/lib/nanoc/version.rb +8 -0
- data/test/cli/test_cli.rb +43 -0
- data/test/helper.rb +9 -1
- data/test/helpers/test_capturing.rb +2 -3
- metadata +3 -2
data/NEWS.md
CHANGED
@@ -1,11 +1,24 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.6.6 (2013-11-08)
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Reduced number of dependencies generated by Sass filter (#306) [Gregory Pakosz]
|
8
|
+
* Recognised lowercase `utf` in language value (e.g. `en_US.utf8`) as being UTF-8 (#335)
|
9
|
+
* Set [Thin](http://code.macournoyer.com/thin/) as the default server for `nanoc view` (#342, #345)
|
10
|
+
* Removed watcher section from the default configuration file (#343, #344)
|
11
|
+
|
12
|
+
Fixes:
|
13
|
+
|
14
|
+
* Prevented capturing helper from erroneously compiling items twice (#337)
|
15
|
+
|
3
16
|
## 3.6.5 (2013-09-29)
|
4
17
|
|
5
18
|
Fixes:
|
6
19
|
|
7
|
-
* Fixed bug which could cause incorrect dependencies to be generated in some cases
|
8
|
-
* Fixed handling of index filenames when allowing periods in identifiers
|
20
|
+
* Fixed bug which could cause incorrect dependencies to be generated in some cases (#329)
|
21
|
+
* Fixed handling of index filenames when allowing periods in identifiers (#330)
|
9
22
|
|
10
23
|
## 3.6.4 (2013-05-29)
|
11
24
|
|
data/lib/nanoc.rb
CHANGED
@@ -2,9 +2,6 @@
|
|
2
2
|
|
3
3
|
module Nanoc
|
4
4
|
|
5
|
-
# The current nanoc version.
|
6
|
-
VERSION = '3.6.5'
|
7
|
-
|
8
5
|
# @return [String] A string containing information about this nanoc version
|
9
6
|
# and its environment (Ruby engine and version, Rubygems version if any).
|
10
7
|
def self.version_information
|
@@ -34,6 +31,7 @@ require 'time'
|
|
34
31
|
require 'yaml'
|
35
32
|
|
36
33
|
# Load nanoc
|
34
|
+
require 'nanoc/version'
|
37
35
|
require 'nanoc/base'
|
38
36
|
require 'nanoc/extra'
|
39
37
|
require 'nanoc/data_sources'
|
@@ -33,7 +33,7 @@ module Nanoc
|
|
33
33
|
attr_reader :raw_content
|
34
34
|
|
35
35
|
# @return [String] The filename pointing to the file containing this
|
36
|
-
# item’s content
|
36
|
+
# item’s content
|
37
37
|
attr_reader :raw_filename
|
38
38
|
|
39
39
|
# @return [Nanoc::Site] The site this item belongs to
|
@@ -82,6 +82,7 @@ module Nanoc
|
|
82
82
|
if @is_binary
|
83
83
|
@raw_filename = raw_content_or_raw_filename
|
84
84
|
else
|
85
|
+
@raw_filename = attributes[:content_filename]
|
85
86
|
@raw_content = raw_content_or_raw_filename
|
86
87
|
end
|
87
88
|
|
data/lib/nanoc/cli.rb
CHANGED
@@ -184,7 +184,7 @@ protected
|
|
184
184
|
def self.enable_utf8?(io)
|
185
185
|
return true if !io.tty?
|
186
186
|
|
187
|
-
%w( LC_ALL LC_CTYPE LANG ).any? { |e| ENV[e] =~ /UTF/ }
|
187
|
+
%w( LC_ALL LC_CTYPE LANG ).any? { |e| ENV[e] =~ /UTF/i }
|
188
188
|
end
|
189
189
|
|
190
190
|
# @return [Boolean] true if color support is present, false if not
|
@@ -196,7 +196,7 @@ protected
|
|
196
196
|
rescue LoadError
|
197
197
|
return false
|
198
198
|
end
|
199
|
-
|
199
|
+
|
200
200
|
return true
|
201
201
|
end
|
202
202
|
|
@@ -84,24 +84,6 @@ data_sources:
|
|
84
84
|
# will have the identifier “/about/” when turned off, but when turned on
|
85
85
|
# it will become “/about.html/” instead.
|
86
86
|
allow_periods_in_identifiers: false
|
87
|
-
|
88
|
-
# Configuration for the “watch” command, which watches a site for changes and
|
89
|
-
# recompiles if necessary.
|
90
|
-
watcher:
|
91
|
-
# A list of directories to watch for changes. When editing this, make sure
|
92
|
-
# that the “output/” and “tmp/” directories are _not_ included in this list,
|
93
|
-
# because recompiling the site will cause these directories to change, which
|
94
|
-
# will cause the site to be recompiled, which will cause these directories
|
95
|
-
# to change, which will cause the site to be recompiled again, and so on.
|
96
|
-
dirs_to_watch: [ 'content', 'layouts', 'lib' ]
|
97
|
-
|
98
|
-
# A list of single files to watch for changes. As mentioned above, don’t put
|
99
|
-
# any files from the “output/” or “tmp/” directories in here.
|
100
|
-
files_to_watch: [ 'nanoc.yaml', 'Rules' ]
|
101
|
-
|
102
|
-
# When to send notifications (using Growl or notify-send).
|
103
|
-
notify_on_compilation_success: true
|
104
|
-
notify_on_compilation_failure: true
|
105
87
|
EOS
|
106
88
|
|
107
89
|
DEFAULT_RULES = <<EOS unless defined? DEFAULT_RULES
|
@@ -276,7 +258,7 @@ EOS
|
|
276
258
|
<link rel="stylesheet" href="/style.css">
|
277
259
|
|
278
260
|
<!-- you don't need to keep this, but it's cool for stats! -->
|
279
|
-
<meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
|
261
|
+
<meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
|
280
262
|
</head>
|
281
263
|
<body>
|
282
264
|
<div id="main">
|
@@ -14,6 +14,8 @@ module Nanoc::CLI::Commands
|
|
14
14
|
|
15
15
|
class View < ::Nanoc::CLI::CommandRunner
|
16
16
|
|
17
|
+
DEFAULT_HANDLER_NAME = :thin
|
18
|
+
|
17
19
|
def run
|
18
20
|
load_adsf
|
19
21
|
require 'rack'
|
@@ -27,11 +29,13 @@ module Nanoc::CLI::Commands
|
|
27
29
|
:Host => (options[:host] || '0.0.0.0')
|
28
30
|
}
|
29
31
|
|
30
|
-
#
|
31
|
-
|
32
|
+
# Get handler
|
33
|
+
if options.has_key?(:handler)
|
34
|
+
handler = Rack::Handler.get(options[:handler])
|
35
|
+
else
|
32
36
|
begin
|
33
|
-
handler = Rack::Handler
|
34
|
-
rescue LoadError
|
37
|
+
handler = Rack::Handler.get(DEFAULT_HANDLER_NAME)
|
38
|
+
rescue LoadError
|
35
39
|
handler = Rack::Handler::WEBrick
|
36
40
|
end
|
37
41
|
end
|
data/lib/nanoc/filters/sass.rb
CHANGED
@@ -5,12 +5,6 @@ module Nanoc::Filters
|
|
5
5
|
|
6
6
|
requires 'sass', 'nanoc/filters/sass/sass_filesystem_importer'
|
7
7
|
|
8
|
-
class << self
|
9
|
-
# The current filter. This is definitely going to bite me if I ever get
|
10
|
-
# to multithreading nanoc.
|
11
|
-
attr_accessor :current
|
12
|
-
end
|
13
|
-
|
14
8
|
# Runs the content through [Sass](http://sass-lang.com/).
|
15
9
|
# Parameters passed to this filter will be passed on to Sass.
|
16
10
|
#
|
@@ -28,22 +22,22 @@ module Nanoc::Filters
|
|
28
22
|
|
29
23
|
# Find items
|
30
24
|
item_dirglob = Pathname.new(sass_filename).dirname.realpath.to_s + '**'
|
31
|
-
clean_items = @items.reject { |i| i
|
25
|
+
clean_items = @items.reject { |i| i.raw_filename.nil? }
|
32
26
|
@scoped_items, @rest_items = clean_items.partition do |i|
|
33
|
-
i
|
34
|
-
Pathname.new(i
|
27
|
+
i.raw_filename &&
|
28
|
+
Pathname.new(i.raw_filename).realpath.fnmatch(item_dirglob)
|
35
29
|
end
|
36
30
|
|
37
31
|
# Render
|
32
|
+
options[:nanoc_current_filter] = self
|
38
33
|
engine = ::Sass::Engine.new(content, options)
|
39
|
-
self.class.current = self
|
40
34
|
engine.render
|
41
35
|
end
|
42
36
|
|
43
37
|
def imported_filename_to_item(filename)
|
44
38
|
filematch = lambda do |i|
|
45
|
-
i
|
46
|
-
Pathname.new(i
|
39
|
+
i.raw_filename &&
|
40
|
+
Pathname.new(i.raw_filename).realpath == Pathname.new(filename).realpath
|
47
41
|
end
|
48
42
|
@scoped_items.find(&filematch) || @rest_items.find(&filematch)
|
49
43
|
end
|
@@ -13,7 +13,7 @@ module Nanoc::Filters
|
|
13
13
|
full_filename, syntax = ::Sass::Util.destructure(find_real_file(dir, name, options))
|
14
14
|
return unless full_filename && File.readable?(full_filename)
|
15
15
|
|
16
|
-
filter =
|
16
|
+
filter = options[:nanoc_current_filter]
|
17
17
|
item = filter.imported_filename_to_item(full_filename)
|
18
18
|
filter.depend_on([ item ]) unless item.nil?
|
19
19
|
|
@@ -101,7 +101,7 @@ module Nanoc::Helpers
|
|
101
101
|
if block_given? # Set content
|
102
102
|
# Get args
|
103
103
|
if args.size != 1
|
104
|
-
raise ArgumentError, "expected 1 argument (the name " +
|
104
|
+
raise ArgumentError, "expected 1 argument (the name " +
|
105
105
|
"of the capture) but got #{args.size} instead"
|
106
106
|
end
|
107
107
|
name = args[0]
|
@@ -129,12 +129,12 @@ module Nanoc::Helpers
|
|
129
129
|
# the content attribute to reset it. :(
|
130
130
|
# FIXME clean this up
|
131
131
|
if !@site.captures_store_compiled_items.include? item
|
132
|
-
@site.captures_store_compiled_items << item
|
132
|
+
@site.captures_store_compiled_items << item
|
133
133
|
item.forced_outdated = true
|
134
134
|
item.reps.each do |r|
|
135
135
|
raw_content = item.raw_content
|
136
136
|
r.content = { :raw => raw_content, :last => raw_content }
|
137
|
-
|
137
|
+
raise Nanoc::Errors::UnmetDependency.new(r)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
data/test/cli/test_cli.rb
CHANGED
@@ -102,4 +102,47 @@ EOS
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
def test_enable_utf8_only_on_tty
|
106
|
+
new_env_diff = {
|
107
|
+
'LC_ALL' => 'en_US.ISO-8859-1',
|
108
|
+
'LC_CTYPE' => 'en_US.ISO-8859-1',
|
109
|
+
'LANG' => 'en_US.ISO-8859-1',
|
110
|
+
}
|
111
|
+
with_env_vars(new_env_diff) do
|
112
|
+
io = StringIO.new
|
113
|
+
def io.tty? ; true ; end
|
114
|
+
refute Nanoc::CLI.enable_utf8?(io)
|
115
|
+
|
116
|
+
io = StringIO.new
|
117
|
+
def io.tty? ; false ; end
|
118
|
+
assert Nanoc::CLI.enable_utf8?(io)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_enable_utf8
|
123
|
+
io = StringIO.new
|
124
|
+
def io.tty? ; true ; end
|
125
|
+
|
126
|
+
new_env_diff = {
|
127
|
+
'LC_ALL' => 'en_US.ISO-8859-1',
|
128
|
+
'LC_CTYPE' => 'en_US.ISO-8859-1',
|
129
|
+
'LANG' => 'en_US.ISO-8859-1',
|
130
|
+
}
|
131
|
+
with_env_vars(new_env_diff) do
|
132
|
+
refute Nanoc::CLI.enable_utf8?(io)
|
133
|
+
|
134
|
+
with_env_vars({ 'LC_ALL' => 'en_US.UTF-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
135
|
+
with_env_vars({ 'LC_CTYPE' => 'en_US.UTF-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
136
|
+
with_env_vars({ 'LANG' => 'en_US.UTF-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
137
|
+
|
138
|
+
with_env_vars({ 'LC_ALL' => 'en_US.utf-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
139
|
+
with_env_vars({ 'LC_CTYPE' => 'en_US.utf-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
140
|
+
with_env_vars({ 'LANG' => 'en_US.utf-8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
141
|
+
|
142
|
+
with_env_vars({ 'LC_ALL' => 'en_US.utf8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
143
|
+
with_env_vars({ 'LC_CTYPE' => 'en_US.utf8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
144
|
+
with_env_vars({ 'LANG' => 'en_US.utf8' }) { assert Nanoc::CLI.enable_utf8?(io) }
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
105
148
|
end
|
data/test/helper.rb
CHANGED
@@ -181,7 +181,7 @@ EOS
|
|
181
181
|
lines.each_slice(2) do |pair|
|
182
182
|
actual_out = eval(pair.first, b)
|
183
183
|
expected_out = eval(pair.last.match(/# ?=>(.*)/)[1], b)
|
184
|
-
|
184
|
+
|
185
185
|
assert_equal expected_out, actual_out,
|
186
186
|
"Incorrect example:\n#{pair.first}"
|
187
187
|
end
|
@@ -205,6 +205,14 @@ EOS
|
|
205
205
|
assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, error.message)
|
206
206
|
end
|
207
207
|
|
208
|
+
def with_env_vars(hash, &block)
|
209
|
+
orig_env_hash = ENV.to_hash
|
210
|
+
hash.each_pair { |k,v| ENV[k] = v }
|
211
|
+
yield
|
212
|
+
ensure
|
213
|
+
orig_env_hash.each_pair { |k,v| ENV[k] = v }
|
214
|
+
end
|
215
|
+
|
208
216
|
end
|
209
217
|
|
210
218
|
class Nanoc::TestCase < MiniTest::Unit::TestCase
|
@@ -209,18 +209,17 @@ EOS
|
|
209
209
|
io.write 'Old-<%= content_for(@items.find { |i| i.identifier == \'/includee/\' }, :blah) %>'
|
210
210
|
end
|
211
211
|
Nanoc::CLI.run(%w(compile))
|
212
|
+
assert_equal '{}', File.read('output/includee/index.html')
|
212
213
|
assert_equal 'Old-Content', File.read('output/includer/index.html')
|
213
214
|
|
214
215
|
# Compile again
|
215
|
-
$LOUD = true
|
216
216
|
File.open('content/includer.erb', 'w') do |io|
|
217
217
|
io.write 'New-<%= content_for(@items.find { |i| i.identifier == \'/includee/\' }, :blah) %>'
|
218
218
|
end
|
219
219
|
Nanoc::CLI.run(%w(compile))
|
220
|
+
assert_equal '{}', File.read('output/includee/index.html')
|
220
221
|
assert_equal 'New-Content', File.read('output/includer/index.html')
|
221
222
|
end
|
222
|
-
ensure
|
223
|
-
$LOUD = false
|
224
223
|
end
|
225
224
|
|
226
225
|
end
|
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.6
|
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-
|
12
|
+
date: 2013-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cri
|
@@ -289,6 +289,7 @@ files:
|
|
289
289
|
- lib/nanoc/tasks/deploy/rsync.rake
|
290
290
|
- lib/nanoc/tasks/validate.rake
|
291
291
|
- lib/nanoc/tasks.rb
|
292
|
+
- lib/nanoc/version.rb
|
292
293
|
- lib/nanoc.rb
|
293
294
|
- lib/nanoc3/cli.rb
|
294
295
|
- lib/nanoc3/tasks.rb
|