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: 6b9d93efe01b2b78b08cfd8b4fd48c45a665dbb7
4
- data.tar.gz: fcfbabad11ab20553b5f3f9815c16279b9c43157
3
+ metadata.gz: 17a3acfc44d5f6ca453f5c38edb2c021f46d259a
4
+ data.tar.gz: 85e1d731ae51972ccf2d716071e7e6a73dc3faa3
5
5
  SHA512:
6
- metadata.gz: 675651dad7155a597f5de575c6d75bda2609ca0890e62cb3bfc046844151d632fd62e6730fec7e922c7388b7202e21711e9975cf1b1797abcefc6db280923258
7
- data.tar.gz: 83ca4a1aecaf0a40f51dafed554425d0b467f39523e9f5abe3280ac0c2de1f05c2dde989385cacf70a3103c970b8c5ef98779eee08e6443575522b3f8f4f868a
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
- File.open(File.join(page_source_path, 'index.json'), 'w') do |f|
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']), 'index.json')
55
+ site.static_files << StaticFile.new(site, site.source, File.join('', page['slug']), json_filename)
56
56
  end
57
57
  end
58
58
  end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.6.45'
3
+ VERSION = '0.7.0'
4
4
  end
5
5
  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 &lt;script&gt;alert()&lt;/script&gt;</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
+
@@ -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
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-attendease
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.45
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood