jekyll-discourse-comments 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f1fd3b48614c88e04c35610ba491fc331cef0980
4
+ data.tar.gz: d42dd35b5a88e6f6495e0bcf0d2b19691ed6dc70
5
+ SHA512:
6
+ metadata.gz: 15999d44d23f1140801911e97b7fdaf1b236ddaaecaedb8b51db4023f3ab996d672c92c0c8685034ee638bd1c3cdcef28a8b8c780e3b4a5c195b63056deee47d
7
+ data.tar.gz: 93e4101e93ca074f4a55c1374f7955faf2bd8958c227023cf899a6375530d1cac04adf613245c9ccd0de24a95f503a6ba8f6bfeab79e425b529620efbea72cfc
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in jekyll-discourse-comments.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Blake Erickson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,13 @@
1
+ jekyll-discourse-comments
2
+ =========================
3
+
4
+ A Jekyll plugin for adding Discourse comments to your posts.
5
+
6
+ ## Instructions
7
+
8
+ Inside of your Jekyll `_config.yml` file add these two lines:
9
+
10
+ gems: [jekyll-discourse-comments]
11
+ discourse_url: "http://discourse.yoursite.com"
12
+
13
+ You also will need to have a [Discourse site](http://eviltrout.com/2014/01/22/embedding-discourse.html) setup.
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/discourse/comments/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "jekyll-discourse-comments"
8
+ spec.version = Jekyll::Discourse::Comments::VERSION
9
+ spec.authors = ["Blake Erickson"]
10
+ spec.email = ["o.blakeerickson@gmail.com"]
11
+ spec.summary = "A Jekyll plugin for adding Discourse comments"
12
+ spec.description = "A Jekyll plugin for adding Discourse comments to the bottom of each post"
13
+ spec.homepage = "https://github.com/oblakeerickson/jekyll-discourse-comments"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
@@ -0,0 +1,3 @@
1
+ require "jekyll/discourse/comments/version"
2
+ require "jekyll/discourse/comments/comments"
3
+ require "jekyll/discourse/comments/unindent"
@@ -0,0 +1,39 @@
1
+ module Jekyll
2
+ module Discourse
3
+ module Comments
4
+
5
+ class Comments < Generator
6
+
7
+ def generate(site)
8
+ @site = site
9
+
10
+ process_posts
11
+ end
12
+
13
+ def process_posts
14
+ @site.posts.each do |post|
15
+ post.content += snippet(post.url)
16
+ end
17
+ end
18
+
19
+ def snippet(url)
20
+ <<-EOF.unindent
21
+ <div id="discourse-comments"></div>
22
+
23
+ <script type="text/javascript">
24
+ var discourseUrl = "#{@site.config['discourse_url']}",
25
+ discourseEmbedUrl = "#{@site.config['url'] + @site.config['baseurl'] + url}";
26
+
27
+ (function() {
28
+ var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
29
+ d.src = discourseUrl + 'javascripts/embed.js';
30
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
31
+ })();
32
+ </script>
33
+ EOF
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,5 @@
1
+ class String
2
+ def unindent
3
+ gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "")
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ module Jekyll
2
+ module Discourse
3
+ module Comments
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-discourse-comments
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Blake Erickson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: A Jekyll plugin for adding Discourse comments to the bottom of each post
42
+ email:
43
+ - o.blakeerickson@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE
51
+ - README.md
52
+ - Rakefile
53
+ - jekyll-discourse-comments.gemspec
54
+ - lib/jekyll/discourse/comments.rb
55
+ - lib/jekyll/discourse/comments/comments.rb
56
+ - lib/jekyll/discourse/comments/unindent.rb
57
+ - lib/jekyll/discourse/comments/version.rb
58
+ homepage: https://github.com/oblakeerickson/jekyll-discourse-comments
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A Jekyll plugin for adding Discourse comments
82
+ test_files: []