nanoc 3.6.9 → 3.6.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +15 -8
- data/Gemfile.lock +27 -14
- data/NEWS.md +14 -0
- data/lib/nanoc/base.rb +2 -0
- data/lib/nanoc/base/checksummer.rb +82 -0
- data/lib/nanoc/base/compilation/compiler.rb +4 -3
- data/lib/nanoc/base/compilation/filter.rb +3 -10
- data/lib/nanoc/base/compilation/rules_collection.rb +6 -1
- data/lib/nanoc/base/core_ext/array.rb +1 -1
- data/lib/nanoc/base/core_ext/hash.rb +1 -2
- data/lib/nanoc/base/core_ext/pathname.rb +1 -2
- data/lib/nanoc/base/core_ext/string.rb +1 -3
- data/lib/nanoc/base/errors.rb +9 -0
- data/lib/nanoc/base/result_data/item_rep.rb +2 -7
- data/lib/nanoc/base/source_data/code_snippet.rb +1 -1
- data/lib/nanoc/base/source_data/item.rb +1 -16
- data/lib/nanoc/base/source_data/layout.rb +1 -3
- data/lib/nanoc/base/source_data/site.rb +14 -0
- data/lib/nanoc/base/temp_filename_factory.rb +53 -0
- data/lib/nanoc/cli/commands/compile.rb +6 -2
- data/lib/nanoc/cli/commands/create-site.rb +3 -0
- data/lib/nanoc/cli/error_handler.rb +9 -5
- data/lib/nanoc/extra.rb +9 -8
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +48 -0
- data/lib/nanoc/extra/link_collector.rb +2 -0
- data/lib/nanoc/extra/piper.rb +1 -1
- data/lib/nanoc/filters/colorize_syntax.rb +2 -0
- data/lib/nanoc/filters/pandoc.rb +2 -2
- data/lib/nanoc/filters/relativize_paths.rb +2 -0
- data/lib/nanoc/filters/xsl.rb +2 -0
- data/lib/nanoc/version.rb +1 -1
- data/tasks/rubocop.rake +7 -3
- data/test/base/checksummer_spec.rb +274 -0
- data/test/base/core_ext/array_spec.rb +2 -2
- data/test/base/core_ext/hash_spec.rb +7 -4
- data/test/base/core_ext/pathname_spec.rb +6 -6
- data/test/base/core_ext/string_spec.rb +2 -2
- data/test/base/temp_filename_factory_spec.rb +72 -0
- data/test/base/test_site.rb +26 -0
- data/test/cli/commands/test_prune.rb +4 -0
- data/test/extra/checking/checks/test_css.rb +28 -24
- data/test/extra/checking/checks/test_html.rb +28 -24
- data/test/extra/test_piper.rb +12 -0
- data/test/filters/test_colorize_syntax.rb +6 -6
- data/test/filters/test_erb.rb +4 -0
- data/test/filters/test_pandoc.rb +15 -0
- data/test/filters/test_relativize_paths.rb +27 -65
- data/test/filters/test_xsl.rb +7 -35
- data/test/fixtures/vcr_cassettes/css_run_error.yml +65 -0
- data/test/fixtures/vcr_cassettes/css_run_ok.yml +55 -0
- data/test/fixtures/vcr_cassettes/html_run_error.yml +94 -0
- data/test/fixtures/vcr_cassettes/html_run_ok.yml +56 -0
- data/test/helper.rb +19 -9
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 606b38f2b3f74c3c2b091322bf96d0e31838d9be
|
4
|
+
data.tar.gz: 004240ce9c783bd2a7edcb3a3ea28f4bb4f719bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83ba1d9e5c6490a7354731241929bf372268b0ecfd33cde43cc7255e6cbe95174cabd85ea4683e4e84e8eb659efba791eca1328daa0f15976ac38ff53be8b95a
|
7
|
+
data.tar.gz: 74130a78b27dbd7b23b59e97232f1568161894343c1546fd1af6c54a68db8ef8ae23a618708c98bb5d2bd81ceaa523c2b2e81fbc0728532a67eec83216a4aa39
|
data/Gemfile
CHANGED
@@ -2,6 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
+
# FIXME we may be missing some mswin dependencies here
|
6
|
+
all_rubies = Bundler::Dependency::PLATFORM_MAP.keys
|
7
|
+
ruby_19_plus = [:ruby_19, :ruby_20, :ruby_21, :jruby] & all_rubies
|
8
|
+
ruby_19_plus_without_jruby = [:ruby_19, :ruby_20, :ruby_21] & all_rubies
|
9
|
+
|
5
10
|
gem 'adsf'
|
6
11
|
gem 'bluecloth', :platforms => :ruby
|
7
12
|
gem 'builder'
|
@@ -9,19 +14,19 @@ gem 'coderay'
|
|
9
14
|
gem 'compass'
|
10
15
|
gem 'coffee-script'
|
11
16
|
gem 'erubis'
|
12
|
-
gem 'fog'
|
17
|
+
gem 'fog', :platforms => ruby_19_plus
|
13
18
|
gem 'haml'
|
14
|
-
gem 'handlebars', :platforms =>
|
19
|
+
gem 'handlebars', :platforms => ruby_19_plus_without_jruby
|
15
20
|
gem 'kramdown'
|
16
21
|
gem 'less', '~> 2.0', :platforms => :ruby
|
17
|
-
gem 'listen'
|
22
|
+
gem 'listen', :platforms => ruby_19_plus
|
18
23
|
gem 'markaby'
|
19
24
|
gem 'maruku'
|
20
|
-
gem 'mime-types'
|
25
|
+
gem 'mime-types', :platforms => ruby_19_plus
|
21
26
|
gem 'minitest', '~> 4.0'
|
22
27
|
gem 'mocha'
|
23
28
|
gem 'mustache'
|
24
|
-
gem 'nokogiri', '~> 1.
|
29
|
+
gem 'nokogiri', '~> 1.6'
|
25
30
|
gem 'pandoc-ruby'
|
26
31
|
gem 'pry'
|
27
32
|
gem 'pygments.rb', :platforms => [:ruby, :mswin]
|
@@ -30,14 +35,16 @@ gem 'rake'
|
|
30
35
|
gem 'rainpress'
|
31
36
|
gem 'rdiscount', :platforms => [:ruby, :mswin]
|
32
37
|
gem 'rdoc'
|
33
|
-
gem 'redcarpet', :platforms => [:
|
38
|
+
gem 'redcarpet', :platforms => ruby_19_plus_without_jruby + [:mswin]
|
34
39
|
gem 'RedCloth'
|
35
|
-
gem 'rubocop'
|
40
|
+
gem 'rubocop', :platforms => ruby_19_plus
|
36
41
|
gem 'rubypants'
|
37
42
|
gem 'sass', '~> 3.2.2'
|
38
43
|
gem 'slim'
|
39
44
|
gem 'typogruby'
|
40
45
|
gem 'uglifier'
|
46
|
+
gem 'vcr'
|
41
47
|
gem 'w3c_validators'
|
42
|
-
gem '
|
48
|
+
gem 'webmock'
|
49
|
+
gem 'yuicompressor', :platforms => ruby_19_plus
|
43
50
|
gem 'yard'
|
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.10)
|
5
5
|
cri (~> 2.3)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,9 +9,10 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
RedCloth (4.2.9)
|
11
11
|
RedCloth (4.2.9-java)
|
12
|
+
addressable (2.3.6)
|
12
13
|
adsf (1.2.0)
|
13
14
|
rack (>= 1.0.0)
|
14
|
-
ast (
|
15
|
+
ast (2.0.0)
|
15
16
|
bluecloth (2.2.0)
|
16
17
|
builder (3.2.2)
|
17
18
|
celluloid (0.15.2)
|
@@ -27,18 +28,20 @@ GEM
|
|
27
28
|
coffee-script-source (1.7.0)
|
28
29
|
colored (1.2)
|
29
30
|
commonjs (0.2.7)
|
30
|
-
compass (0.12.
|
31
|
+
compass (0.12.6)
|
31
32
|
chunky_png (~> 1.2)
|
32
33
|
fssm (>= 0.2.7)
|
33
34
|
sass (~> 3.2.19)
|
35
|
+
crack (0.4.2)
|
36
|
+
safe_yaml (~> 1.0.0)
|
34
37
|
cri (2.6.0)
|
35
38
|
colored (~> 1.2)
|
36
39
|
erubis (2.7.0)
|
37
|
-
excon (0.
|
40
|
+
excon (0.33.0)
|
38
41
|
execjs (2.0.2)
|
39
42
|
ffi (1.9.3)
|
40
43
|
ffi (1.9.3-java)
|
41
|
-
fog (1.
|
44
|
+
fog (1.22.0)
|
42
45
|
fog-brightbox
|
43
46
|
fog-core (~> 1.21, >= 1.21.1)
|
44
47
|
fog-json
|
@@ -46,10 +49,10 @@ GEM
|
|
46
49
|
fog-brightbox (0.0.2)
|
47
50
|
fog-core
|
48
51
|
fog-json
|
49
|
-
fog-core (1.
|
52
|
+
fog-core (1.22.0)
|
50
53
|
builder
|
51
|
-
excon (~> 0.
|
52
|
-
formatador (~> 0.2
|
54
|
+
excon (~> 0.33)
|
55
|
+
formatador (~> 0.2)
|
53
56
|
mime-types
|
54
57
|
net-scp (~> 1.1)
|
55
58
|
net-ssh (>= 2.1.3)
|
@@ -80,6 +83,7 @@ GEM
|
|
80
83
|
metaclass (0.0.4)
|
81
84
|
method_source (0.8.2)
|
82
85
|
mime-types (2.2)
|
86
|
+
mini_portile (0.5.3)
|
83
87
|
minitest (4.7.5)
|
84
88
|
mocha (1.0.0)
|
85
89
|
metaclass (~> 0.0.1)
|
@@ -90,11 +94,13 @@ GEM
|
|
90
94
|
net-ssh (2.8.0)
|
91
95
|
nio4r (1.0.0)
|
92
96
|
nio4r (1.0.0-java)
|
93
|
-
nokogiri (1.
|
94
|
-
|
97
|
+
nokogiri (1.6.1)
|
98
|
+
mini_portile (~> 0.5.0)
|
99
|
+
nokogiri (1.6.1-java)
|
100
|
+
mini_portile (~> 0.5.0)
|
95
101
|
pandoc-ruby (0.7.5)
|
96
|
-
parser (2.1.
|
97
|
-
ast (
|
102
|
+
parser (2.1.9)
|
103
|
+
ast (>= 1.1, < 3.0)
|
98
104
|
slop (~> 3.4, >= 3.4.5)
|
99
105
|
posix-spawn (0.3.8)
|
100
106
|
powerpack (0.0.9)
|
@@ -113,7 +119,7 @@ GEM
|
|
113
119
|
rack (1.5.2)
|
114
120
|
rainbow (2.0.0)
|
115
121
|
rainpress (1.0)
|
116
|
-
rake (10.
|
122
|
+
rake (10.3.1)
|
117
123
|
rb-fsevent (0.9.4)
|
118
124
|
rb-inotify (0.9.3)
|
119
125
|
ffi (>= 0.5.0)
|
@@ -130,6 +136,7 @@ GEM
|
|
130
136
|
ruby-progressbar (~> 1.4)
|
131
137
|
ruby-progressbar (1.4.2)
|
132
138
|
rubypants (0.2.0)
|
139
|
+
safe_yaml (1.0.3)
|
133
140
|
sass (3.2.19)
|
134
141
|
slim (2.0.2)
|
135
142
|
temple (~> 0.6.6)
|
@@ -148,9 +155,13 @@ GEM
|
|
148
155
|
uglifier (2.5.0)
|
149
156
|
execjs (>= 0.3.0)
|
150
157
|
json (>= 1.8.0)
|
158
|
+
vcr (2.9.0)
|
151
159
|
w3c_validators (1.2)
|
152
160
|
json
|
153
161
|
nokogiri
|
162
|
+
webmock (1.17.4)
|
163
|
+
addressable (>= 2.2.7)
|
164
|
+
crack (>= 0.3.2)
|
154
165
|
yajl-ruby (1.1.0)
|
155
166
|
yard (0.8.7.4)
|
156
167
|
yuicompressor (1.3.3)
|
@@ -182,7 +193,7 @@ DEPENDENCIES
|
|
182
193
|
mocha
|
183
194
|
mustache
|
184
195
|
nanoc!
|
185
|
-
nokogiri (~> 1.
|
196
|
+
nokogiri (~> 1.6)
|
186
197
|
pandoc-ruby
|
187
198
|
pry
|
188
199
|
pygments.rb
|
@@ -198,6 +209,8 @@ DEPENDENCIES
|
|
198
209
|
slim
|
199
210
|
typogruby
|
200
211
|
uglifier
|
212
|
+
vcr
|
201
213
|
w3c_validators
|
214
|
+
webmock
|
202
215
|
yard
|
203
216
|
yuicompressor
|
data/NEWS.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# nanoc news
|
2
2
|
|
3
|
+
## 3.6.10 (???)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed occasional "no such file" error on JRuby (#422)
|
8
|
+
* Prevented multiple items and layouts from having the same identifier (#434, #435)
|
9
|
+
|
10
|
+
Enhancements:
|
11
|
+
|
12
|
+
* Set default encoding to UTF-8 (#428)
|
13
|
+
* Improved checksummer to reduce number of unnecessary recompiles (#310, #431)
|
14
|
+
* Disabled USR1 on JRuby in order to suppress warning (#425, #426)
|
15
|
+
* Made pandoc filter argument passing more generic (#210, #433)
|
16
|
+
|
3
17
|
## 3.6.9 (2014-04-15)
|
4
18
|
|
5
19
|
Fixes:
|
data/lib/nanoc/base.rb
CHANGED
@@ -7,12 +7,14 @@ module Nanoc
|
|
7
7
|
|
8
8
|
# Load helper classes
|
9
9
|
autoload 'Context', 'nanoc/base/context'
|
10
|
+
autoload 'Checksummer', 'nanoc/base/checksummer'
|
10
11
|
autoload 'DirectedGraph', 'nanoc/base/directed_graph'
|
11
12
|
autoload 'Errors', 'nanoc/base/errors'
|
12
13
|
autoload 'Memoization', 'nanoc/base/memoization'
|
13
14
|
autoload 'NotificationCenter', 'nanoc/base/notification_center'
|
14
15
|
autoload 'PluginRegistry', 'nanoc/base/plugin_registry'
|
15
16
|
autoload 'Store', 'nanoc/base/store'
|
17
|
+
autoload 'TempFilenameFactory', 'nanoc/base/temp_filename_factory'
|
16
18
|
|
17
19
|
# Load source data classes
|
18
20
|
autoload 'CodeSnippet', 'nanoc/base/source_data/code_snippet'
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
|
5
|
+
# Creates checksums for given objects.
|
6
|
+
#
|
7
|
+
# A checksum is a string, such as “mL+TaqNsEeiPkWloPgCtAofT1yg=”, that is used
|
8
|
+
# to determine whether a piece of data has changed.
|
9
|
+
class Checksummer
|
10
|
+
|
11
|
+
class << self
|
12
|
+
|
13
|
+
# @param obj The object to create a checksum for
|
14
|
+
#
|
15
|
+
# @return [String] The digest
|
16
|
+
def calc(obj)
|
17
|
+
digest = Digest::SHA1.new
|
18
|
+
update(obj, digest)
|
19
|
+
digest.base64digest
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def update(obj, digest)
|
25
|
+
digest.update(obj.class.to_s)
|
26
|
+
|
27
|
+
case obj
|
28
|
+
when String
|
29
|
+
digest.update(obj)
|
30
|
+
when Array
|
31
|
+
obj.each do |el|
|
32
|
+
digest.update('elem')
|
33
|
+
update(el, digest)
|
34
|
+
end
|
35
|
+
when Hash
|
36
|
+
obj.each do |key, value|
|
37
|
+
digest.update('key')
|
38
|
+
update(key, digest)
|
39
|
+
digest.update('value')
|
40
|
+
update(value, digest)
|
41
|
+
end
|
42
|
+
when Pathname
|
43
|
+
filename = obj.to_s
|
44
|
+
if File.exist?(filename)
|
45
|
+
stat = File.stat(filename)
|
46
|
+
digest.update(stat.size.to_s + '-' + stat.mtime.utc.to_s)
|
47
|
+
else
|
48
|
+
digest.update('???')
|
49
|
+
end
|
50
|
+
when Nanoc::RulesCollection
|
51
|
+
update(obj.data, digest)
|
52
|
+
when Nanoc::CodeSnippet
|
53
|
+
update(obj.data, digest)
|
54
|
+
when Nanoc::Item, Nanoc::Layout
|
55
|
+
digest.update('content')
|
56
|
+
if obj.respond_to?(:binary?) && obj.binary?
|
57
|
+
update(Pathname.new(obj.raw_filename), digest)
|
58
|
+
else
|
59
|
+
update(obj.raw_content, digest)
|
60
|
+
end
|
61
|
+
|
62
|
+
digest.update('attributes')
|
63
|
+
attributes = obj.attributes.dup
|
64
|
+
attributes.delete(:file)
|
65
|
+
update(attributes, digest)
|
66
|
+
else
|
67
|
+
data = begin
|
68
|
+
Marshal.dump(obj)
|
69
|
+
rescue
|
70
|
+
obj.inspect
|
71
|
+
end
|
72
|
+
|
73
|
+
digest.update(data)
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
@@ -90,9 +90,10 @@ module Nanoc
|
|
90
90
|
dependency_tracker.stop
|
91
91
|
store
|
92
92
|
ensure
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
Nanoc::TempFilenameFactory.instance.cleanup(
|
94
|
+
Nanoc::Filter::TMP_BINARY_ITEMS_DIR)
|
95
|
+
Nanoc::TempFilenameFactory.instance.cleanup(
|
96
|
+
Nanoc::ItemRep::TMP_TEXT_ITEMS_DIR)
|
96
97
|
end
|
97
98
|
|
98
99
|
# @group Private instance methods
|
@@ -28,8 +28,7 @@ module Nanoc
|
|
28
28
|
# @abstract Subclass and override {#run} to implement a custom filter.
|
29
29
|
class Filter < Context
|
30
30
|
|
31
|
-
|
32
|
-
TMP_BINARY_ITEMS_DIR = 'tmp/binary_items'
|
31
|
+
TMP_BINARY_ITEMS_DIR = 'binary_items'
|
33
32
|
|
34
33
|
# A hash containing variables that will be made available during
|
35
34
|
# filtering.
|
@@ -149,14 +148,8 @@ module Nanoc
|
|
149
148
|
#
|
150
149
|
# @return [String] The output filename
|
151
150
|
def output_filename
|
152
|
-
@output_filename ||=
|
153
|
-
|
154
|
-
tempfile = Tempfile.new('', TMP_BINARY_ITEMS_DIR)
|
155
|
-
new_filename = tempfile.path
|
156
|
-
tempfile.close!
|
157
|
-
|
158
|
-
File.expand_path(new_filename)
|
159
|
-
end
|
151
|
+
@output_filename ||=
|
152
|
+
Nanoc::TempFilenameFactory.instance.create(TMP_BINARY_ITEMS_DIR)
|
160
153
|
end
|
161
154
|
|
162
155
|
# Returns the filename associated with the item that is being filtered.
|
@@ -7,6 +7,11 @@ module Nanoc
|
|
7
7
|
# @api private
|
8
8
|
class RulesCollection
|
9
9
|
|
10
|
+
# @return [String] the contents of the Rules file
|
11
|
+
#
|
12
|
+
# @api private
|
13
|
+
attr_accessor :data
|
14
|
+
|
10
15
|
extend Nanoc::Memoization
|
11
16
|
|
12
17
|
# @return [Array<Nanoc::Rule>] The list of item compilation rules that
|
@@ -161,7 +166,7 @@ module Nanoc
|
|
161
166
|
# @return [String] The checksum for this object. If its contents change,
|
162
167
|
# the checksum will change as well.
|
163
168
|
def checksum
|
164
|
-
|
169
|
+
Nanoc::Checksummer.calc(self)
|
165
170
|
end
|
166
171
|
|
167
172
|
def inspect
|
data/lib/nanoc/base/errors.rb
CHANGED
@@ -221,6 +221,15 @@ module Nanoc
|
|
221
221
|
|
222
222
|
end
|
223
223
|
|
224
|
+
# Error that is raised when multiple items or layouts with the same identifier exist.
|
225
|
+
class DuplicateIdentifier < Generic
|
226
|
+
|
227
|
+
def initialize(identifier, type)
|
228
|
+
super("There are multiple #{type}s with the #{identifier} identifier.")
|
229
|
+
end
|
230
|
+
|
231
|
+
end
|
232
|
+
|
224
233
|
end
|
225
234
|
|
226
235
|
end
|
@@ -149,15 +149,10 @@ module Nanoc
|
|
149
149
|
Nanoc::NotificationCenter.post(:rep_written, self, raw_path, is_created, is_modified)
|
150
150
|
end
|
151
151
|
|
152
|
-
TMP_TEXT_ITEMS_DIR = '
|
152
|
+
TMP_TEXT_ITEMS_DIR = 'text_items'
|
153
153
|
|
154
154
|
def temp_filename
|
155
|
-
|
156
|
-
tempfile = Tempfile.new('', TMP_TEXT_ITEMS_DIR)
|
157
|
-
new_filename = tempfile.path
|
158
|
-
tempfile.close!
|
159
|
-
|
160
|
-
File.expand_path(new_filename)
|
155
|
+
Nanoc::TempFilenameFactory.instance.create(TMP_TEXT_ITEMS_DIR)
|
161
156
|
end
|
162
157
|
|
163
158
|
# Resets the compilation progress for this item representation. This is
|