nanoc-conref-fs 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nanoc-conref-fs/ancestry.rb +19 -9
- data/lib/nanoc-conref-fs/conref-fs.rb +6 -30
- data/nanoc-conref-fs.gemspec +3 -3
- data/test/ancestry_test.rb +16 -18
- data/test/conref_fs_test.rb +14 -42
- data/test/datafiles_test.rb +1 -1
- data/test/fixtures/content/children/no_children.html +18 -0
- data/test/fixtures/content/children/no_children.md +5 -0
- data/test/fixtures/content/empty-categories/content-article.md +4 -0
- data/test/fixtures/data/categories/category.yml +1 -0
- data/test/fixtures/data/categories/empty_category.yml +7 -0
- data/test/fixtures/nanoc.yaml +7 -1
- data/test/test_helper.rb +2 -54
- data/test/variable_mixin_test.rb +3 -5
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c20f57a9b8ade6bcb512e52fe3926b5045019bcb
|
4
|
+
data.tar.gz: 4e8728448547dcd9518b02483ac54f776cdd0af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9039bce1972245ee83270d29deadeeb26c15f8e8188f009d0d4925cca1c939949341f6351f8673e46ddd0d4a33b3eef602fa44fa90a6ffe8d97c724a08467f7a
|
7
|
+
data.tar.gz: 48f3c11bd6e5ca9cb75fb88fbbbe62e6e6431154ba175d25ac23e3c745ffce843a3b52d58dd07aa100ff5659ae35980791d8e0d574f01dde1f45e3fab1be5b7e
|
@@ -37,6 +37,7 @@ module NanocConrefFS
|
|
37
37
|
def find_hash_parents(toc, title)
|
38
38
|
parents = ''
|
39
39
|
toc.each_key do |key|
|
40
|
+
next if toc[key].nil?
|
40
41
|
toc[key].each do |item|
|
41
42
|
if item.is_a?(Hash)
|
42
43
|
if item.keys.include?(title)
|
@@ -61,37 +62,46 @@ module NanocConrefFS
|
|
61
62
|
|
62
63
|
# Given a category file that's an array, this method finds
|
63
64
|
# the children of an item, probably a map topic
|
65
|
+
#
|
66
|
+
# toc - the array containing the table of contents
|
67
|
+
# title - the text title to return the children of
|
68
|
+
#
|
69
|
+
# Returns a flattened array of all descendants which could be empty.
|
64
70
|
def find_array_children(toc, title)
|
65
|
-
children = ''
|
66
71
|
toc.each do |item|
|
67
72
|
next unless item.is_a?(Hash)
|
68
73
|
item.each_pair do |key, values|
|
69
74
|
if key == title
|
70
75
|
children = values.flatten
|
71
|
-
|
76
|
+
return children
|
72
77
|
end
|
73
78
|
end
|
74
|
-
break unless children.empty?
|
75
79
|
end
|
76
|
-
children
|
80
|
+
# Found no children
|
81
|
+
Array.new
|
77
82
|
end
|
78
83
|
module_function :find_array_children
|
79
84
|
|
80
85
|
# Given a category file that's a hash, this method finds
|
81
86
|
# the children of an item, probably a map topic
|
87
|
+
#
|
88
|
+
# toc - the hash containing the table of contents
|
89
|
+
# title - the text title to return the children of
|
90
|
+
#
|
91
|
+
# Returns a flattened array of all descendants which could be empty.
|
82
92
|
def find_hash_children(toc, title)
|
83
|
-
children = ''
|
84
93
|
toc.each_key do |key|
|
94
|
+
next if toc[key].nil?
|
85
95
|
toc[key].each do |item|
|
86
96
|
next unless item.is_a?(Hash)
|
87
|
-
|
97
|
+
if item[title]
|
88
98
|
children = item.values.flatten
|
89
|
-
|
99
|
+
return children
|
90
100
|
end
|
91
101
|
end
|
92
|
-
break unless children.empty?
|
93
102
|
end
|
94
|
-
children
|
103
|
+
# Found no children
|
104
|
+
Array.new
|
95
105
|
end
|
96
106
|
module_function :find_hash_children
|
97
107
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
require_relative 'conrefifier'
|
2
2
|
require 'active_support/core_ext/string'
|
3
3
|
|
4
|
-
class ConrefFS < Nanoc::
|
5
|
-
include Nanoc::DataSources::Filesystem
|
4
|
+
class ConrefFS < Nanoc::DataSources::Filesystem
|
6
5
|
include NanocConrefFS::Variables
|
7
6
|
include NanocConrefFS::Ancestry
|
8
7
|
|
@@ -70,12 +69,14 @@ class ConrefFS < Nanoc::DataSource
|
|
70
69
|
# out of the frontmatter—all of them dealing with collision between
|
71
70
|
# the { character in Liquid and its signfigance in YAML. We'll overload
|
72
71
|
# the parse method here to resolve those issues ahead of time.
|
73
|
-
def
|
72
|
+
def parse_with_frontmatter(content_filename)
|
74
73
|
# Read data
|
75
74
|
data = read(content_filename)
|
76
75
|
|
77
76
|
# Check presence of metadata section
|
78
|
-
|
77
|
+
if data !~ /\A-{3,5}\s*$/
|
78
|
+
return ParseResult.new(content: data, attributes: {}, attributes_data: '')
|
79
|
+
end
|
79
80
|
|
80
81
|
# Split data
|
81
82
|
pieces = data.split(/^(-{5}|-{3})[ \t]*\r?\n?/, 3)
|
@@ -98,7 +99,7 @@ class ConrefFS < Nanoc::DataSource
|
|
98
99
|
content = pieces[4]
|
99
100
|
|
100
101
|
# Done
|
101
|
-
|
102
|
+
ParseResult.new(content: content, attributes: meta, attributes_data: pieces[2])
|
102
103
|
end
|
103
104
|
|
104
105
|
def self.create_ignore_rules(rep, file)
|
@@ -147,29 +148,4 @@ class ConrefFS < Nanoc::DataSource
|
|
147
148
|
end
|
148
149
|
articles
|
149
150
|
end
|
150
|
-
|
151
|
-
# This method is extracted from the Nanoc default FS
|
152
|
-
def filename_for(base_filename, ext)
|
153
|
-
if ext.nil?
|
154
|
-
nil
|
155
|
-
elsif ext.empty?
|
156
|
-
base_filename
|
157
|
-
else
|
158
|
-
base_filename + '.' + ext
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
# This method is extracted from the Nanoc default FS
|
163
|
-
def identifier_for_filename(filename)
|
164
|
-
if config[:identifier_type] == 'full'
|
165
|
-
return Nanoc::Identifier.new(filename)
|
166
|
-
end
|
167
|
-
|
168
|
-
if filename =~ /(^|\/)index(\.[^\/]+)?$/
|
169
|
-
regex = @config && @config[:allow_periods_in_identifiers] ? /\/?(index)?(\.[^\/\.]+)?$/ : /\/?index(\.[^\/]+)?$/
|
170
|
-
else
|
171
|
-
regex = @config && @config[:allow_periods_in_identifiers] ? /\.[^\/\.]+$/ : /\.[^\/]+$/
|
172
|
-
end
|
173
|
-
Nanoc::Identifier.new(filename.sub(regex, ''), type: :legacy)
|
174
|
-
end
|
175
151
|
end
|
data/nanoc-conref-fs.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'nanoc-conref-fs'
|
6
|
-
spec.version = '0.6.
|
6
|
+
spec.version = '0.6.6'
|
7
7
|
spec.authors = ['Garen Torikian']
|
8
8
|
spec.email = ['gjtorikian@gmail.com']
|
9
9
|
spec.summary = 'A Nanoc filesystem to permit using conrefs/reusables in your content.'
|
@@ -15,9 +15,9 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test)/})
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.add_runtime_dependency 'nanoc', '~> 4.0'
|
18
|
+
spec.add_runtime_dependency 'nanoc', '~> 4.3.0'
|
19
19
|
spec.add_runtime_dependency 'activesupport', '~> 4.2'
|
20
|
-
spec.add_runtime_dependency 'liquid', '
|
20
|
+
spec.add_runtime_dependency 'liquid', '3.0.6'
|
21
21
|
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'minitest', '~> 5.8'
|
data/test/ancestry_test.rb
CHANGED
@@ -2,9 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class AncestryTest < MiniTest::Test
|
4
4
|
def test_it_renders_single_parents
|
5
|
-
with_site
|
6
|
-
|
7
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
5
|
+
with_site do |site|
|
8
6
|
site.compile
|
9
7
|
|
10
8
|
output_file = read_output_file('parents', 'single_parent')
|
@@ -14,9 +12,7 @@ class AncestryTest < MiniTest::Test
|
|
14
12
|
end
|
15
13
|
|
16
14
|
def test_it_renders_two_parents
|
17
|
-
with_site
|
18
|
-
|
19
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
15
|
+
with_site do |site|
|
20
16
|
site.compile
|
21
17
|
|
22
18
|
output_file = read_output_file('parents', 'two_parents')
|
@@ -26,9 +22,7 @@ class AncestryTest < MiniTest::Test
|
|
26
22
|
end
|
27
23
|
|
28
24
|
def test_it_renders_array_parents
|
29
|
-
with_site
|
30
|
-
|
31
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
25
|
+
with_site do |site|
|
32
26
|
site.compile
|
33
27
|
|
34
28
|
output_file = read_output_file('parents', 'array_parents')
|
@@ -38,9 +32,7 @@ class AncestryTest < MiniTest::Test
|
|
38
32
|
end
|
39
33
|
|
40
34
|
def test_missing_category_title_does_not_blow_up_parents
|
41
|
-
with_site
|
42
|
-
|
43
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
35
|
+
with_site do |site|
|
44
36
|
site.compile
|
45
37
|
|
46
38
|
output_file = read_output_file('parents', 'missing_title')
|
@@ -49,10 +41,18 @@ class AncestryTest < MiniTest::Test
|
|
49
41
|
end
|
50
42
|
end
|
51
43
|
|
52
|
-
def
|
53
|
-
with_site
|
44
|
+
def test_it_renders_content_with_no_children
|
45
|
+
with_site do |site|
|
46
|
+
site.compile
|
54
47
|
|
55
|
-
|
48
|
+
output_file = read_output_file('children', 'no_children')
|
49
|
+
test_file = read_test_file('children', 'no_children')
|
50
|
+
assert_equal output_file, test_file
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_it_renders_hash_children
|
55
|
+
with_site do |site|
|
56
56
|
site.compile
|
57
57
|
|
58
58
|
output_file = read_output_file('children', 'hash_children')
|
@@ -66,9 +66,7 @@ class AncestryTest < MiniTest::Test
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_it_renders_array_children
|
69
|
-
with_site
|
70
|
-
|
71
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
69
|
+
with_site do |site|
|
72
70
|
site.compile
|
73
71
|
|
74
72
|
output_file = read_output_file('children', 'array_children')
|
data/test/conref_fs_test.rb
CHANGED
@@ -3,9 +3,7 @@ require 'test_helper'
|
|
3
3
|
class DatafilesTest < MiniTest::Test
|
4
4
|
|
5
5
|
def test_it_renders_conrefs_in_frontmatter
|
6
|
-
with_site
|
7
|
-
|
8
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
6
|
+
with_site do |site|
|
9
7
|
site.compile
|
10
8
|
|
11
9
|
output_file = read_output_file('frontmatter', 'title')
|
@@ -15,9 +13,7 @@ class DatafilesTest < MiniTest::Test
|
|
15
13
|
end
|
16
14
|
|
17
15
|
def test_it_renders_conrefs_in_frontmatter_at_different_path
|
18
|
-
with_site
|
19
|
-
|
20
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
16
|
+
with_site do |site|
|
21
17
|
site.compile
|
22
18
|
|
23
19
|
output_file = read_output_file('frontmatter', 'different')
|
@@ -27,9 +23,7 @@ class DatafilesTest < MiniTest::Test
|
|
27
23
|
end
|
28
24
|
|
29
25
|
def test_it_renders_conrefs_in_frontmatter_with_audience
|
30
|
-
with_site
|
31
|
-
|
32
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
26
|
+
with_site do |site|
|
33
27
|
site.compile
|
34
28
|
|
35
29
|
output_file = read_output_file('frontmatter', 'audience')
|
@@ -39,9 +33,7 @@ class DatafilesTest < MiniTest::Test
|
|
39
33
|
end
|
40
34
|
|
41
35
|
def test_it_renders_nested_conrefs
|
42
|
-
with_site
|
43
|
-
|
44
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
36
|
+
with_site do |site|
|
45
37
|
site.compile
|
46
38
|
|
47
39
|
output_file = read_output_file('datafiles', 'deep')
|
@@ -51,9 +43,7 @@ class DatafilesTest < MiniTest::Test
|
|
51
43
|
end
|
52
44
|
|
53
45
|
def test_it_renders_nested_conrefs
|
54
|
-
with_site
|
55
|
-
|
56
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
46
|
+
with_site do |site|
|
57
47
|
site.compile
|
58
48
|
|
59
49
|
output_file = read_output_file('datafiles', 'deep')
|
@@ -63,9 +53,7 @@ class DatafilesTest < MiniTest::Test
|
|
63
53
|
end
|
64
54
|
|
65
55
|
def test_it_applies_any_attribute
|
66
|
-
with_site
|
67
|
-
|
68
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
56
|
+
with_site do |site|
|
69
57
|
site.compile
|
70
58
|
|
71
59
|
output_file = read_output_file('attributes', 'attribute')
|
@@ -75,9 +63,7 @@ class DatafilesTest < MiniTest::Test
|
|
75
63
|
end
|
76
64
|
|
77
65
|
def test_it_does_not_obfuscate_content
|
78
|
-
with_site
|
79
|
-
|
80
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
66
|
+
with_site do |site|
|
81
67
|
site.compile
|
82
68
|
|
83
69
|
output_file = read_output_file('obfuscation', 'admonitions')
|
@@ -91,9 +77,7 @@ class DatafilesTest < MiniTest::Test
|
|
91
77
|
end
|
92
78
|
|
93
79
|
def test_it_fetches_variables
|
94
|
-
with_site
|
95
|
-
|
96
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
80
|
+
with_site do |site|
|
97
81
|
site.compile
|
98
82
|
output_file = read_output_file('datafiles', 'retrieve')
|
99
83
|
test_file = read_test_file('datafiles', 'retrieve')
|
@@ -102,9 +86,7 @@ class DatafilesTest < MiniTest::Test
|
|
102
86
|
end
|
103
87
|
|
104
88
|
def test_it_ignores_unknown_tags
|
105
|
-
with_site
|
106
|
-
|
107
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
89
|
+
with_site do |site|
|
108
90
|
site.compile
|
109
91
|
|
110
92
|
output_file = read_output_file('maliciousness', 'unknown')
|
@@ -114,9 +96,7 @@ class DatafilesTest < MiniTest::Test
|
|
114
96
|
end
|
115
97
|
|
116
98
|
def test_it_works_if_an_asterisk_is_the_first_character
|
117
|
-
with_site
|
118
|
-
|
119
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
99
|
+
with_site do |site|
|
120
100
|
site.compile
|
121
101
|
|
122
102
|
output_file = read_output_file('maliciousness', 'asterisk_single')
|
@@ -126,9 +106,7 @@ class DatafilesTest < MiniTest::Test
|
|
126
106
|
end
|
127
107
|
|
128
108
|
def test_it_works_if_asterisks_are_the_first_two_characters
|
129
|
-
with_site
|
130
|
-
|
131
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
109
|
+
with_site do |site|
|
132
110
|
site.compile
|
133
111
|
|
134
112
|
output_file = read_output_file('maliciousness', 'asterisk_double')
|
@@ -138,9 +116,7 @@ class DatafilesTest < MiniTest::Test
|
|
138
116
|
end
|
139
117
|
|
140
118
|
def test_raw_tags
|
141
|
-
with_site
|
142
|
-
|
143
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
119
|
+
with_site do |site|
|
144
120
|
site.compile
|
145
121
|
|
146
122
|
output_file = read_output_file('liquid', 'raw')
|
@@ -151,9 +127,7 @@ class DatafilesTest < MiniTest::Test
|
|
151
127
|
end
|
152
128
|
|
153
129
|
def test_multiple_version_blocks
|
154
|
-
with_site
|
155
|
-
|
156
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
130
|
+
with_site do |site|
|
157
131
|
site.compile
|
158
132
|
|
159
133
|
output_file = read_output_file('liquid', 'multiple_versions')
|
@@ -164,9 +138,7 @@ class DatafilesTest < MiniTest::Test
|
|
164
138
|
end
|
165
139
|
|
166
140
|
def test_multiple_outputs
|
167
|
-
with_site
|
168
|
-
|
169
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
141
|
+
with_site do |site|
|
170
142
|
site.compile
|
171
143
|
|
172
144
|
single_var_github = read_output_file('multiple', 'single_var')
|
data/test/datafiles_test.rb
CHANGED
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
3
3
|
class DatafilesTest < MiniTest::Test
|
4
4
|
def test_it_collects_the_files
|
5
5
|
files = NanocConrefFS::Datafiles.collect_data(File.join(FIXTURES_DIR, 'data')).keys.sort
|
6
|
-
names = %w(categories/category categories/nested categories/simple reusables/intro reusables/names variables/asterisks variables/empty variables/product)
|
6
|
+
names = %w(categories/category categories/empty_category categories/nested categories/simple reusables/intro reusables/names variables/asterisks variables/empty variables/product)
|
7
7
|
names.map! { |name| File.join(FIXTURES_DIR, 'data', "#{name}.yml") }
|
8
8
|
assert_equal files, names
|
9
9
|
end
|
data/test/fixtures/nanoc.yaml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
data_variables:
|
3
2
|
-
|
4
3
|
scope:
|
@@ -38,6 +37,13 @@ page_variables:
|
|
38
37
|
path: "different"
|
39
38
|
values:
|
40
39
|
version: "2.0"
|
40
|
+
-
|
41
|
+
scope:
|
42
|
+
path: "empty-categories"
|
43
|
+
values:
|
44
|
+
version: "dotcom"
|
45
|
+
data_association: "categories.empty_category"
|
46
|
+
just_a_key: wow!
|
41
47
|
-
|
42
48
|
scope:
|
43
49
|
path: "multiple_versions"
|
data/test/test_helper.rb
CHANGED
@@ -21,61 +21,9 @@ def read_test_file(dir, name)
|
|
21
21
|
File.read(File.join(FIXTURES_DIR, 'content', dir, "#{name}.html")).gsub(/^\s*$/, '')
|
22
22
|
end
|
23
23
|
|
24
|
-
def with_site
|
25
|
-
# Build site name
|
26
|
-
site_name = params[:name]
|
27
|
-
if site_name.nil?
|
28
|
-
@site_num ||= 0
|
29
|
-
site_name = "site-#{@site_num}"
|
30
|
-
@site_num += 1
|
31
|
-
end
|
32
|
-
|
33
|
-
# Build rules
|
34
|
-
rules_content = <<EOS
|
35
|
-
compile '*' do
|
36
|
-
{{compilation_rule_content}}
|
37
|
-
end
|
38
|
-
|
39
|
-
route '*' do
|
40
|
-
if item.binary?
|
41
|
-
item.identifier.chop + (item[:extension] ? '.' + item[:extension] : '')
|
42
|
-
else
|
43
|
-
item.identifier + 'index.html'
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
layout '*', :erb
|
48
|
-
EOS
|
49
|
-
rules_content.gsub!('{{compilation_rule_content}}', params[:compilation_rule_content] || '')
|
50
|
-
|
51
|
-
# Create site
|
52
|
-
unless File.directory?(site_name)
|
53
|
-
FileUtils.mkdir_p(site_name)
|
54
|
-
FileUtils.cd(site_name) do
|
55
|
-
FileUtils.mkdir_p('content')
|
56
|
-
FileUtils.mkdir_p('layouts')
|
57
|
-
FileUtils.mkdir_p('lib')
|
58
|
-
FileUtils.mkdir_p('output')
|
59
|
-
|
60
|
-
if params[:has_layout]
|
61
|
-
File.open('layouts/default.html', 'w') do |io|
|
62
|
-
io.write('... <%= @yield %> ...')
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
File.open('nanoc.yaml', 'w') do |io|
|
67
|
-
io << 'string_pattern_type: legacy' << "\n"
|
68
|
-
io << 'data_sources:' << "\n"
|
69
|
-
io << ' -' << "\n"
|
70
|
-
io << ' type: filesystem' << "\n"
|
71
|
-
io << ' identifier_type: legacy' << "\n"
|
72
|
-
end
|
73
|
-
File.open('Rules', 'w') { |io| io.write(rules_content) }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
24
|
+
def with_site
|
77
25
|
# Yield site
|
78
|
-
FileUtils.cd(
|
26
|
+
FileUtils.cd(FIXTURES_DIR) do
|
79
27
|
yield Nanoc::Int::SiteLoader.new.new_from_cwd
|
80
28
|
end
|
81
29
|
end
|
data/test/variable_mixin_test.rb
CHANGED
@@ -3,18 +3,16 @@ require 'test_helper'
|
|
3
3
|
class VariablesTest < MiniTest::Test
|
4
4
|
|
5
5
|
def test_it_fetches_variables
|
6
|
-
with_site
|
7
|
-
|
8
|
-
site = Nanoc::Int::SiteLoader.new.new_from_cwd
|
6
|
+
with_site do |site|
|
9
7
|
site.compile
|
10
8
|
|
11
9
|
assert_equal NanocConrefFS::Variables.variables[:default].keys, ['site']
|
12
|
-
assert_equal NanocConrefFS::Variables.variables[:default]['site']['data'].keys, %w(categories reusables variables)
|
10
|
+
assert_equal NanocConrefFS::Variables.variables[:default]['site']['data'].keys.sort, %w(categories reusables variables)
|
13
11
|
end
|
14
12
|
end
|
15
13
|
|
16
14
|
def test_it_fetches_datafiles
|
17
|
-
with_site
|
15
|
+
with_site do
|
18
16
|
file = NanocConrefFS::Variables.fetch_data_file('reusables.intro', :default)
|
19
17
|
assert_equal file['frontmatter_intro'], 'Here I am, in the front.'
|
20
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nanoc-conref-fs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nanoc
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: liquid
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.0.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.0.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,10 +128,13 @@ files:
|
|
128
128
|
- test/fixtures/content/children/hash_children.md
|
129
129
|
- test/fixtures/content/children/later_hash_children.html
|
130
130
|
- test/fixtures/content/children/later_hash_children.md
|
131
|
+
- test/fixtures/content/children/no_children.html
|
132
|
+
- test/fixtures/content/children/no_children.md
|
131
133
|
- test/fixtures/content/datafiles/deep.html
|
132
134
|
- test/fixtures/content/datafiles/deep.md
|
133
135
|
- test/fixtures/content/datafiles/retrieve.html
|
134
136
|
- test/fixtures/content/datafiles/retrieve.md
|
137
|
+
- test/fixtures/content/empty-categories/content-article.md
|
135
138
|
- test/fixtures/content/frontmatter/audience.html
|
136
139
|
- test/fixtures/content/frontmatter/audience.md
|
137
140
|
- test/fixtures/content/frontmatter/different.html
|
@@ -164,6 +167,7 @@ files:
|
|
164
167
|
- test/fixtures/content/parents/two_parents.html
|
165
168
|
- test/fixtures/content/parents/two_parents.md
|
166
169
|
- test/fixtures/data/categories/category.yml
|
170
|
+
- test/fixtures/data/categories/empty_category.yml
|
167
171
|
- test/fixtures/data/categories/nested.yml
|
168
172
|
- test/fixtures/data/categories/simple.yml
|
169
173
|
- test/fixtures/data/reusables/intro.yml
|
@@ -215,10 +219,13 @@ test_files:
|
|
215
219
|
- test/fixtures/content/children/hash_children.md
|
216
220
|
- test/fixtures/content/children/later_hash_children.html
|
217
221
|
- test/fixtures/content/children/later_hash_children.md
|
222
|
+
- test/fixtures/content/children/no_children.html
|
223
|
+
- test/fixtures/content/children/no_children.md
|
218
224
|
- test/fixtures/content/datafiles/deep.html
|
219
225
|
- test/fixtures/content/datafiles/deep.md
|
220
226
|
- test/fixtures/content/datafiles/retrieve.html
|
221
227
|
- test/fixtures/content/datafiles/retrieve.md
|
228
|
+
- test/fixtures/content/empty-categories/content-article.md
|
222
229
|
- test/fixtures/content/frontmatter/audience.html
|
223
230
|
- test/fixtures/content/frontmatter/audience.md
|
224
231
|
- test/fixtures/content/frontmatter/different.html
|
@@ -251,6 +258,7 @@ test_files:
|
|
251
258
|
- test/fixtures/content/parents/two_parents.html
|
252
259
|
- test/fixtures/content/parents/two_parents.md
|
253
260
|
- test/fixtures/data/categories/category.yml
|
261
|
+
- test/fixtures/data/categories/empty_category.yml
|
254
262
|
- test/fixtures/data/categories/nested.yml
|
255
263
|
- test/fixtures/data/categories/simple.yml
|
256
264
|
- test/fixtures/data/reusables/intro.yml
|