jekyll-attendease 0.6.45 → 0.7.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17a3acfc44d5f6ca453f5c38edb2c021f46d259a
|
4
|
+
data.tar.gz: 85e1d731ae51972ccf2d716071e7e6a73dc3faa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6faf7b73b379bcbe4b42c6f115219fe2689a051d4278635cddb2cec72b3c8490f4ab4457e3cab29b5c996710717a3217c7fb0acad63c4fc44a8e2bba1180fd76
|
7
|
+
data.tar.gz: 42906b97c1a4b53ff7eec8ab82456537f69517fc39e2df659a10e863e73bb7ede341746a2088709dbbedcd3bc5421616df794a47e83201cd58280935f7ca0107
|
@@ -15,8 +15,6 @@ module Jekyll
|
|
15
15
|
page['name'] = CGI.escapeHTML(page['name']) if page['name']
|
16
16
|
site.pages << SitePage.new(site, site.source, page)
|
17
17
|
|
18
|
-
next if site.config.attendease['private_site']
|
19
|
-
|
20
18
|
zones = {}
|
21
19
|
keys = [ 'content', 'preferences' ]
|
22
20
|
|
@@ -47,12 +45,14 @@ module Jekyll
|
|
47
45
|
page_source_path = File.join(site.source, page['slug'])
|
48
46
|
FileUtils.mkdir_p(page_source_path) unless File.exists?(page_source_path)
|
49
47
|
|
50
|
-
|
48
|
+
json_filename = site.config.attendease['private_site'] ? 'index-private.json' : 'index.json'
|
49
|
+
|
50
|
+
File.open(File.join(page_source_path, json_filename), 'w') do |f|
|
51
51
|
f.write zones.to_json
|
52
52
|
f.close
|
53
53
|
end
|
54
54
|
|
55
|
-
site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']),
|
55
|
+
site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -33,12 +33,60 @@ RSpec.describe Jekyll::AttendeasePlugin::SitePagesGenerator do
|
|
33
33
|
expect(File.file?(file)).to eq(true)
|
34
34
|
expect(File.read(file)).to include '<title>Agenda <script>alert()</script></title>'
|
35
35
|
end
|
36
|
-
|
37
36
|
end
|
38
37
|
|
39
38
|
context 'external page' do
|
39
|
+
before do
|
40
|
+
expect(external_page).not_to be_nil
|
41
|
+
expect(external_page['external']).to eq(true)
|
42
|
+
end
|
43
|
+
|
44
|
+
let(:home_page) do
|
45
|
+
site.data['pages'].detect { |page| page['name'] == 'Home' }
|
46
|
+
end
|
47
|
+
|
40
48
|
it 'does not create a page using the provided slug' do
|
49
|
+
external_page_slug = external_page['slug']
|
50
|
+
expect(external_page_slug).to eq("")
|
41
51
|
|
52
|
+
home_page_slug = home_page['slug']
|
53
|
+
expect(home_page_slug).to eq(external_page_slug)
|
54
|
+
|
55
|
+
file = File.join(site.config['destination'], external_page_slug, 'index.html')
|
56
|
+
|
57
|
+
#
|
58
|
+
# file exists but it's for the Home page:
|
59
|
+
#
|
60
|
+
expect(File.exists?(file)).to eq(true)
|
61
|
+
expect(File.read(file)).to include("<title>#{home_page['name']}</title>")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'when site is a private site' do
|
66
|
+
let(:site) do
|
67
|
+
build_site({ 'attendease' => { 'private_site' => true }})
|
68
|
+
end
|
69
|
+
|
70
|
+
before do
|
71
|
+
expect(site.config.attendease['private_site']).to eq(true)
|
72
|
+
end
|
73
|
+
|
74
|
+
context 'regular page' do
|
75
|
+
it 'creates a page using the provided slug' do
|
76
|
+
slug = page['slug']
|
77
|
+
file = File.join(site.config['destination'], slug, 'index.html')
|
78
|
+
expect(File.exists?(file)).to eq(true)
|
79
|
+
expect(File.file?(file)).to eq(true)
|
80
|
+
expect(File.read(file)).to include '<title>Test Page</title>'
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'creates a block instance private json file using the provided slug' do
|
84
|
+
slug = page['slug']
|
85
|
+
file = File.join(site.config['destination'], slug, 'index-private.json')
|
86
|
+
expect(File.exists?(file)).to eq(true)
|
87
|
+
expect(File.file?(file)).to eq(true)
|
88
|
+
end
|
42
89
|
end
|
43
90
|
end
|
44
91
|
end
|
92
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -119,6 +119,15 @@ RSpec.configure do |config|
|
|
119
119
|
FileUtils.rm_r Pathname.new(i).parent
|
120
120
|
end
|
121
121
|
end
|
122
|
+
|
123
|
+
Dir.glob(File.join(@site.source, '**', 'index-private.json')).map do |i|
|
124
|
+
if (Pathname.new(i).parent == fixtures_path)
|
125
|
+
FileUtils.rm i
|
126
|
+
else
|
127
|
+
FileUtils.rm_r Pathname.new(i).parent
|
128
|
+
end
|
129
|
+
end
|
122
130
|
end
|
123
131
|
end
|
124
132
|
end
|
133
|
+
|