middleman-disqus 0.0.2
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 +7 -0
- data/.gitignore +4 -0
- data/Gemfile +17 -0
- data/LICENSE +20 -0
- data/README.md +62 -0
- data/Rakefile +14 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-disqus.rb +11 -0
- data/lib/middleman-disqus/extension.rb +42 -0
- data/lib/middleman_extension.rb +1 -0
- data/middleman-disqus.gemspec +25 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37ffd28cf02ef807e9ae00f367b322940bc553cb
|
4
|
+
data.tar.gz: 398a40e322cafea2658989ec9e5c220022c1b631
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f0727a0b5a564e86cc1a0706550be7a26edaf8ed93eb5dda9f830ebe8cfaedb43e69c10f0f5e575150fe3246cce237817cc492b1cfb7280fbee999f57004e04
|
7
|
+
data.tar.gz: b106a3485de0198d39d3e9d49b254c19f13e625e352645e4e06e3f00fd0352c96f3c671aa03b50e9d0a4fe3925737a4579731d3ddc92b7cd14a14cbacae09c0b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in middleman-google-analytics.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem "rake", "~> 0.9.2"
|
8
|
+
gem "rdoc", "~> 3.9"
|
9
|
+
gem "yard", "~> 0.8.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
group :test do
|
13
|
+
gem "cucumber", "~> 1.2.0"
|
14
|
+
gem "fivemat"
|
15
|
+
gem "aruba", "~> 0.4.11"
|
16
|
+
gem "rspec", "~> 2.7"
|
17
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Simon Rice
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Middleman Disqus
|
2
|
+
|
3
|
+
Middleman-Disqus is a [Middleman](https://github.com/middleman/middleman)
|
4
|
+
extension that generates the Disqus embed code, and keeps your config
|
5
|
+
in `config.rb`, where it belongs.
|
6
|
+
|
7
|
+
This plugin is based on [middleman-google-analytics](https://github.com/MrJoy/middleman-google-analytics).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
If you already have a Middleman project:
|
12
|
+
|
13
|
+
Add `gem "middleman-disqus"` to your `Gemfile` then open up your `config.rb` and add:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
# Activate Disqus extension
|
17
|
+
activate :disqus do |d|
|
18
|
+
d.shortname = "your_shortname"
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
Then, in your relevant layout(s), after your footer, call `disqus_tag` and
|
23
|
+
include the results in the page. For example, in HAML:
|
24
|
+
|
25
|
+
```haml
|
26
|
+
= disqus
|
27
|
+
```
|
28
|
+
|
29
|
+
Or ERB:
|
30
|
+
|
31
|
+
```erb
|
32
|
+
<%= disqus %>
|
33
|
+
```
|
34
|
+
|
35
|
+
## Only Including Embed Code in Builds
|
36
|
+
|
37
|
+
To include the tracking code only in builds, and not when running
|
38
|
+
`middleman server`, simply add environment-specific configurations in your
|
39
|
+
`config.rb`:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
configure :development do
|
43
|
+
activate :disqus do |d|
|
44
|
+
d.shortname = false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
configure :build do
|
49
|
+
activate :disqus do |d|
|
50
|
+
d.shortname = "your_shortname"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
## Usage
|
56
|
+
|
57
|
+
Once you've bundled you should be able to run middleman as normal, and have it
|
58
|
+
display the Disqus comments box.
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
Usage is provided under the MIT License. See the LICENSE file for the full details.
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
+
t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
task :test => ["cucumber"]
|
13
|
+
|
14
|
+
task :default => :test
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Require core library
|
2
|
+
require 'middleman-core'
|
3
|
+
|
4
|
+
# Register extensions which can be activated
|
5
|
+
# Make sure we have the version of Middleman we expect
|
6
|
+
::Middleman::Extensions.register(:disqus) do
|
7
|
+
require 'middleman-disqus/extension'
|
8
|
+
|
9
|
+
# Return the extension module
|
10
|
+
::Middleman::Disqus
|
11
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Middleman
|
2
|
+
module Disqus
|
3
|
+
class Options < Struct.new(:shortname); end
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def options
|
7
|
+
@@options ||= {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def registered(app, options={})
|
11
|
+
@@options ||= Options.new(options)
|
12
|
+
yield @@options if block_given?
|
13
|
+
|
14
|
+
app.send :include, InstanceMethods
|
15
|
+
end
|
16
|
+
alias :included :registered
|
17
|
+
end
|
18
|
+
|
19
|
+
module InstanceMethods
|
20
|
+
def disqus
|
21
|
+
options = ::Middleman::Disqus.options
|
22
|
+
# options.debug ||= not build?
|
23
|
+
if shortname = options.shortname
|
24
|
+
%Q{<div id="disqus_thread"></div>
|
25
|
+
<script type="text/javascript">
|
26
|
+
//<![CDATA[
|
27
|
+
var disqus_shortname = '#{shortname}'; // required: replace example with your forum shortname
|
28
|
+
(function() {
|
29
|
+
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
30
|
+
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
31
|
+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
32
|
+
})();
|
33
|
+
//]]>
|
34
|
+
</script>
|
35
|
+
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
36
|
+
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
37
|
+
</script>}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'middleman-disqus'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "middleman-disqus"
|
6
|
+
s.version = "0.0.2"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Simon Rice"]
|
9
|
+
s.email = ["im@simonrice.com"]
|
10
|
+
s.homepage = "http://github.com/simonrice/middleman-disqus"
|
11
|
+
s.license = 'MIT'
|
12
|
+
s.summary = %q{A Middleman plugin for adding the Disqus embed code.}
|
13
|
+
# s.description = %q{A longer description of your extension}
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
|
20
|
+
# The version of middleman-core your extension depends on
|
21
|
+
s.add_runtime_dependency("middleman-core", [">= 3.0.6"])
|
22
|
+
|
23
|
+
# Additional dependencies
|
24
|
+
# s.add_runtime_dependency("gem-name", "gem-version")
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-disqus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Rice
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.6
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.6
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- im@simonrice.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- features/support/env.rb
|
40
|
+
- lib/middleman-disqus.rb
|
41
|
+
- lib/middleman-disqus/extension.rb
|
42
|
+
- lib/middleman_extension.rb
|
43
|
+
- middleman-disqus.gemspec
|
44
|
+
homepage: http://github.com/simonrice/middleman-disqus
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.0.0
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: A Middleman plugin for adding the Disqus embed code.
|
68
|
+
test_files:
|
69
|
+
- features/support/env.rb
|
70
|
+
has_rdoc:
|