middleman-disqus 0.0.2 → 0.0.3

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: 37ffd28cf02ef807e9ae00f367b322940bc553cb
4
- data.tar.gz: 398a40e322cafea2658989ec9e5c220022c1b631
3
+ metadata.gz: 201d480dd074109ef44da43e8623fbeaa449e876
4
+ data.tar.gz: 2aa8c23e7242cc564abd86a21179d96bc3a03514
5
5
  SHA512:
6
- metadata.gz: 6f0727a0b5a564e86cc1a0706550be7a26edaf8ed93eb5dda9f830ebe8cfaedb43e69c10f0f5e575150fe3246cce237817cc492b1cfb7280fbee999f57004e04
7
- data.tar.gz: b106a3485de0198d39d3e9d49b254c19f13e625e352645e4e06e3f00fd0352c96f3c671aa03b50e9d0a4fe3925737a4579731d3ddc92b7cd14a14cbacae09c0b
6
+ metadata.gz: b9381633cd561c76b96071e1c962530889a0bfa482abef5d7a8fd5b0c174ea9a5fe8c2275fa4dd84cec04586c392b258057dec41a685bf962be5c88ea12083a5
7
+ data.tar.gz: 8ac8c992d2fd6d70779ed23d5077cd1cd1ef2153294b0a2443be0071f9df5ce9fb9657cce55800a1f491d884ef91cbf891511d27cad0e19a9c5ccdea4e8b9e42
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  Gemfile.lock
3
3
  pkg
4
4
  *.gem
5
+ tmp/
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-19mode
9
+ - ruby-head
10
+ - jruby-head
11
+ - 1.8.7
12
+ - ree
13
+
14
+ matrix:
15
+ allow_failures:
16
+ - rvm: ruby-head
17
+ - rvm: jruby-head
18
+ - rvm: rbx-18mode
data/Gemfile CHANGED
@@ -10,8 +10,9 @@ group :development do
10
10
  end
11
11
 
12
12
  group :test do
13
- gem "cucumber", "~> 1.2.0"
14
- gem "fivemat"
15
- gem "aruba", "~> 0.4.11"
16
- gem "rspec", "~> 2.7"
13
+ gem "cucumber", "~> 1.3.4"
14
+ gem "fivemat", "~> 1.2.1"
15
+ gem "aruba", "~> 0.5.3"
17
16
  end
17
+
18
+ gem "ruby18_source_location", :platforms => :mri_18
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Middleman Disqus
2
2
 
3
+ [![Build Status](https://travis-ci.org/simonrice/middleman-disqus.png)](https://travis-ci.org/simonrice/middleman-disqus)
4
+ [![Gem Version](https://badge.fury.io/rb/middleman-disqus.png)](http://badge.fury.io/rb/middleman-disqus)
5
+ [![Dependency Status](https://gemnasium.com/simonrice/middleman-disqus.png)](https://gemnasium.com/simonrice/middleman-disqus)
6
+ [![Code Climate](https://codeclimate.com/github/simonrice/middleman-disqus.png)](https://codeclimate.com/github/simonrice/middleman-disqus)
7
+
3
8
  Middleman-Disqus is a [Middleman](https://github.com/middleman/middleman)
4
9
  extension that generates the Disqus embed code, and keeps your config
5
10
  in `config.rb`, where it belongs.
@@ -19,7 +24,7 @@ activate :disqus do |d|
19
24
  end
20
25
  ```
21
26
 
22
- Then, in your relevant layout(s), after your footer, call `disqus_tag` and
27
+ Then, in your relevant layout(s), after your footer, call `disqus` and
23
28
  include the results in the page. For example, in HAML:
24
29
 
25
30
  ```haml
@@ -34,7 +39,7 @@ Or ERB:
34
39
 
35
40
  ## Only Including Embed Code in Builds
36
41
 
37
- To include the tracking code only in builds, and not when running
42
+ To include the embed code only in builds, and not when running
38
43
  `middleman server`, simply add environment-specific configurations in your
39
44
  `config.rb`:
40
45
 
@@ -0,0 +1,10 @@
1
+ @new
2
+ Feature: Adds a Disqus embed code
3
+ Scenario: The Disqus embed code is added with the configured short name
4
+ Given a successfully built app at "disqus-app"
5
+ When I cd to "build"
6
+ Then the following files should exist:
7
+ | index.html |
8
+
9
+ And the file "index.html" should contain 'div id="disqus_thread"'
10
+ And the file "index.html" should contain "dsq.src = '//test-name.disqus.com/embed.js';"
@@ -1,4 +1,5 @@
1
1
  PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ ENV['TEST'] = 'true'
2
3
  require "middleman-core"
3
4
  require "middleman-core/step_definitions"
4
5
  require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-disqus')
@@ -0,0 +1,3 @@
1
+ activate :disqus do |d|
2
+ d.shortname = "test-name"
3
+ end
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Test</title>
6
+ </head>
7
+
8
+ <body class="<%= page_classes %>">
9
+ <%= yield %>
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ ---
2
+ title: Welcome to Middleman
3
+ ---
4
+
5
+ <p>Hello world!</p>
6
+ <%= disqus %>
@@ -0,0 +1,11 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Test</title>
6
+ </head>
7
+
8
+ <body class="<%= page_classes %>">
9
+ <%= yield %>
10
+ </body>
11
+ </html>
@@ -1,11 +1,33 @@
1
- # Require core library
2
- require 'middleman-core'
1
+ require "middleman-core"
3
2
 
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
3
+ class Disqus < ::Middleman::Extension
4
+ option :shortname, false, "Your short name for Disqus"
5
+
6
+ def initialize(app, options_hash={}, &block)
7
+ super
8
+
9
+ app.set :disqus_shortname, options.shortname
10
+ end
11
+
12
+ helpers do
13
+ def disqus
14
+ if disqus_shortname
15
+ %Q{<div id="disqus_thread"></div>
16
+ <script type="text/javascript">
17
+ //<![CDATA[
18
+ (function() {
19
+ var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
20
+ dsq.src = '//#{disqus_shortname}.disqus.com/embed.js';
21
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
22
+ })();
23
+ //]]>
24
+ </script>
25
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
26
+ <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
27
+ </script>}
28
+ end
29
+ end
30
+ end
11
31
  end
32
+
33
+ ::Middleman::Extensions.register(:disqus, Disqus)
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module Disqus
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -1,9 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
+ require "version"
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
  s.name = "middleman-disqus"
6
- s.version = "0.0.2"
7
+ s.version = Middleman::Disqus::VERSION
7
8
  s.platform = Gem::Platform::RUBY
8
9
  s.authors = ["Simon Rice"]
9
10
  s.email = ["im@simonrice.com"]
@@ -18,7 +19,7 @@ Gem::Specification.new do |s|
18
19
  s.require_paths = ["lib"]
19
20
 
20
21
  # The version of middleman-core your extension depends on
21
- s.add_runtime_dependency("middleman-core", [">= 3.0.6"])
22
+ s.add_runtime_dependency("middleman-core", [">= 3.1.0"])
22
23
 
23
24
  # Additional dependencies
24
25
  # s.add_runtime_dependency("gem-name", "gem-version")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-disqus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Rice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2013-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: middleman-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.6
19
+ version: 3.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.6
26
+ version: 3.1.0
27
27
  description:
28
28
  email:
29
29
  - im@simonrice.com
@@ -32,14 +32,20 @@ extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
34
  - .gitignore
35
+ - .travis.yml
35
36
  - Gemfile
36
37
  - LICENSE
37
38
  - README.md
38
39
  - Rakefile
40
+ - features/disqus.feature
39
41
  - features/support/env.rb
42
+ - fixtures/disqus-app/config.rb
43
+ - fixtures/disqus-app/layouts/layout.erb
44
+ - fixtures/disqus-app/source/index.html.erb
45
+ - fixtures/disqus-app/source/layouts/layout.erb
40
46
  - lib/middleman-disqus.rb
41
- - lib/middleman-disqus/extension.rb
42
47
  - lib/middleman_extension.rb
48
+ - lib/version.rb
43
49
  - middleman-disqus.gemspec
44
50
  homepage: http://github.com/simonrice/middleman-disqus
45
51
  licenses:
@@ -61,10 +67,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
67
  version: '0'
62
68
  requirements: []
63
69
  rubyforge_project:
64
- rubygems_version: 2.0.0
70
+ rubygems_version: 2.0.3
65
71
  signing_key:
66
72
  specification_version: 4
67
73
  summary: A Middleman plugin for adding the Disqus embed code.
68
74
  test_files:
75
+ - features/disqus.feature
69
76
  - features/support/env.rb
70
77
  has_rdoc:
@@ -1,42 +0,0 @@
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