jekyll-attendease 0.9.3 → 0.9.4a

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f34a3a54e23f0d3b76b52f58ab12428d001bb44f
4
- data.tar.gz: 7ccb50dc81a6afa20724df44d60fdf2481603a66
3
+ metadata.gz: d562d2bfff2850adba28a3405afb4e4195959e1f
4
+ data.tar.gz: a433801b7b9dfad45f8f337f7ebf57a93b79633c
5
5
  SHA512:
6
- metadata.gz: e2eafd219f7d4901da9cc9da5927385ee45ae83a298c920fb3b07285f5247d086e4ff5ae51e96e9c0b656bf2a53be4985a0ff3da5586a32b9679c450f474979e
7
- data.tar.gz: 34457707f96c7b80acab36729f5ffc9a0b8b6203a16e4cf0cf5ba13e05aa539bb31c64136e92ee74650ad27eb583187cb6d57883bbe19c6feb852b057242e4df
6
+ metadata.gz: ca8a2cf0d4708f64c1410a8a15cc2d34d8c6a2fb760f436a7b83a26ed44928d22b9f9c05cd0a7d7d042b0f7803e995a36260afaba9c56f7dd3f4e9e079210a71
7
+ data.tar.gz: 31ab70fb6ee0f06e53dab866c6ba00e01a5ee519d202f037b0281cca065ebfd0711bec25c9fa525fe8e00118e346394e40ea4add8462c11625719bb80cf6eb31
@@ -45,6 +45,8 @@ Jekyll::Hooks.register :site, :after_reset do |site|
45
45
 
46
46
  site.config['attendease'] = site.config['attendease'].nil? ? default : Jekyll::Utils.deep_merge_hashes(default['attendease'], site.config['attendease'])
47
47
 
48
+ site.config['attendease_source'] ||= site.config['source']
49
+
48
50
  site.config.extend(AttendeaseJekyllConfigMixin)
49
51
 
50
52
  if site.config.attendease['api_host'].nil?
@@ -55,11 +57,11 @@ end
55
57
  Jekyll::Hooks.register :site, :post_write do |site|
56
58
  if pages = site.data['pages']
57
59
  pages.each do |page|
58
- if File.exists?(file = File.join(site.config['source'], page['slug'], 'index.html'))
60
+ if File.exists?(file = File.join(site.config['attendease_source'], page['slug'], 'index.html'))
59
61
  File.unlink(file)
60
62
  end
61
63
 
62
- if File.exists?(file = File.join(site.config['source'], page['slug'], 'index.json'))
64
+ if File.exists?(file = File.join(site.config['attendease_source'], page['slug'], 'index.json'))
63
65
  File.unlink(file)
64
66
  end
65
67
  end
@@ -14,4 +14,8 @@ module AttendeaseJekyllConfigMixin
14
14
  def cms_theme?
15
15
  attendease['jekyll33'] == true
16
16
  end
17
+
18
+ def live_mode?
19
+ !!attendease['live_mode']
20
+ end
17
21
  end
@@ -29,14 +29,14 @@ module Jekyll
29
29
  site.config.attendease['api_host'] += '/'
30
30
  end
31
31
 
32
- @attendease_data_path = File.join(site.source, '_attendease', 'data')
32
+ @attendease_data_path = File.join(site.config['attendease_source'], '_attendease', 'data')
33
33
 
34
34
  FileUtils.mkdir_p(@attendease_data_path)
35
35
 
36
36
  if site.config.cms_theme?
37
- data_files = %w[ site event pages portal_pages site_settings organization_site_settings mappable ].map { |m| "#{m}.json"} << 'lingo.yml'
37
+ data_files = %w[site event pages portal_pages site_settings organization_site_settings mappable].map { |m| "#{m}.json"} << 'lingo.yml'
38
38
  else
39
- data_files = %w[ site event sessions presenters rooms filters venues sponsors pages site_settings mappable ].map { |m| "#{m}.json"} << 'lingo.yml'
39
+ data_files = %w[site event sessions presenters rooms filters venues sponsors pages site_settings].map { |m| "#{m}.json"} << 'lingo.yml'
40
40
  end
41
41
 
42
42
  # no more site in nextgen themes
@@ -47,6 +47,7 @@ module Jekyll
47
47
  data = nil
48
48
 
49
49
  file = File.join(@attendease_data_path, filename)
50
+
50
51
  if File.exists?(file) && use_cache?(site, file)
51
52
  update_data = false
52
53
 
@@ -16,21 +16,8 @@ module Jekyll
16
16
  def generate(site)
17
17
  Jekyll.logger.debug "[Attendease] Generating theme layouts..."
18
18
 
19
- attendease_precompiled_theme_layouts_path = File.join(site.source, 'attendease_layouts') # These are compiled to the html site.
20
- attendease_precompiled_theme_email_layouts_path = File.join(site.source, 'attendease_layouts', 'emails') # These are compiled for email.
21
19
  layouts_path = File.join(site.source, '_layouts')
22
20
 
23
- FileUtils.mkdir_p(attendease_precompiled_theme_layouts_path)
24
-
25
- # Precompiled layouts for attendease app and jekyll generated pages.
26
- base_layout = site.config['attendease']['base_layout'] || 'layout'
27
-
28
- base_layout_file = File.join(layouts_path, "#{base_layout}.html")
29
- unless File.exists?(base_layout_file)
30
- # Generate an extremely simple base layout if it does not exist.
31
- File.open(base_layout_file, 'w+') { |f| f.write("{{ content }}") }
32
- end
33
-
34
21
  cms_layouts = []
35
22
  begin
36
23
  Dir.glob(File.join(layouts_path, '*.html')).each do |l|
@@ -45,6 +32,26 @@ module Jekyll
45
32
  rescue
46
33
  end
47
34
 
35
+ cms_layouts.each do |layout|
36
+ site.pages << EventLayoutPage.new(site, site.source, 'attendease_layouts', "cms-#{layout}.html", layout, layout.capitalize)
37
+ end
38
+
39
+ return unless site.config.live_mode?
40
+
41
+ attendease_precompiled_theme_layouts_path = File.join(site.source, 'attendease_layouts') # These are compiled to the html site.
42
+ attendease_precompiled_theme_email_layouts_path = File.join(site.source, 'attendease_layouts', 'emails') # These are compiled for email.
43
+
44
+ FileUtils.mkdir_p(attendease_precompiled_theme_layouts_path)
45
+
46
+ # Precompiled layouts for attendease app and jekyll generated pages.
47
+ base_layout = site.config['attendease']['base_layout'] || 'layout'
48
+
49
+ base_layout_file = File.join(layouts_path, "#{base_layout}.html")
50
+ unless File.exists?(base_layout_file)
51
+ # Generate an extremely simple base layout if it does not exist.
52
+ File.open(base_layout_file, 'w+') { |f| f.write("{{ content }}") }
53
+ end
54
+
48
55
  layouts_to_precompile = %w{ layout register surveys } # These are compiled to the html site.
49
56
  layouts_to_precompile.each do |layout|
50
57
  # create a layout file if it already doesn't exist.
@@ -56,10 +63,6 @@ module Jekyll
56
63
  end
57
64
  end
58
65
 
59
- cms_layouts.each do |layout|
60
- site.pages << EventLayoutPage.new(site, site.source, 'attendease_layouts', "cms-#{layout}.html", layout, layout.capitalize)
61
- end
62
-
63
66
  # Precompiled layouts for attendease email
64
67
  base_email_layout = site.config['attendease']['base_email_layout'] || 'email'
65
68
  base_email_layout_file = File.join(layouts_path, "#{base_email_layout}.html")
@@ -22,6 +22,7 @@ module Jekyll
22
22
  priority :high
23
23
 
24
24
  def generate(site)
25
+ return false if site.config.cms_theme?
25
26
  Jekyll.logger.info "[Attendease] Generating theme templates..."
26
27
 
27
28
  # Generate the template files if they don't yet exist.
@@ -79,7 +79,7 @@ module Jekyll
79
79
  end
80
80
 
81
81
  def data_path
82
- File.join(site.config['source'], '_attendease', 'data')
82
+ File.join(site.config['attendease_source'], '_attendease', 'data')
83
83
  end
84
84
 
85
85
  def populate_sessions_with_related_data!(sessions)
@@ -3,7 +3,7 @@ module Jekyll
3
3
  class ScheduleWidgetTag < Liquid::Tag
4
4
  def render(context)
5
5
  schedule_data = ScheduleDataParser.new(context.registers[:site])
6
- base = File.join(context.registers[:site].config['source'])
6
+ base = File.join(context.registers[:site].config['attendease_source'])
7
7
 
8
8
  instances = schedule_data.sessions.inject([]) do |memo, s|
9
9
  s['instances'].each do |instance|
@@ -63,7 +63,7 @@ module Jekyll
63
63
  def render(context)
64
64
  I18n::Backend::Simple.include(I18n::Backend::Pluralization)
65
65
  I18n.enforce_available_locales = false
66
- i18n_path = File.join(context.registers[:site].config['source'], '_attendease', 'data', 'lingo.yml')
66
+ i18n_path = File.join(context.registers[:site].config['attendease_source'], '_attendease', 'data', 'lingo.yml')
67
67
  I18n.load_path << i18n_path unless I18n.load_path.include?(i18n_path)
68
68
  I18n.locale = context.registers[:page]['lang'] || context.registers[:site].config['attendease']['locale'] || context.registers[:site].config['attendease']['lang'] || :en
69
69
  I18n.t(@key, :count => @options['t_size'])
@@ -1,6 +1,6 @@
1
1
  module Jekyll
2
2
  module AttendeasePlugin
3
- VERSION = '0.9.3'
3
+ VERSION = '0.9.4a'
4
4
  end
5
5
  end
6
6
 
@@ -1,33 +1,27 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Jekyll::AttendeasePlugin::EventTemplateGenerator do
4
- context 'event site' do
4
+ context 'legacy event site' do
5
5
  let(:site) { build_site }
6
6
 
7
7
  it 'creates the Attendease template files' do
8
8
  template_files = Dir.chdir(File.join(@template_root, 'attendease')) { Dir.glob('**/**.html') }
9
9
 
10
10
  template_files.each do |template_file|
11
- path = File.join(site.config['source'], '_attendease', 'templates', template_file)
11
+ path = File.join(site.config['attendease_source'], '_attendease', 'templates', template_file)
12
12
 
13
+ puts path
13
14
  expect(File.exists?(path)).to eq(true)
14
15
  expect(File.size(path)).to be > 0
15
16
  end
16
17
  end
17
18
  end
18
19
 
19
- context 'organization site' do
20
- let(:site) { build_org_site }
20
+ context 'CMS site' do
21
+ let(:site) { build_cms_site }
21
22
 
22
- it 'creates the Attendease template files' do
23
- template_files = Dir.chdir(File.join(@template_root, 'attendease')) { Dir.glob('**/**.html') }
24
-
25
- template_files.each do |template_file|
26
- path = File.join(site.config['source'], '_attendease', 'templates', template_file)
27
-
28
- expect(File.exists?(path)).to eq(true)
29
- expect(File.size(path)).to be > 0
30
- end
23
+ it 'skips creating the Attendease template files' do
24
+ expect(Pathname.new(site.config['attendease_source']).join('templates').exist?).to eq(false)
31
25
  end
32
26
  end
33
27
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Jekyll::AttendeasePlugin::SitePagesGenerator do
4
- let(:site) { build_site }
4
+ let(:site) { build_cms_site }
5
5
  let(:site_pages_generator) { find_generator(site, described_class) }
6
6
  let(:index_file) { 'index.html' }
7
7
  let(:page) { site.data['pages'].detect { |p| p['slug'] == 'test' } }
@@ -85,6 +85,7 @@ RSpec.configure do |config|
85
85
  'has_venues' => true,
86
86
  'has_mappable' => true,
87
87
  'environment' => 'test',
88
+ 'live_mode' => true,
88
89
  'locale' => 'en',
89
90
  'source_id' => 'foobar',
90
91
  'auth_host' => 'https://foobar.auth/',
@@ -106,6 +107,10 @@ RSpec.configure do |config|
106
107
  @site
107
108
  end
108
109
 
110
+ def build_cms_site
111
+ build_site({ 'attendease' => { 'jekyll33' => true } })
112
+ end
113
+
109
114
  def build_org_site
110
115
  build_site({ 'attendease' => { 'mode' => 'organization', 'jekyll33' => true } })
111
116
  end
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.9.3
4
+ version: 0.9.4a
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Wood
@@ -234,9 +234,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  requirements:
237
- - - ">="
237
+ - - ">"
238
238
  - !ruby/object:Gem::Version
239
- version: '0'
239
+ version: 1.3.1
240
240
  requirements: []
241
241
  rubyforge_project:
242
242
  rubygems_version: 2.6.14.4