nanoc 4.3.5 → 4.3.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.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +15 -11
- data/NEWS.md +15 -1
- data/lib/nanoc/base/feature.rb +16 -0
- data/lib/nanoc/base/services/action_provider.rb +4 -0
- data/lib/nanoc/base/services/item_rep_router.rb +6 -7
- data/lib/nanoc/cli/cleaning_stream.rb +5 -0
- data/lib/nanoc/cli/command_runner.rb +3 -3
- data/lib/nanoc/cli/commands/shell.rb +22 -3
- data/lib/nanoc/extra/checking/checks/external_links.rb +3 -38
- data/lib/nanoc/extra/checking/dsl.rb +2 -1
- data/lib/nanoc/extra/core_ext/time.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +1 -1
- data/lib/nanoc/rule_dsl/action_provider.rb +4 -0
- data/lib/nanoc/rule_dsl/compiler_dsl.rb +8 -2
- data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +11 -3
- data/lib/nanoc/version.rb +1 -1
- data/nanoc.gemspec +1 -0
- data/test/cli/test_cleaning_stream.rb +13 -2
- data/test/extra/checking/test_dsl.rb +8 -0
- data/test/extra/core_ext/test_time.rb +5 -1
- data/test/helpers/test_xml_sitemap.rb +3 -3
- data/test/rule_dsl/test_compiler_dsl.rb +18 -4
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33272b9e2fbec854248b3d0bd0abbcb714f3e1eb
|
4
|
+
data.tar.gz: 5f4d064d412bb748a9103454243c06bd851e9f6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f32329a10aac398a06ca5974db441a3b685fc27e8db011a87f4e8e8937bcb371495e822a4ba6fe3c6bd4391f823cbc946a38cc77fba0d388671d2629358ac6c
|
7
|
+
data.tar.gz: 4b32d6d3c48b88ad8f996c53278f759073a17844d729c532991f5da01e8c7923d3851e653cf8cb31a0de877140ef15bbbad40d30977cacab7af9a1217869d70a
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nanoc (4.3.
|
4
|
+
nanoc (4.3.6)
|
5
5
|
cri (~> 2.3)
|
6
6
|
hamster (~> 3.0)
|
7
|
+
parallel (~> 1.9)
|
7
8
|
ref (~> 2.0)
|
8
9
|
|
9
10
|
GEM
|
@@ -52,7 +53,7 @@ GEM
|
|
52
53
|
diff-lcs (1.2.5)
|
53
54
|
docile (1.1.5)
|
54
55
|
erubis (2.7.0)
|
55
|
-
excon (0.
|
56
|
+
excon (0.54.0)
|
56
57
|
execjs (2.7.0)
|
57
58
|
ffi (1.9.14)
|
58
59
|
fission (0.5.0)
|
@@ -173,9 +174,9 @@ GEM
|
|
173
174
|
fog-voxel (0.1.0)
|
174
175
|
fog-core
|
175
176
|
fog-xml
|
176
|
-
fog-vsphere (1.
|
177
|
+
fog-vsphere (1.4.0)
|
177
178
|
fog-core
|
178
|
-
rbvmomi (~> 1.
|
179
|
+
rbvmomi (~> 1.9)
|
179
180
|
fog-xenserver (0.2.3)
|
180
181
|
fog-core
|
181
182
|
fog-xml
|
@@ -229,7 +230,7 @@ GEM
|
|
229
230
|
mime-types-data (3.2016.0521)
|
230
231
|
mini_portile2 (2.1.0)
|
231
232
|
minitest (5.9.1)
|
232
|
-
mocha (1.2.
|
233
|
+
mocha (1.2.1)
|
233
234
|
metaclass (~> 0.0.1)
|
234
235
|
multi_json (1.12.1)
|
235
236
|
mustache (1.0.3)
|
@@ -240,6 +241,7 @@ GEM
|
|
240
241
|
nenv (~> 0.1)
|
241
242
|
shellany (~> 0.0)
|
242
243
|
pandoc-ruby (2.0.1)
|
244
|
+
parallel (1.9.0)
|
243
245
|
parser (2.3.1.4)
|
244
246
|
ast (~> 2.2)
|
245
247
|
posix-spawn (0.3.11)
|
@@ -258,10 +260,11 @@ GEM
|
|
258
260
|
rb-fsevent (0.9.7)
|
259
261
|
rb-inotify (0.9.7)
|
260
262
|
ffi (>= 0.5.0)
|
261
|
-
rbvmomi (1.
|
262
|
-
builder
|
263
|
-
|
264
|
-
|
263
|
+
rbvmomi (1.9.4)
|
264
|
+
builder (~> 3.2)
|
265
|
+
json (>= 1.8)
|
266
|
+
nokogiri (~> 1.5)
|
267
|
+
trollop (~> 2.1)
|
265
268
|
rdiscount (2.2.0.1)
|
266
269
|
rdoc (4.2.1)
|
267
270
|
redcarpet (3.3.4)
|
@@ -288,7 +291,7 @@ GEM
|
|
288
291
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
289
292
|
ruby-progressbar (1.8.1)
|
290
293
|
ruby_dep (1.5.0)
|
291
|
-
rubypants (0.
|
294
|
+
rubypants (0.6.0)
|
292
295
|
safe_yaml (1.0.4)
|
293
296
|
sass (3.4.22)
|
294
297
|
shellany (0.0.1)
|
@@ -362,6 +365,7 @@ DEPENDENCIES
|
|
362
365
|
nanoc!
|
363
366
|
nokogiri (~> 1.6)
|
364
367
|
pandoc-ruby
|
368
|
+
parallel
|
365
369
|
pry
|
366
370
|
pygments.rb
|
367
371
|
rack
|
@@ -387,4 +391,4 @@ DEPENDENCIES
|
|
387
391
|
yuicompressor
|
388
392
|
|
389
393
|
BUNDLED WITH
|
390
|
-
1.13.
|
394
|
+
1.13.6
|
data/NEWS.md
CHANGED
@@ -1,10 +1,24 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.3.6 (2016-10-23)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Made legacy patterns properly support full identifiers (#957)
|
8
|
+
* Fixed timezone issues in `#to_iso8601_date` (#961)
|
9
|
+
* Fixed error when accessing item (rep) paths in shell command (#963)
|
10
|
+
* Fixed issue that caused `#path` to be nil inside compilation rules (#964)
|
11
|
+
* Made `__FILE__` in Checks file be a absolute path (#966)
|
12
|
+
|
13
|
+
Enhancements:
|
14
|
+
|
15
|
+
* Made the command line write status information to stderr, not stdout (#958)
|
16
|
+
|
3
17
|
## 4.3.5 (2016-10-14)
|
4
18
|
|
5
19
|
Fixes:
|
6
20
|
|
7
|
-
* Handle `form/@action` in `relativize_paths` filter [Lorin Werthen]
|
21
|
+
* Handle `form/@action` in `relativize_paths` filter (#950) [Lorin Werthen]
|
8
22
|
|
9
23
|
Experimental features:
|
10
24
|
|
data/lib/nanoc/base/feature.rb
CHANGED
@@ -46,6 +46,22 @@ module Nanoc
|
|
46
46
|
enabled_features.include?('all')
|
47
47
|
end
|
48
48
|
|
49
|
+
# @api private
|
50
|
+
def self.enable(feature_name)
|
51
|
+
raise ArgumentError, 'no block given' unless block_given?
|
52
|
+
|
53
|
+
if enabled?(feature_name)
|
54
|
+
yield
|
55
|
+
else
|
56
|
+
begin
|
57
|
+
enabled_features << feature_name
|
58
|
+
yield
|
59
|
+
ensure
|
60
|
+
enabled_features.delete(feature_name)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
49
65
|
# @api private
|
50
66
|
def self.reset_caches
|
51
67
|
@enabled_features = nil
|
@@ -18,15 +18,14 @@ module Nanoc::Int
|
|
18
18
|
def run
|
19
19
|
paths_to_reps = {}
|
20
20
|
@reps.each do |rep|
|
21
|
-
|
22
|
-
|
23
|
-
route_rep(rep, snapshot_action, paths_to_reps)
|
21
|
+
@action_provider.paths_for(rep).each do |snapshot_name, path|
|
22
|
+
route_rep(rep, path, snapshot_name, paths_to_reps)
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
def route_rep(rep,
|
29
|
-
basic_path =
|
27
|
+
def route_rep(rep, path, snapshot_name, paths_to_reps)
|
28
|
+
basic_path = path
|
30
29
|
return if basic_path.nil?
|
31
30
|
basic_path = basic_path.encode('UTF-8')
|
32
31
|
|
@@ -37,8 +36,8 @@ module Nanoc::Int
|
|
37
36
|
paths_to_reps[basic_path] = rep
|
38
37
|
end
|
39
38
|
|
40
|
-
rep.raw_paths[
|
41
|
-
rep.paths[
|
39
|
+
rep.raw_paths[snapshot_name] = @site.config[:output_dir] + basic_path
|
40
|
+
rep.paths[snapshot_name] = strip_index_filename(basic_path)
|
42
41
|
end
|
43
42
|
|
44
43
|
def strip_index_filename(basic_path)
|
@@ -45,8 +45,8 @@ module Nanoc::CLI
|
|
45
45
|
#
|
46
46
|
# @return [void]
|
47
47
|
def load_site(preprocess: false)
|
48
|
-
print 'Loading site… '
|
49
|
-
$
|
48
|
+
$stderr.print 'Loading site… '
|
49
|
+
$stderr.flush
|
50
50
|
|
51
51
|
if site.nil?
|
52
52
|
raise ::Nanoc::Int::Errors::GenericTrivial, 'The current working directory does not seem to be a Nanoc site.'
|
@@ -56,7 +56,7 @@ module Nanoc::CLI
|
|
56
56
|
site.compiler.action_provider.preprocess(site)
|
57
57
|
end
|
58
58
|
|
59
|
-
puts 'done'
|
59
|
+
$stderr.puts 'done'
|
60
60
|
end
|
61
61
|
|
62
62
|
# @return [Boolean] true if debug output is enabled, false if not
|
@@ -21,11 +21,30 @@ module Nanoc::CLI::Commands
|
|
21
21
|
self.class.env_for_site(site)
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.reps_for(site)
|
25
|
+
Nanoc::Int::ItemRepRepo.new.tap do |reps|
|
26
|
+
action_provider = Nanoc::Int::ActionProvider.named(:rule_dsl).for(site)
|
27
|
+
builder = Nanoc::Int::ItemRepBuilder.new(site, action_provider, reps)
|
28
|
+
builder.run
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.view_context_for(site)
|
33
|
+
Nanoc::ViewContext.new(
|
34
|
+
reps: reps_for(site),
|
35
|
+
items: site.items,
|
36
|
+
dependency_tracker: Nanoc::Int::DependencyTracker::Null.new,
|
37
|
+
compiler: nil,
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
24
41
|
def self.env_for_site(site)
|
42
|
+
view_context = view_context_for(site)
|
43
|
+
|
25
44
|
{
|
26
|
-
items: Nanoc::ItemCollectionWithRepsView.new(site.items,
|
27
|
-
layouts: Nanoc::LayoutCollectionView.new(site.layouts,
|
28
|
-
config: Nanoc::ConfigView.new(site.config,
|
45
|
+
items: Nanoc::ItemCollectionWithRepsView.new(site.items, view_context),
|
46
|
+
layouts: Nanoc::LayoutCollectionView.new(site.layouts, view_context),
|
47
|
+
config: Nanoc::ConfigView.new(site.config, view_context),
|
29
48
|
}
|
30
49
|
end
|
31
50
|
end
|
@@ -12,6 +12,8 @@ module ::Nanoc::Extra::Checking::Checks
|
|
12
12
|
identifiers :external_links, :elinks
|
13
13
|
|
14
14
|
def run
|
15
|
+
require 'parallel'
|
16
|
+
|
15
17
|
# Find all broken external hrefs
|
16
18
|
# TODO: de-duplicate this (duplicated in internal links check)
|
17
19
|
filenames = output_filenames.select { |f| File.extname(f) == '.html' && !excluded_file?(f) }
|
@@ -40,45 +42,8 @@ module ::Nanoc::Extra::Checking::Checks
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
|
-
class ArrayEnumerator
|
44
|
-
def initialize(array)
|
45
|
-
@array = array
|
46
|
-
@index = 0
|
47
|
-
@mutex = Mutex.new
|
48
|
-
end
|
49
|
-
|
50
|
-
def next
|
51
|
-
@mutex.synchronize do
|
52
|
-
@index += 1
|
53
|
-
return @array[@index - 1]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
45
|
def select_invalid(hrefs)
|
59
|
-
|
60
|
-
mutex = Mutex.new
|
61
|
-
invalid = Set.new
|
62
|
-
|
63
|
-
threads = []
|
64
|
-
10.times do
|
65
|
-
threads << Thread.new do
|
66
|
-
loop do
|
67
|
-
href = enum.next
|
68
|
-
break if href.nil?
|
69
|
-
|
70
|
-
res = validate(href)
|
71
|
-
next unless res
|
72
|
-
|
73
|
-
mutex.synchronize do
|
74
|
-
invalid << res
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
threads.each(&:join)
|
80
|
-
|
81
|
-
invalid
|
46
|
+
Parallel.map(hrefs, in_threads: 10) { |href| validate(href) }.compact
|
82
47
|
end
|
83
48
|
|
84
49
|
def validate(href)
|
@@ -278,9 +278,15 @@ module Nanoc::RuleDSL
|
|
278
278
|
# Add leading/trailing slashes if necessary
|
279
279
|
new_identifier = identifier.dup
|
280
280
|
new_identifier[/^/] = '/' if identifier[0, 1] != '/'
|
281
|
-
new_identifier[/$/] = '
|
281
|
+
new_identifier[/$/] = '/?' unless ['*', '/'].include?(identifier[-1, 1])
|
282
282
|
|
283
|
-
|
283
|
+
regex_string =
|
284
|
+
new_identifier
|
285
|
+
.gsub('.', '\.')
|
286
|
+
.gsub('*', '(.*?)')
|
287
|
+
.gsub('+', '(.+?)')
|
288
|
+
|
289
|
+
/^#{regex_string}$/
|
284
290
|
else
|
285
291
|
identifier
|
286
292
|
end
|
@@ -38,9 +38,6 @@ module Nanoc::RuleDSL
|
|
38
38
|
#
|
39
39
|
# @return [Nanoc::Int::RuleMemory]
|
40
40
|
def [](obj)
|
41
|
-
# FIXME: Remove this
|
42
|
-
obj = obj.unwrap if obj.respond_to?(:unwrap)
|
43
|
-
|
44
41
|
case obj
|
45
42
|
when Nanoc::Int::ItemRep
|
46
43
|
new_rule_memory_for_rep(obj)
|
@@ -92,6 +89,17 @@ module Nanoc::RuleDSL
|
|
92
89
|
executor.rule_memory
|
93
90
|
end
|
94
91
|
|
92
|
+
# @param [Nanoc::Int::ItemRep] rep The item representation to get the rule
|
93
|
+
# memory for
|
94
|
+
#
|
95
|
+
# @return [Hash<Symbol, String>] Pairs of snapshot name and path
|
96
|
+
def paths_for_rep(rep)
|
97
|
+
snapshot_actions = new_rule_memory_for_rep(rep).snapshot_actions
|
98
|
+
snapshot_actions.each_with_object({}) do |action, paths|
|
99
|
+
paths[action.snapshot_name] = action.path
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
95
103
|
# @param [Nanoc::Int::Layout] layout
|
96
104
|
#
|
97
105
|
# @return [Nanoc::Int::RuleMemory]
|
data/lib/nanoc/version.rb
CHANGED
data/nanoc.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_runtime_dependency('cri', '~> 2.3')
|
28
28
|
s.add_runtime_dependency('hamster', '~> 3.0')
|
29
29
|
s.add_runtime_dependency('ref', '~> 2.0')
|
30
|
+
s.add_runtime_dependency('parallel', '~> 1.9')
|
30
31
|
|
31
32
|
s.add_development_dependency('bundler', '>= 1.7.10', '< 2.0')
|
32
33
|
end
|
@@ -3,7 +3,7 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
3
3
|
attr_accessor :called_methods
|
4
4
|
|
5
5
|
def initialize
|
6
|
-
@called_methods =
|
6
|
+
@called_methods = []
|
7
7
|
end
|
8
8
|
|
9
9
|
# rubocop:disable Style/MethodMissing
|
@@ -18,7 +18,7 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_forward
|
21
|
-
methods = [:write, :<<, :tty?, :flush, :tell, :print, :puts, :string, :reopen, :exist?, :exists?, :close]
|
21
|
+
methods = [:write, :<<, :tty?, :tty?, :flush, :tell, :print, :puts, :string, :reopen, :exist?, :exists?, :close]
|
22
22
|
|
23
23
|
s = Stream.new
|
24
24
|
cs = Nanoc::CLI::CleaningStream.new(s)
|
@@ -26,6 +26,7 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
26
26
|
cs.write('aaa')
|
27
27
|
cs << 'bb'
|
28
28
|
cs.tty?
|
29
|
+
cs.isatty
|
29
30
|
cs.flush
|
30
31
|
cs.tell
|
31
32
|
cs.print('cc')
|
@@ -41,6 +42,16 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
|
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
45
|
+
def test_forward_tty_cached
|
46
|
+
s = Stream.new
|
47
|
+
cs = Nanoc::CLI::CleaningStream.new(s)
|
48
|
+
|
49
|
+
cs.tty?
|
50
|
+
cs.isatty
|
51
|
+
|
52
|
+
assert_equal [:tty?], s.called_methods
|
53
|
+
end
|
54
|
+
|
44
55
|
def test_works_with_logger
|
45
56
|
require 'logger'
|
46
57
|
stream = StringIO.new
|
@@ -20,4 +20,12 @@ class Nanoc::Extra::Checking::DSLTest < Nanoc::TestCase
|
|
20
20
|
assert_equal 'hello', $greeting
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
def test_has_absolute_path
|
25
|
+
with_site do |_site|
|
26
|
+
File.write('Checks', '$stuff = __FILE__')
|
27
|
+
Nanoc::Extra::Checking::DSL.from_file('Checks')
|
28
|
+
assert($stuff.start_with?('/'))
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|
@@ -1,8 +1,12 @@
|
|
1
1
|
class Nanoc::ExtraCoreExtTimeTest < Nanoc::TestCase
|
2
|
-
def
|
2
|
+
def test___nanoc_to_iso8601_date_utc
|
3
3
|
assert_equal('2008-05-19', Time.utc(2008, 5, 19, 14, 20, 0, 0).__nanoc_to_iso8601_date)
|
4
4
|
end
|
5
5
|
|
6
|
+
def test___nanoc_to_iso8601_date_non_utc
|
7
|
+
assert_equal('2008-05-18', Time.new(2008, 5, 19, 0, 0, 0, '+02:00').__nanoc_to_iso8601_date)
|
8
|
+
end
|
9
|
+
|
6
10
|
def test___nanoc_to_iso8601_time
|
7
11
|
assert_equal('2008-05-19T14:20:00Z', Time.utc(2008, 5, 19, 14, 20, 0, 0).__nanoc_to_iso8601_time)
|
8
12
|
end
|
@@ -30,7 +30,7 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
|
|
30
30
|
@items << item
|
31
31
|
|
32
32
|
# Create item 3
|
33
|
-
attrs = { mtime: Time.parse('2004-07-12'), changefreq: 'daily', priority: 0.5 }
|
33
|
+
attrs = { mtime: Time.parse('2004-07-12 00:00:00 +02:00'), changefreq: 'daily', priority: 0.5 }
|
34
34
|
item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three/'), @view_context)
|
35
35
|
@items << item
|
36
36
|
create_item_rep(item.unwrap, :three_a, '/item-three/a/')
|
@@ -70,8 +70,8 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
|
|
70
70
|
assert_equal '0.5', urls[3].css('> priority').inner_text
|
71
71
|
assert_equal '', urls[0].css('> lastmod').inner_text
|
72
72
|
assert_equal '', urls[1].css('> lastmod').inner_text
|
73
|
-
assert_equal '2004-07-
|
74
|
-
assert_equal '2004-07-
|
73
|
+
assert_equal '2004-07-11', urls[2].css('> lastmod').inner_text
|
74
|
+
assert_equal '2004-07-11', urls[3].css('> lastmod').inner_text
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -319,7 +319,7 @@ EOS
|
|
319
319
|
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
320
320
|
|
321
321
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo') }
|
322
|
-
expected = %r{^/foo
|
322
|
+
expected = %r{^/foo/?$}
|
323
323
|
|
324
324
|
assert_equal(expected.to_s, actual.to_s)
|
325
325
|
assert_equal(expected.source, actual.source)
|
@@ -333,7 +333,7 @@ EOS
|
|
333
333
|
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
334
334
|
|
335
335
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar') }
|
336
|
-
expected = %r{^/foo/(.*?)/bar
|
336
|
+
expected = %r{^/foo/(.*?)/bar/?$}
|
337
337
|
|
338
338
|
assert_equal(expected.to_s, actual.to_s)
|
339
339
|
assert_equal(expected.source, actual.source)
|
@@ -347,7 +347,7 @@ EOS
|
|
347
347
|
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
348
348
|
|
349
349
|
actual = compiler_dsl.instance_eval { identifier_to_regex('foo/*/bar/*/qux') }
|
350
|
-
expected = %r{^/foo/(.*?)/bar/(.*?)/qux
|
350
|
+
expected = %r{^/foo/(.*?)/bar/(.*?)/qux/?$}
|
351
351
|
|
352
352
|
assert_equal(expected.to_s, actual.to_s)
|
353
353
|
assert_equal(expected.source, actual.source)
|
@@ -403,7 +403,7 @@ EOS
|
|
403
403
|
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
404
404
|
|
405
405
|
actual = compiler_dsl.instance_eval { identifier_to_regex('/foo/+') }
|
406
|
-
expected = %r{^/foo/(.+?)
|
406
|
+
expected = %r{^/foo/(.+?)/?$}
|
407
407
|
|
408
408
|
assert_equal(expected.to_s, actual.to_s)
|
409
409
|
assert_equal(expected.source, actual.source)
|
@@ -414,6 +414,20 @@ EOS
|
|
414
414
|
refute('/foo/' =~ actual)
|
415
415
|
end
|
416
416
|
|
417
|
+
def test_identifier_to_regex_with_full_identifier
|
418
|
+
# Create compiler DSL
|
419
|
+
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
420
|
+
|
421
|
+
actual = compiler_dsl.instance_eval { identifier_to_regex('/favicon.ico') }
|
422
|
+
expected = %r{^/favicon\.ico/?$}
|
423
|
+
|
424
|
+
assert_equal(expected.to_s, actual.to_s)
|
425
|
+
|
426
|
+
assert('/favicon.ico' =~ actual)
|
427
|
+
assert('/favicon.ico/' =~ actual)
|
428
|
+
refute('/faviconxico' =~ actual)
|
429
|
+
end
|
430
|
+
|
417
431
|
def test_dsl_has_no_access_to_compiler
|
418
432
|
compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, {})
|
419
433
|
assert_raises(NameError) do
|
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.3.
|
4
|
+
version: 4.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Defreyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cri
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: parallel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.9'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.9'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|