nanoc 4.5.1 → 4.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/NEWS.md +8 -0
- data/lib/nanoc.rb +1 -0
- data/lib/nanoc/base/errors.rb +1 -1
- data/lib/nanoc/data_sources/filesystem.rb +11 -3
- data/lib/nanoc/helpers/xml_sitemap.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/services/executor_spec.rb +4 -1
- data/spec/nanoc/regressions/gh_1022_spec.rb +24 -0
- data/test/data_sources/test_filesystem.rb +26 -0
- data/test/helpers/test_xml_sitemap.rb +27 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64b516baea97186cbb7ad99448ae7c02e9ce9ab2
|
4
|
+
data.tar.gz: 0ff4539f5c80a3c1f75838b7cb60014d3ab13a0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75b0aa1a6e74954ae178edbb234d46090310344ec13f00fde190cc0ab6822c136662a57c46f418fb68310a30ab194491ad42c3283a5e3f488913e7ccfa473c80
|
7
|
+
data.tar.gz: 242c70e3aa96b2730ce5614ee2d7a371cce65a8df888d40e8fc45b15f7deb73742643a5e509cdae79b6fd7a4ff8e3b6985fe2128b67d1e9087f784908d8ed65c
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
GIT
|
2
2
|
remote: git://github.com/bbatsov/rubocop.git
|
3
|
-
revision:
|
3
|
+
revision: c8d652dfa521526ff91cbf769e0d3551d50e1f3e
|
4
4
|
specs:
|
5
5
|
rubocop (0.46.0)
|
6
6
|
parser (>= 2.3.3.1, < 3.0)
|
@@ -27,7 +27,7 @@ GIT
|
|
27
27
|
PATH
|
28
28
|
remote: .
|
29
29
|
specs:
|
30
|
-
nanoc (4.5.
|
30
|
+
nanoc (4.5.2)
|
31
31
|
cri (~> 2.3)
|
32
32
|
ddplugin (~> 1.0)
|
33
33
|
hamster (~> 3.0)
|
@@ -251,7 +251,7 @@ GEM
|
|
251
251
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
252
252
|
rb-inotify (~> 0.9, >= 0.9.7)
|
253
253
|
ruby_dep (~> 1.2)
|
254
|
-
lumberjack (1.0.
|
254
|
+
lumberjack (1.0.11)
|
255
255
|
m (1.5.0)
|
256
256
|
method_source (>= 0.6.7)
|
257
257
|
rake (>= 0.9.2.2)
|
@@ -354,7 +354,7 @@ GEM
|
|
354
354
|
crack (>= 0.3.2)
|
355
355
|
hashdiff
|
356
356
|
xml-simple (1.1.5)
|
357
|
-
yard (0.9.
|
357
|
+
yard (0.9.7)
|
358
358
|
yard-contracts (0.1.5)
|
359
359
|
contracts (~> 0.7)
|
360
360
|
yard (~> 0.8)
|
data/NEWS.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.5.2 (2017-01-11)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Fixed handling of periods in full identifiers (#1022, #1059)
|
8
|
+
* Fixed “cannot layout binary items” error message (#1058)
|
9
|
+
* Fixed escaping of URLs in sitemaps (#1052, #1054)
|
10
|
+
|
3
11
|
## 4.5.1 (2017-01-09)
|
4
12
|
|
5
13
|
Fixes:
|
data/lib/nanoc.rb
CHANGED
data/lib/nanoc/base/errors.rb
CHANGED
@@ -125,7 +125,7 @@ module Nanoc::Int
|
|
125
125
|
# @param [Nanoc::Int::ItemRep] rep The item representation that was attempted
|
126
126
|
# to be laid out
|
127
127
|
def initialize(rep)
|
128
|
-
super("The
|
128
|
+
super("The “#{rep.item.identifier}” item (rep “#{rep.name}”) cannot be laid out because it is a binary item. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.")
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -302,9 +302,9 @@ module Nanoc::DataSources
|
|
302
302
|
|
303
303
|
regex =
|
304
304
|
if filename =~ /(^|\/)index(\.[^\/]+)?$/
|
305
|
-
|
305
|
+
allow_periods_in_identifiers? ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/
|
306
306
|
else
|
307
|
-
|
307
|
+
allow_periods_in_identifiers? ? /\.[^\/\.]+$/ : /\.[^\/]+$/
|
308
308
|
end
|
309
309
|
Nanoc::Identifier.new(filename.sub(regex, ''), type: :legacy)
|
310
310
|
end
|
@@ -329,13 +329,21 @@ module Nanoc::DataSources
|
|
329
329
|
#
|
330
330
|
# @return [Regex]
|
331
331
|
def extension_regex
|
332
|
-
if
|
332
|
+
if allow_periods_in_identifiers?
|
333
333
|
/(\.[^\/\.]+$)/
|
334
334
|
else
|
335
335
|
/(\.[^\/]+$)/
|
336
336
|
end
|
337
337
|
end
|
338
338
|
|
339
|
+
def allow_periods_in_identifiers?
|
340
|
+
if @config
|
341
|
+
@config[:allow_periods_in_identifiers] || @config[:identifier_type] == 'full'
|
342
|
+
else
|
343
|
+
false
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
339
347
|
# @return [ParseResult]
|
340
348
|
def parse(content_filename, meta_filename)
|
341
349
|
if meta_filename
|
@@ -30,7 +30,7 @@ module Nanoc::Helpers
|
|
30
30
|
reps.reject! { |r| !select_proc[r] } if select_proc
|
31
31
|
reps.sort_by { |r| r.name.to_s }.each do |rep|
|
32
32
|
xml.url do
|
33
|
-
xml.loc @config[:base_url] + rep.path
|
33
|
+
xml.loc URI.escape(@config[:base_url] + rep.path)
|
34
34
|
xml.lastmod item[:mtime].__nanoc_to_iso8601_date unless item[:mtime].nil?
|
35
35
|
xml.changefreq item[:changefreq] unless item[:changefreq].nil?
|
36
36
|
xml.priority item[:priority] unless item[:priority].nil?
|
data/lib/nanoc/version.rb
CHANGED
@@ -383,7 +383,10 @@ describe Nanoc::Int::Executor do
|
|
383
383
|
let(:content) { Nanoc::Int::BinaryContent.new(File.expand_path('donkey.md')) }
|
384
384
|
|
385
385
|
it 'raises' do
|
386
|
-
expect { subject }.to raise_error(
|
386
|
+
expect { subject }.to raise_error(
|
387
|
+
Nanoc::Int::Errors::CannotLayoutBinaryItem,
|
388
|
+
'The “/index.md” item (rep “donkey”) cannot be laid out because it is a binary item. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.',
|
389
|
+
)
|
387
390
|
end
|
388
391
|
end
|
389
392
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
describe 'GH-1022', site: true, stdio: true do
|
2
|
+
before do
|
3
|
+
File.write('content/ubuntu-16.10-server-amd64.iso.txt', 'torrent contents')
|
4
|
+
File.write('content/ubuntu-16.10-server-amd64.iso.yaml', 'distro: Ubuntu')
|
5
|
+
|
6
|
+
File.write('layouts/default.erb', '<%= @item[:distro] %> / <%= yield %>')
|
7
|
+
|
8
|
+
File.write('Rules', <<EOS)
|
9
|
+
compile '/**/*' do
|
10
|
+
layout '/default.*'
|
11
|
+
write item.identifier
|
12
|
+
end
|
13
|
+
|
14
|
+
layout '/*.erb', :erb
|
15
|
+
EOS
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'recompiles all reps of a changed item' do
|
19
|
+
Nanoc::CLI.run(%w(compile))
|
20
|
+
|
21
|
+
expect(File.file?('output/ubuntu-16.10-server-amd64.iso.txt')).to be
|
22
|
+
expect(File.read('output/ubuntu-16.10-server-amd64.iso.txt')).to eq('Ubuntu / torrent contents')
|
23
|
+
end
|
24
|
+
end
|
@@ -649,6 +649,32 @@ class Nanoc::DataSources::FilesystemTest < Nanoc::TestCase
|
|
649
649
|
end
|
650
650
|
end
|
651
651
|
|
652
|
+
def test_basename_of_with_full_style_identifiers
|
653
|
+
# Create data source
|
654
|
+
config = { identifier_type: 'full' }
|
655
|
+
data_source = Nanoc::DataSources::Filesystem.new(nil, nil, nil, config)
|
656
|
+
|
657
|
+
# Get input and expected output
|
658
|
+
expected = {
|
659
|
+
'/' => '/',
|
660
|
+
'/foo' => '/foo',
|
661
|
+
'/foo.html' => '/foo',
|
662
|
+
'/foo.xyz.html' => '/foo.xyz',
|
663
|
+
'/foo/bar' => '/foo/bar',
|
664
|
+
'/foo/bar.html' => '/foo/bar',
|
665
|
+
'/foo/bar.xyz.html' => '/foo/bar.xyz',
|
666
|
+
}
|
667
|
+
|
668
|
+
# Check
|
669
|
+
expected.each_pair do |input, expected_output|
|
670
|
+
actual_output = data_source.send(:basename_of, input)
|
671
|
+
assert_equal(
|
672
|
+
expected_output, actual_output,
|
673
|
+
"basename_of(#{input.inspect}) should equal #{expected_output.inspect}, not #{actual_output.inspect}"
|
674
|
+
)
|
675
|
+
end
|
676
|
+
end
|
677
|
+
|
652
678
|
def test_basename_of_allowing_periods_in_identifiers
|
653
679
|
# Create data source
|
654
680
|
data_source = Nanoc::DataSources::Filesystem.new(nil, nil, nil, allow_periods_in_identifiers: true)
|
@@ -186,6 +186,33 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
def test_url_escape
|
190
|
+
if_have 'builder', 'nokogiri' do
|
191
|
+
# Create items
|
192
|
+
@items = Nanoc::Int::IdentifiableCollection.new({})
|
193
|
+
item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/george/'), @view_context)
|
194
|
+
@items << item
|
195
|
+
create_item_rep(item.unwrap, :default, '/cool projects/проверка')
|
196
|
+
|
197
|
+
# Create sitemap item
|
198
|
+
@item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
|
199
|
+
|
200
|
+
# Create site
|
201
|
+
@config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }, nil)
|
202
|
+
|
203
|
+
# Build sitemap
|
204
|
+
res = xml_sitemap(items: @items)
|
205
|
+
|
206
|
+
# Check
|
207
|
+
doc = Nokogiri::XML(res)
|
208
|
+
urlsets = doc.css('> urlset')
|
209
|
+
assert_equal 1, urlsets.size
|
210
|
+
urls = urlsets.css('> url')
|
211
|
+
assert_equal 1, urls.size
|
212
|
+
assert_equal 'http://example.com/cool%20projects/%D0%BF%D1%80%D0%BE%D0%B2%D0%B5%D1%80%D0%BA%D0%B0', urls[0].css('> loc').inner_text
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
189
216
|
protected
|
190
217
|
|
191
218
|
def create_item_rep(item, name, path)
|
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: 4.5.
|
4
|
+
version: 4.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -405,6 +405,7 @@ files:
|
|
405
405
|
- spec/nanoc/integration/outdatedness_integration_spec.rb
|
406
406
|
- spec/nanoc/integration/partial_recompilation_spec.rb
|
407
407
|
- spec/nanoc/regressions/gh_1015_spec.rb
|
408
|
+
- spec/nanoc/regressions/gh_1022_spec.rb
|
408
409
|
- spec/nanoc/regressions/gh_1031_spec.rb
|
409
410
|
- spec/nanoc/regressions/gh_1035_spec.rb
|
410
411
|
- spec/nanoc/regressions/gh_1040_spec.rb
|