jekyll-attendease 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +73 -0
  2. data/lib/jekyll-attendease.rb +56 -0
  3. metadata +78 -0
data/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Jekyll::Attendease
2
+
3
+ A Jekyll plugin, brings in data from your Attendease event and allows you to use it in your Jekyll templates for awesome event websites.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'jekyll-attendease'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install jekyll-attendease
18
+
19
+
20
+ Next, make sure to require it. Common practice is to add following line
21
+ into `_plugins/ext.rb` file:
22
+
23
+ ``` ruby
24
+ require "jekyll-attendease"
25
+ ```
26
+
27
+ ## Configuration
28
+
29
+ You will need to configure by editing your `_config.yml`:
30
+
31
+ ``` yaml
32
+ #
33
+ # Plugin: jekyll-attendease
34
+ #
35
+ attendease:
36
+ api_host: https://your-event-subdomain.attendease.com/
37
+ ```
38
+
39
+ Remember to replace `https://your-event-subdomain.attendease.com/` with your actual event url, or crazy things will happen!
40
+
41
+
42
+ ## Contributing
43
+
44
+ 1. Fork it
45
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
46
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
47
+ 4. Push to the branch (`git push origin my-new-feature`)
48
+ 5. Create new Pull Request
49
+
50
+
51
+ ## License
52
+
53
+ Copyright (C) 2013 Attendease (https://attendease.com/)
54
+
55
+ The MIT License
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
58
+ this software and associated documentation files (the “Software”), to deal in
59
+ the Software without restriction, including without limitation the rights to
60
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
61
+ of the Software, and to permit persons to whom the Software is furnished to do
62
+ so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
@@ -0,0 +1,56 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module Jekyll
5
+ module Attendease
6
+
7
+ class EventData < Generator
8
+ def generate(site)
9
+ if attendease_config = site.config['attendease']
10
+
11
+ if attendease_config['api_host'] && !attendease_config['api_host'].match(/^http/)
12
+ raise "Is your Attendease api_host site properly in _config.yml? Needs to be something like https://myevent.attendease.com/"
13
+ else
14
+ attendease_data_path = File.expand_path("../../_attendease_data", __FILE__)
15
+ FileUtils.mkdir_p(attendease_data_path)
16
+
17
+ update_data = true
18
+
19
+ if File.exists?("#{attendease_data_path}/site.json")
20
+ if (Time.now.to_i - File.mtime("#{attendease_data_path}/site.json").to_i) <= 30 # file is less than 30 seconds old
21
+ update_data = false
22
+
23
+ site_json = File.read("#{attendease_data_path}/site.json")
24
+
25
+ event_data = JSON.parse(site_json)
26
+ end
27
+ end
28
+
29
+ if update_data
30
+ event_data = HTTParty.get("#{attendease_config['api_host']}api/site.json")
31
+
32
+ if !event_data['error']
33
+ puts "Saving attendease event data..."
34
+
35
+ File.open("#{attendease_data_path}/site.json", 'w+') { |file| file.write(event_data.parsed_response.to_json) }
36
+ else
37
+ raise "Event data not found, is your Attendease api_host site properly in _config.yml?"
38
+ end
39
+ end
40
+
41
+ # Adding to site config so we can access these variables globally wihtout using a Liquid Tag so we can use if/else
42
+ site.config['attendease']['data'] = {}
43
+
44
+ event_data.keys.each do |tag|
45
+ site.config['attendease']['data'][tag] = event_data[tag]
46
+ end
47
+ end
48
+
49
+ else
50
+ raise "Please set the Attendease config in your _config.yml"
51
+ end
52
+ end
53
+ end
54
+
55
+ end
56
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-attendease
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Michael Wood
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ none: false
21
+ name: httparty
22
+ type: :runtime
23
+ prerelease: false
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ! '>='
27
+ - !ruby/object:Gem::Version
28
+ version: '0'
29
+ none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ none: false
37
+ name: json
38
+ type: :runtime
39
+ prerelease: false
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ none: false
46
+ description: Bring your event data into Jekyll for amazing event websites.
47
+ email: support@attendease.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - README.md
53
+ - lib/jekyll-attendease.rb
54
+ homepage: https://attendease.com/
55
+ licenses: []
56
+ post_install_message:
57
+ rdoc_options: []
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ none: false
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ none: false
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.23
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: Attendease event helper for Jekyll!
78
+ test_files: []