nanoc-toolbox 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## developement
4
4
 
5
+ ## Release 0.0.5
6
+ * NEW: Analytics Helper
7
+ * NEW: JS Minify Filter
8
+
5
9
  ## Release 0.0.5
6
10
  * CHANGED: add the ability to filter by an attributes of an item on navigation_for
7
11
 
data/Gemfile.lock CHANGED
@@ -1,20 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc-toolbox (0.0.3)
4
+ nanoc-toolbox (0.0.6)
5
+ jsmin (>= 1.0.1)
5
6
  nanoc (>= 3.1.6)
6
7
  nokogiri (>= 1.4.4)
7
8
 
8
9
  GEM
9
10
  remote: http://rubygems.org/
10
11
  specs:
11
- cri (1.0.1)
12
+ cri (2.0.2)
12
13
  diff-lcs (1.1.2)
13
- nanoc (3.1.6)
14
- nanoc3 (>= 3.1.6)
15
- nanoc3 (3.1.6)
16
- cri (>= 1.0.0)
17
- nokogiri (1.4.4)
14
+ jsmin (1.0.1)
15
+ nanoc (3.2.3)
16
+ nanoc3 (>= 3.2.3)
17
+ nanoc3 (3.2.3)
18
+ cri (~> 2.0)
19
+ nokogiri (1.5.0)
18
20
  rspec (2.4.0)
19
21
  rspec-core (~> 2.4.0)
20
22
  rspec-expectations (~> 2.4.0)
@@ -29,7 +31,5 @@ PLATFORMS
29
31
 
30
32
  DEPENDENCIES
31
33
  bundler (>= 1.0.0)
32
- nanoc (>= 3.1.6)
33
34
  nanoc-toolbox!
34
- nokogiri (>= 1.4.4)
35
35
  rspec (>= 1.0.0)
data/README.md CHANGED
@@ -8,17 +8,24 @@ The nanoc-toolbox is a collection of filters and helpers for the static site gen
8
8
 
9
9
  ## Features
10
10
 
11
- * Navigation Helper
12
- * Gravatar Helper
13
- * HtmlTag Helper
11
+ ### Helpers
14
12
 
15
- * AddSection Filter
16
- * HtmlTidy Filter
13
+ * **Navigation**: Menu, Breadcrumb, Table of contents,
14
+ * **Gravatar**: Avatar Using the Gravatar System
15
+ * **HtmlTag**: HTML Tag helper for other helpers
16
+ * **Google Analytics***: Generate the JS code snipet for Analytics
17
+
18
+ ### Filters
19
+
20
+ * **AddSection**: Section div's based on headers
21
+ * **HtmlTidy**: Clean up the generated html code with Nokogiri
22
+ * **JS Minify**: Minifies the JS files using JSMin
17
23
 
18
24
  ## Requirements
19
25
 
20
- * nanoc3
21
- * Nokogiri
26
+ * **nanoc3**: It requires obviously the Nanoc gem
27
+ * **Nokogiri**: For the HTML Tidy Filter
28
+ * **jsmin**: For the JS Minify Filter
22
29
 
23
30
  ## Installation
24
31
 
@@ -28,35 +35,39 @@ To use the nanoc-toolbox, you have to start by installing the gem.
28
35
 
29
36
  Then require the project main file in your default.rb file in the lib directory of your nanoc project.
30
37
 
31
- require "nanoc/toolbox"
38
+ ```ruby
39
+ require "nanoc/toolbox"
40
+ ```
32
41
 
33
42
  And the last step is to include the required helper or filter, anywhere in the lib directory of your lib directory.
34
43
  The usage wants you to put it in the default.rb or the helpers.rb file.
35
44
 
36
45
  The following example shows a sample helpers_.rb file in the lib directory
37
46
 
38
- # Default Helpers provided By Nanoc
39
- include Nanoc3::Helpers::Blogging
40
- include Nanoc3::Helpers::Breadcrumbs
47
+ ```ruby
48
+ # Default Helpers provided By Nanoc
49
+ include Nanoc3::Helpers::Blogging
50
+ include Nanoc3::Helpers::Breadcrumbs
41
51
 
42
- # Custom Helpers
43
- include Nanoc::Toolbox::Helpers::Navigation
44
- include Nanoc::Toolbox::Helpers::Gravatar
52
+ # Custom Helpers
53
+ include Nanoc::Toolbox::Helpers::Navigation
54
+ include Nanoc::Toolbox::Helpers::Gravatar
55
+ ```
45
56
 
46
57
  ## Acknowledgments
47
58
 
59
+ All the people in [this list](https://github.com/aadlani/nanoc-toolbox/contributors)
48
60
 
49
-
50
- ## Author
61
+ ## Authors
51
62
 
52
63
  * Anouar ADLANI <anouar@adlani.com>
53
64
 
54
65
  ## Changelog
55
66
 
56
- See the CHANGELOG.rdoc file for details.
67
+ See the [CHANGELOG](https://github.com/aadlani/nanoc-toolbox/blob/master/CHANGELOG.md) file for details.
57
68
 
58
69
 
59
70
  ## License
60
71
 
61
72
  Copyright (c) 2011 Anouar ADLANI, nanoc-toolbox is released under the MIT license.
62
- See the LICENSE.md file for details.
73
+ See the [LICENSE](https://github.com/aadlani/nanoc-toolbox/blob/master/LICENSE.md) file for details.
@@ -0,0 +1,15 @@
1
+ require 'jsmin'
2
+
3
+ module Nanoc::Toolbox::Filters
4
+ # NANOC Filter for minifying the JS Files
5
+ # using the JSMin gem
6
+ # @see http://rubygems.org/gems/jsmin
7
+ # @author Anouar ADLANI <anouar@adlani.com>
8
+ class JsMinify < Nanoc3::Filter
9
+ identifier :js_minify
10
+
11
+ def run(content, args = {})
12
+ JSMin.minify(content)
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  require 'nanoc/toolbox/filters/html_tidy'
2
2
  require 'nanoc/toolbox/filters/add_sections'
3
+ require 'nanoc/toolbox/filters/js_minify'
3
4
 
4
5
  # This module will regroup all the filters for nanoc
5
6
  module Nanoc::Toolbox::Filters
6
-
7
7
  end
@@ -0,0 +1,33 @@
1
+ require 'nanoc/toolbox/helpers/html_tag'
2
+
3
+ module Nanoc::Toolbox::Helpers
4
+ # NANOC Helper for the Google Analytics JS to add at the end of the layout.
5
+ #
6
+ # This module contains helper functions to generate the JS code snipet
7
+ # used to track your site analytics by simply entering your tracking ID as
8
+ # parameter or in the configuration file
9
+ #
10
+ # @see http://www.google.com/analytics/
11
+ # @author Anouar ADLANI <anouar@adlani.com>
12
+ module GoogleAnalytics
13
+ include Nanoc::Toolbox::Helpers::HtmlTag
14
+
15
+ def ga_tracking_snippet(ga_tracking_code=nil)
16
+ ga_tracking_code ||= @site.config[:ga_tracking_code]
17
+ js = <<-EOS
18
+
19
+ var _gaq = _gaq || [];
20
+ _gaq.push(['_setAccount', '#{ga_tracking_code}']);
21
+ _gaq.push(['_trackPageview']);
22
+
23
+ (function() {
24
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
25
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
26
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
27
+ })();
28
+
29
+ EOS
30
+ content_tag('script', js, { :type => 'text/javascript' })
31
+ end
32
+ end
33
+ end
@@ -1,6 +1,7 @@
1
1
  require 'nanoc/toolbox/helpers/navigation'
2
2
  require 'nanoc/toolbox/helpers/gravatar'
3
3
  require 'nanoc/toolbox/helpers/html_tag'
4
+ require 'nanoc/toolbox/helpers/google_analytics'
4
5
 
5
6
  # This module will regroup all the helpers for nanoc
6
7
  module Nanoc::Toolbox::Helpers
@@ -4,7 +4,7 @@ module Nanoc
4
4
  module Version
5
5
  MAJOR = 0
6
6
  MINOR = 0
7
- PATCH = 5
7
+ PATCH = 6
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join(".")
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.add_dependency "nanoc", ">= 3.1.6"
18
18
  s.add_dependency "nokogiri", ">= 1.4.4"
19
+ s.add_dependency "jsmin", ">= 1.0.1"
19
20
 
20
21
  s.add_development_dependency "bundler", ">= 1.0.0"
21
22
  s.add_development_dependency "rspec", ">= 1.0.0"
@@ -0,0 +1,17 @@
1
+ require "spec_helper"
2
+ include Nanoc::Toolbox::Helpers::GoogleAnalytics
3
+
4
+ describe Nanoc::Toolbox::Helpers::GoogleAnalytics do
5
+ subject { Nanoc::Toolbox::Helpers::GoogleAnalytics }
6
+ it { should respond_to(:ga_tracking_snippet) }
7
+ describe ".ga_tracking_snippet" do
8
+ it "returns a string that contains the JS" do
9
+ ga_tracking_snippet("").should include("<script")
10
+ ga_tracking_snippet("").should include("var _gaq = _gaq || [];")
11
+ end
12
+
13
+ it "includes the passed code" do
14
+ ga_tracking_snippet("qwertzuiop").should include("qwertzuiop")
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 5
9
- version: 0.0.5
4
+ prerelease:
5
+ version: 0.0.6
10
6
  platform: ruby
11
7
  authors:
12
8
  - Anouar ADLANI
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-24 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-11-13 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: nanoc
@@ -25,10 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 3
30
- - 1
31
- - 6
32
23
  version: 3.1.6
33
24
  type: :runtime
34
25
  version_requirements: *id001
@@ -40,43 +31,42 @@ dependencies:
40
31
  requirements:
41
32
  - - ">="
42
33
  - !ruby/object:Gem::Version
43
- segments:
44
- - 1
45
- - 4
46
- - 4
47
34
  version: 1.4.4
48
35
  type: :runtime
49
36
  version_requirements: *id002
50
37
  - !ruby/object:Gem::Dependency
51
- name: bundler
38
+ name: jsmin
52
39
  prerelease: false
53
40
  requirement: &id003 !ruby/object:Gem::Requirement
54
41
  none: false
55
42
  requirements:
56
43
  - - ">="
57
44
  - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 0
61
- - 0
62
- version: 1.0.0
63
- type: :development
45
+ version: 1.0.1
46
+ type: :runtime
64
47
  version_requirements: *id003
65
48
  - !ruby/object:Gem::Dependency
66
- name: rspec
49
+ name: bundler
67
50
  prerelease: false
68
51
  requirement: &id004 !ruby/object:Gem::Requirement
69
52
  none: false
70
53
  requirements:
71
54
  - - ">="
72
55
  - !ruby/object:Gem::Version
73
- segments:
74
- - 1
75
- - 0
76
- - 0
77
56
  version: 1.0.0
78
57
  type: :development
79
58
  version_requirements: *id004
59
+ - !ruby/object:Gem::Dependency
60
+ name: rspec
61
+ prerelease: false
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 1.0.0
68
+ type: :development
69
+ version_requirements: *id005
80
70
  description: The nanoc-toolbox is a collection of filters and helpers for the static site generator tool nanoc
81
71
  email:
82
72
  - anouar@adlani.com
@@ -99,7 +89,9 @@ files:
99
89
  - lib/nanoc/toolbox/filters.rb
100
90
  - lib/nanoc/toolbox/filters/add_sections.rb
101
91
  - lib/nanoc/toolbox/filters/html_tidy.rb
92
+ - lib/nanoc/toolbox/filters/js_minify.rb
102
93
  - lib/nanoc/toolbox/helpers.rb
94
+ - lib/nanoc/toolbox/helpers/google_analytics.rb
103
95
  - lib/nanoc/toolbox/helpers/gravatar.rb
104
96
  - lib/nanoc/toolbox/helpers/html_tag.rb
105
97
  - lib/nanoc/toolbox/helpers/navigation.rb
@@ -108,11 +100,11 @@ files:
108
100
  - spec/data/filters/item_without_sections.html
109
101
  - spec/filters/add_sections_spec.rb
110
102
  - spec/filters/html_tidy_spec.rb
103
+ - spec/helpers/google_analytics_spec.rb
111
104
  - spec/helpers/gravatar_spec.rb
112
105
  - spec/helpers/html_tag_spec.rb
113
106
  - spec/helpers/navigation_spec.rb
114
107
  - spec/spec_helper.rb
115
- has_rdoc: true
116
108
  homepage: http://aadlani.github.com/nanoc-toolbox/
117
109
  licenses: []
118
110
 
@@ -127,23 +119,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
119
  requirements:
128
120
  - - ">="
129
121
  - !ruby/object:Gem::Version
130
- segments:
131
- - 0
132
122
  version: "0"
133
123
  required_rubygems_version: !ruby/object:Gem::Requirement
134
124
  none: false
135
125
  requirements:
136
126
  - - ">="
137
127
  - !ruby/object:Gem::Version
138
- segments:
139
- - 1
140
- - 3
141
- - 6
142
128
  version: 1.3.6
143
129
  requirements: []
144
130
 
145
131
  rubyforge_project:
146
- rubygems_version: 1.3.7
132
+ rubygems_version: 1.8.11
147
133
  signing_key:
148
134
  specification_version: 3
149
135
  summary: A collection of helper and filters for nanoc