nanoc-toolbox 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02fecbe3e2894355f71266654a94f9e2bff7b11c
4
+ data.tar.gz: 0eaf5eee8df6c5a23e429ac5526749340983c287
5
+ SHA512:
6
+ metadata.gz: 0194d9fdf70f76de1e55fa5a50a926fc17dc44d0323c02b651e653b0c8f32a3455a953025117ad9af24a9336ba571db43f44ed5bb5e435812873ae4128e494fb
7
+ data.tar.gz: 75921bf08dda8347d58e19114d88afdbff62701cf35e080bf3bbac907dec0b6f370502f8284e47d94dae5213a0fd262ba03207bd2d81edb8064837c4472537d5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## Release 0.2.0
4
+
5
+ * ADD: Google Universal Analytics (by @grv87)
6
+
3
7
  ## Release 0.1.2
4
8
 
5
9
  * FIXED: Compatibility broken by nanoc on breadcrumbs
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc-toolbox (0.1.3)
4
+ nanoc-toolbox (0.2.0)
5
5
  jsmin (~> 1.0)
6
6
  nanoc (~> 3.6)
7
7
  nokogiri (~> 1.6)
@@ -18,7 +18,7 @@ GEM
18
18
  rest-client
19
19
  simplecov (>= 0.7)
20
20
  thor
21
- cri (2.3.0)
21
+ cri (2.4.0)
22
22
  colored (>= 1.2)
23
23
  diff-lcs (1.2.4)
24
24
  ffi (1.9.0)
@@ -40,9 +40,9 @@ GEM
40
40
  lumberjack (1.0.3)
41
41
  method_source (0.8.1)
42
42
  mime-types (1.23)
43
- mini_portile (0.5.0)
43
+ mini_portile (0.5.2)
44
44
  multi_json (1.7.7)
45
- nanoc (3.6.4)
45
+ nanoc (3.6.6)
46
46
  cri (~> 2.3)
47
47
  nokogiri (1.6.0)
48
48
  mini_portile (~> 0.5.0)
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # nanoc-toolbox
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/nanoc-toolbox.png)](http://badge.fury.io/rb/nanoc-toolbox)
3
4
  [![Build Status](https://travis-ci.org/aadlani/nanoc-toolbox.png)](http://travis-ci.org/aadlani/nanoc-toolbox)
4
5
  [![Dependency Status](https://gemnasium.com/aadlani/nanoc-toolbox.png)](https://gemnasium.com/aadlani/nanoc-toolbox)
5
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/aadlani/nanoc-toolbox)
6
6
  [![Coverage Status](https://coveralls.io/repos/aadlani/nanoc-toolbox/badge.png)](https://coveralls.io/r/aadlani/nanoc-toolbox)
7
-
7
+ [![Code Climate](https://codeclimate.com/github/aadlani/nanoc-toolbox.png)](https://codeclimate.com/github/aadlani/nanoc-toolbox)
8
8
 
9
9
  ## Presentation
10
10
 
@@ -19,6 +19,7 @@ If you feel something's missing, feel free to contribute.
19
19
  * **Navigation**: Menu, Breadcrumb, Table of contents,
20
20
  * **Gravatar**: Avatar Using the Gravatar System
21
21
  * **HtmlTag**: HTML Tag helper for other helpers
22
+ * **Google UA**: Generate the JS code snipet for Universal Analytics
22
23
  * **Google Analytics**: Generate the JS code snipet for Analytics
23
24
  * **Blogging Extra**: Add extra blog post behavior
24
25
  * **Tagging Extra**: Add extra tagging behavior
@@ -5,6 +5,7 @@ require 'nanoc/toolbox/helpers/disqus'
5
5
  require 'nanoc/toolbox/helpers/blogging_extra'
6
6
  require 'nanoc/toolbox/helpers/tagging_extra'
7
7
  require 'nanoc/toolbox/helpers/google_analytics'
8
+ require 'nanoc/toolbox/helpers/google_ua'
8
9
  require 'nanoc/toolbox/helpers/github_gist'
9
10
 
10
11
  # This module will regroup all the helpers for nanoc
@@ -31,7 +31,7 @@ module Nanoc::Toolbox::Helpers
31
31
  #{configuration_variables}
32
32
  (function() {
33
33
  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
34
- dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
34
+ dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
35
35
  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
36
36
  })();
37
37
  EOS
@@ -0,0 +1,35 @@
1
+ require 'nanoc/toolbox/helpers/html_tag'
2
+
3
+ module Nanoc::Toolbox::Helpers
4
+ # NANOC Helper for the Google Universal Analytics JS to add at the end of the
5
+ # layout.
6
+ #
7
+ # This module contains helper functions to generate the JS code snipet
8
+ # used to track your site analytics by simply entering your tracking ID as
9
+ # parameter or in the configuration file
10
+ #
11
+ # @see http://www.google.com/analytics/
12
+ # @author Anouar ADLANI <anouar@adlani.com>
13
+ # @author Basil Peace <grv87@yandex.ru>
14
+ module GoogleUA
15
+ include Nanoc::Toolbox::Helpers::HtmlTag
16
+
17
+ # Return the javascript code snipet to use in your layout or views
18
+ #
19
+ # @param [String] ga_tracking_code the Google Analytics Tracking Code
20
+ # @return [String] the script tag to place in your layout
21
+ def ua_tracking_snippet(ga_tracking_code=nil)
22
+ ga_tracking_code ||= @config[:ga_tracking_code] || "UA-xxxxxx-x"
23
+ js = <<-EOS
24
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
25
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
26
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
27
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
28
+
29
+ ga('create', '#{ga_tracking_code}', 'auto');
30
+ ga('send', 'pageview');
31
+ EOS
32
+ content_tag('script', js, { :type => 'text/javascript' })
33
+ end
34
+ end
35
+ end
@@ -3,8 +3,8 @@ module Nanoc
3
3
  # Holds information about library version.
4
4
  module Version
5
5
  MAJOR = 0
6
- MINOR = 1
7
- PATCH = 3
6
+ MINOR = 2
7
+ PATCH = 0
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -0,0 +1,38 @@
1
+ require "spec_helper"
2
+
3
+
4
+ class GoogleUADummyClass
5
+ include Nanoc::Toolbox::Helpers::GoogleUA
6
+ def initialize
7
+ @config = { :ga_tracking_code => "UA-0000000-0" }
8
+ end
9
+ end
10
+
11
+ describe Nanoc::Toolbox::Helpers::GoogleUA do
12
+ subject { GoogleUADummyClass.new }
13
+
14
+ it { should respond_to(:ua_tracking_snippet) }
15
+
16
+ describe ".ua_tracking_snippet" do
17
+
18
+ it "returns a string that contains the JS" do
19
+ subject.ua_tracking_snippet().should include("<script")
20
+ subject.ua_tracking_snippet().should include("ga('create'")
21
+ subject.ua_tracking_snippet().should include("ga('send', 'pageview');")
22
+ end
23
+
24
+ it "includes the passed code" do
25
+ subject.ua_tracking_snippet("UA-123456-1").should include("UA-123456-1")
26
+ end
27
+
28
+ it "includes the tracking code from the site config" do
29
+ subject.instance_variable_set(:@config, { :ga_tracking_code => "UA-0000000-0"})
30
+ subject.ua_tracking_snippet().should include "UA-0000000-0"
31
+ end
32
+
33
+ it "includes the placeholder code when no value is found" do
34
+ subject.instance_variable_set(:@config, { })
35
+ subject.ua_tracking_snippet().should include "UA-xxxxxx-x"
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Anouar ADLANI
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-21 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nanoc
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: nokogiri
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: jsmin
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bundler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -136,6 +123,7 @@ files:
136
123
  - lib/nanoc/toolbox/helpers/disqus.rb
137
124
  - lib/nanoc/toolbox/helpers/github_gist.rb
138
125
  - lib/nanoc/toolbox/helpers/google_analytics.rb
126
+ - lib/nanoc/toolbox/helpers/google_ua.rb
139
127
  - lib/nanoc/toolbox/helpers/gravatar.rb
140
128
  - lib/nanoc/toolbox/helpers/html_tag.rb
141
129
  - lib/nanoc/toolbox/helpers/navigation.rb
@@ -150,6 +138,7 @@ files:
150
138
  - spec/helpers/disqus_spec.rb
151
139
  - spec/helpers/github_gist_spec.rb
152
140
  - spec/helpers/google_analytics_spec.rb
141
+ - spec/helpers/google_ua_spec.rb
153
142
  - spec/helpers/gravatar_spec.rb
154
143
  - spec/helpers/html_tag_spec.rb
155
144
  - spec/helpers/navigation_spec.rb
@@ -157,6 +146,7 @@ files:
157
146
  - spec/spec_helper.rb
158
147
  homepage: http://aadlani.github.com/nanoc-toolbox/
159
148
  licenses: []
149
+ metadata: {}
160
150
  post_install_message:
161
151
  rdoc_options:
162
152
  - --main
@@ -164,21 +154,19 @@ rdoc_options:
164
154
  require_paths:
165
155
  - lib
166
156
  required_ruby_version: !ruby/object:Gem::Requirement
167
- none: false
168
157
  requirements:
169
- - - ! '>='
158
+ - - '>='
170
159
  - !ruby/object:Gem::Version
171
160
  version: 1.8.7
172
161
  required_rubygems_version: !ruby/object:Gem::Requirement
173
- none: false
174
162
  requirements:
175
- - - ! '>='
163
+ - - '>='
176
164
  - !ruby/object:Gem::Version
177
165
  version: 1.3.6
178
166
  requirements: []
179
167
  rubyforge_project:
180
- rubygems_version: 1.8.23
168
+ rubygems_version: 2.0.3
181
169
  signing_key:
182
- specification_version: 3
170
+ specification_version: 4
183
171
  summary: A collection of helper and filters for nanoc
184
172
  test_files: []