middleman-google-analytics 1.1.0 → 2.0.0.rc.1

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: a51b2ac371e8473750df8ecd42cc01e50a2ccfff
4
- data.tar.gz: 4f8721f1ca33bdffecdc0da50645bfa418f8a8b1
3
+ metadata.gz: 4562d74185bf6d7801721146bdc888d3a1fb03bf
4
+ data.tar.gz: 85172e0dfcbfce86989c4100a49a3f0ecc0abf3c
5
5
  SHA512:
6
- metadata.gz: 868b3bd4f25e4cb9655f55b78abb46a9e384f535cf7711e4d345bf536136b49b99850c181c2c0d6ae102e843774abbc8cfbe8813c0d09a8f19cdf8aafa6411bb
7
- data.tar.gz: e7f1f30c3975d168d1c9c9d710c087c590bde2f45fa0daed5362611e53e35141cfbb4801b393d32f37b3e9b0604b2cb26576c50a1307c0c8a1e883a401535ecc
6
+ metadata.gz: 7c2d6ada2eed28d053bf4c96996804954530809cc77117d60e3778ca577655d764b3b1302f517d0410bc50a250cbee30f78b081745224ca50b13b455512cc04c
7
+ data.tar.gz: c42014798188072354996b085ed686e67f2b3e89412246b8ae661e42eca98e17754fe50768c3a82bee3ba789998a6875b71da67d5aff45d73ad0a85708be2379
data/.travis.yml CHANGED
@@ -1,18 +1,30 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
4
+ before_script:
5
+ - bundle update
2
6
 
3
7
  rvm:
4
8
  - ruby-head
5
- - 2.2.0
6
- - 2.1.5
9
+ - 2.2.3
10
+ - 2.1.7
7
11
  - 2.0.0
8
- - 1.9.3
9
- - jruby-19mode
12
+
13
+ os:
14
+ - linux
15
+ - osx
10
16
 
11
17
  matrix:
18
+ fast_finish: true
12
19
  allow_failures:
13
20
  - rvm: ruby-head
14
- - rvm: jruby-19mode
15
21
 
16
- script: bundle exec rake test
22
+ env:
23
+ global:
24
+ - TEST=true
17
25
 
18
- env: TEST=true
26
+ gemfile:
27
+ - Gemfile
28
+ - Gemfile-v3
29
+
30
+ script: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## HEAD (???)
3
+ ## 2.0.0 (???)
4
+
5
+ * Middleman v4 support added.
6
+ * Global google_analytics_settings removed.
7
+ * Output option added.
8
+ * Erubis instead of ERB.
9
+ * Require Ruby 2.0 or greater.
10
+ * Require Middleman 3.4 or greater.
4
11
 
5
12
  ## 1.1.0 (2015-01-06)
6
13
 
data/Gemfile CHANGED
@@ -1,17 +1,15 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'middleman-core', github: 'middleman/middleman', branch: 'master'
4
+
3
5
  # Specify your gem's dependencies in middleman-google-analytics.gemspec
4
6
  gemspec
5
7
 
6
- group :development do
7
- gem 'rake'
8
- gem 'rdoc'
9
- gem 'yard'
10
- end
8
+ # Build and doc tools
9
+ gem 'rake', '~> 10.3', require: false
10
+ gem 'yard', '~> 0.8', require: false
11
11
 
12
- group :test do
13
- gem 'cucumber'
14
- gem 'fivemat', github: 'tpope/fivemat'
15
- gem 'aruba'
16
- gem 'rspec'
17
- end
12
+ # Test tools
13
+ gem 'cucumber', '~> 2.0', require: false
14
+ gem 'aruba', '~> 0.7.4', require: false
15
+ gem 'rspec', '~> 3.0', require: false
data/Gemfile-v3 ADDED
@@ -0,0 +1,15 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'middleman-core', github: 'middleman/middleman', branch: 'v3-stable'
4
+
5
+ # Specify your gem's dependencies in middleman-google-analytics.gemspec
6
+ gemspec
7
+
8
+ # Build and doc tools
9
+ gem 'rake', '~> 10.3', require: false
10
+ gem 'yard', '~> 0.8', require: false
11
+
12
+ # Test tools
13
+ gem 'cucumber', '~> 2.0', require: false
14
+ gem 'aruba', '~> 0.7.4', require: false
15
+ gem 'rspec', '~> 3.0', require: false
data/README.md CHANGED
@@ -14,8 +14,7 @@ keeps your config in `config.rb`, where it belongs.
14
14
  1. Specify the dependency in your project's `Gemfile`:
15
15
 
16
16
  ```ruby
17
- # Gemfile
18
- gem "middleman-google-analytics"
17
+ gem 'middleman-google-analytics', '~> 2.0'
19
18
  ```
20
19
 
21
20
  2. Activate the Google Analytics extension in your project's `config.rb`:
@@ -54,6 +53,18 @@ keeps your config in `config.rb`, where it belongs.
54
53
  <%= google_analytics_universal_tag %>
55
54
  ```
56
55
 
56
+ **JavaScript with ERB (js.erb):**
57
+
58
+ ```erb
59
+ # Google Analytics
60
+ <%= google_analytics_tag %>
61
+ ```
62
+
63
+ ```erb
64
+ # Universal Analytics
65
+ <%= google_analytics_universal_tag %>
66
+ ```
67
+
57
68
  ## Configuration
58
69
 
59
70
  ```ruby
@@ -78,6 +89,9 @@ activate :google_analytics do |ga|
78
89
 
79
90
  # Compress the JavaScript code (default = false)
80
91
  ga.minify = false
92
+
93
+ # Output style - :html includes <script> tag (default = :html)
94
+ ga.output = :js
81
95
  end
82
96
  ```
83
97
 
@@ -92,6 +106,8 @@ display the GA tracking code.
92
106
  * For the initial code.
93
107
  * [Atsushi Nagase (@ngs)](https://github.com/ngs)
94
108
  * Cucumber tests and "Universal Analytics" support.
109
+ * [Thomas Reynolds (tdreyno)](https://github.com/tdreyno)
110
+ * For the great support.
95
111
  * [Contributors](../../graphs/contributors)
96
112
 
97
113
  ## Contributing
data/Rakefile CHANGED
@@ -4,10 +4,16 @@ Bundler::GemHelper.install_tasks
4
4
  require 'cucumber/rake/task'
5
5
 
6
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'}"
7
+ exempt_tags = ['--tags ~@wip']
8
+ t.cucumber_opts = "--color #{exempt_tags.join(' ')} --strict"
8
9
  end
9
10
 
10
11
  require 'rake/clean'
11
12
 
12
13
  task test: :cucumber
13
14
  task default: :test
15
+
16
+ desc 'Build HTML documentation'
17
+ task :doc do
18
+ sh 'bundle exec yard'
19
+ end
@@ -21,18 +21,18 @@ Feature: Google Analytics tag helper
21
21
  Given the Server is running at "debug-app"
22
22
  When I go to "/google-analytics.html"
23
23
  Then I should see:
24
- """
25
- <script type="text/javascript">
26
- var _gaq = _gaq || [];
27
- _gaq.push(["_setAccount", "UA-123456-78"]);
28
- _gaq.push(["_trackPageview"]);
29
- (function() {
30
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
31
- ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/u/ga_debug.js';
32
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
33
- })();
34
- </script>
35
- """
24
+ """
25
+ <script type="text/javascript">
26
+ var _gaq = _gaq || [];
27
+ _gaq.push(["_setAccount", "UA-123456-78"]);
28
+ _gaq.push(["_trackPageview"]);
29
+ (function() {
30
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
31
+ ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/u/ga_debug.js';
32
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
33
+ })();
34
+ </script>
35
+ """
36
36
 
37
37
  Scenario: Tracking across a domain and its subdomains
38
38
  Given the Server is running at "across-a-domain-app"
@@ -89,30 +89,18 @@ Feature: Google Analytics tag helper
89
89
  </script>
90
90
  """
91
91
 
92
- Scenario: Disable tracking in development environment
93
- Given the Server is running at "disable-app"
94
- When I go to "/google-analytics.html"
95
- Then I should see ""
96
- But I should not see:
97
- """
98
- <script type="text/javascript">
99
- var _gaq = _gaq || [];
100
- _gaq.push(["_setAccount", "UA-123456-78"]);
101
- (function() {
102
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
103
- ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
104
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
105
- })();
106
- </script>
107
- """
92
+ Scenario: Disable tracking in development environment
93
+ Given the Server is running at "disable-app"
94
+ When I go to "/google-analytics.html"
95
+ Then I should see "0" lines
108
96
 
109
- Scenario: Compress the JavaScript code
110
- Given the Server is running at "compress-js-app"
111
- When I go to "/google-analytics.html"
112
- Then I should see:
113
- """
114
- <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_trackPageview"]),function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}();</script>
115
- """
97
+ Scenario: Compress the JavaScript code
98
+ Given the Server is running at "compress-js-app"
99
+ When I go to "/google-analytics.html"
100
+ Then I should see:
101
+ """
102
+ <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_trackPageview"]),function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}();</script>
103
+ """
116
104
 
117
105
  Scenario: Full options
118
106
  Given the Server is running at "full-app"
@@ -121,3 +109,18 @@ Feature: Google Analytics tag helper
121
109
  """
122
110
  <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_setDomainName","example.com"]),_gaq.push(["_setAllowLinker",!0]),_gaq.push(["_gat._anonymizeIp"]),_gaq.push(["_trackPageview"]),function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/u/ga_debug.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}();</script>
123
111
  """
112
+
113
+ Scenario: JavaScript output style
114
+ Given the Server is running at "output-app"
115
+ When I go to "/javascripts/google_analytics.js"
116
+ Then I should see:
117
+ """
118
+ var _gaq = _gaq || [];
119
+ _gaq.push(["_setAccount", "UA-123456-78"]);
120
+ _gaq.push(["_trackPageview"]);
121
+ (function() {
122
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
123
+ ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
124
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
125
+ })();
126
+ """
@@ -61,28 +61,18 @@ Feature: Google Analytics Universal tag helper
61
61
  </script>
62
62
  """
63
63
 
64
- Scenario: Disable tracking in development environment
65
- Given the Server is running at "disable-app"
66
- When I go to "/google-analytics-universal.html"
67
- Then I should see ""
68
- But I should not see:
69
- """
70
- <script type="text/javascript">
71
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
72
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
73
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
74
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
75
- ga('create', 'UA-123456-78', 'auto');
76
- </script>
77
- """
64
+ Scenario: Disable tracking in development environment
65
+ Given the Server is running at "disable-app"
66
+ When I go to "/google-analytics-universal.html"
67
+ Then I should see "0" lines
78
68
 
79
- Scenario: Compress the JavaScript code
80
- Given the Server is running at "compress-js-app"
81
- When I go to "/google-analytics-universal.html"
82
- Then I should see:
83
- """
84
- <script type="text/javascript">!function(e,a,t,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=a.createElement(t),s=a.getElementsByTagName(t)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-123456-78","auto"),ga("send","pageview");</script>
85
- """
69
+ Scenario: Compress the JavaScript code
70
+ Given the Server is running at "compress-js-app"
71
+ When I go to "/google-analytics-universal.html"
72
+ Then I should see:
73
+ """
74
+ <script type="text/javascript">!function(e,a,t,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=a.createElement(t),s=a.getElementsByTagName(t)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-123456-78","auto"),ga("send","pageview");</script>
75
+ """
86
76
 
87
77
  Scenario: Full options
88
78
  Given the Server is running at "full-app"
@@ -91,3 +81,16 @@ Feature: Google Analytics Universal tag helper
91
81
  """
92
82
  <script type="text/javascript">!function(e,a,n,t,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=a.createElement(n),s=a.getElementsByTagName(n)[0],o.async=1,o.src=t,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-123456-78","example.com",{allowLinker:!0}),ga("set","anonymizeIp",!0),ga("send","pageview");</script>
93
83
  """
84
+
85
+ Scenario: JavaScript output style
86
+ Given the Server is running at "output-app"
87
+ When I go to "/javascripts/google_analytics_universal.js"
88
+ Then I should see:
89
+ """
90
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
91
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
92
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
93
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
94
+ ga('create', 'UA-123456-78', 'auto');
95
+ ga('send', 'pageview');
96
+ """
@@ -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-google-analytics')
@@ -6,4 +6,5 @@ activate :google_analytics do |ga|
6
6
  ga.anonymize_ip = true
7
7
  ga.development = true
8
8
  ga.minify = true
9
+ ga.output = :html
9
10
  end
@@ -0,0 +1,4 @@
1
+ activate :google_analytics do |ga|
2
+ ga.tracking_id = 'UA-123456-78'
3
+ ga.output = :js
4
+ end
@@ -0,0 +1 @@
1
+ <%= google_analytics_tag %>
@@ -0,0 +1 @@
1
+ <%= google_analytics_universal_tag %>
@@ -1,15 +1,17 @@
1
1
  <%
2
- create_options = []
3
- create_options << "'#{@options.tracking_id}'"
4
- create_options << "'#{@options.domain_name || :auto}'"
5
- create_options << "{'allowLinker': true}" if @options.allow_linker
6
- ga = []
7
- ga << "ga('create', #{create_options.join(', ')});"
8
- ga << "ga('set', 'anonymizeIp', true);" if @options.anonymize_ip
9
- ga << "ga('send', 'pageview');"
2
+ file = @options.debug ? 'u/ga_debug' : 'ga'
3
+
4
+ gaq = []
5
+ gaq << ['_setAccount', "#{@options.tracking_id}"]
6
+ gaq << ['_setDomainName', "#{@options.domain_name}"] if @options.domain_name
7
+ gaq << ['_setAllowLinker', true] if @options.allow_linker
8
+ gaq << ['_gat._anonymizeIp'] if @options.anonymize_ip
9
+ gaq << ['_trackPageview']
10
10
  %>
11
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
12
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
13
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
14
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
15
- <%= ga.join("\n ") %>
11
+ var _gaq = _gaq || [];
12
+ <%= gaq.map! { |x| "_gaq.push(#{x});" }.join("\n") %>
13
+ (function() {
14
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
15
+ ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/<%= file %>.js';
16
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
17
+ })();
@@ -0,0 +1,16 @@
1
+ <%
2
+ create_options = []
3
+ create_options << "'#{@options.tracking_id}'"
4
+ create_options << "'#{@options.domain_name || :auto}'"
5
+ create_options << "{'allowLinker': true}" if @options.allow_linker
6
+
7
+ ga = []
8
+ ga << "ga('create', #{create_options.join(', ')});"
9
+ ga << "ga('set', 'anonymizeIp', true);" if @options.anonymize_ip
10
+ ga << "ga('send', 'pageview');"
11
+ %>
12
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
13
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
14
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
15
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
16
+ <%= ga.join("\n") %>
@@ -2,6 +2,7 @@ require 'middleman-google-analytics/helpers'
2
2
 
3
3
  module Middleman
4
4
  class GoogleAnalyticsExtension < Extension
5
+
5
6
  option :tracking_id, nil, 'Property ID'
6
7
  option :anonymize_ip, false, 'Removing the last octet of the IP address'
7
8
  option :domain_name, nil, 'Tracking across a domain and its subdomains'
@@ -10,23 +11,24 @@ module Middleman
10
11
  option :debug, false, 'Tracking Code Debugger'
11
12
  option :development, true, 'Tracking in development environment'
12
13
  option :minify, false, 'Compress the JavaScript code'
13
-
14
- def initialize(app, options_hash={}, &block)
15
- super
16
-
17
- app.set :google_analytics_settings, options
18
- end
14
+ option :output, :html, 'Output style - :html includes <script> tag'
19
15
 
20
16
  def after_configuration
21
17
  unless options.tracking_id
22
18
  $stderr.puts 'Google Analytics: Please specify a property ID'
23
- raise 'No property ID given' if display?
19
+ raise ArgumentError, 'No property ID given' if display?
24
20
  end
25
21
 
26
22
  if options.allow_linker and not options.domain_name
27
23
  $stderr.puts 'Google Analytics: Please specify a domain_name when ' \
28
24
  'using allow_linker'
29
- raise 'No domain_name given' if display?
25
+ raise ArgumentError, 'No domain_name given' if display?
26
+ end
27
+
28
+ unless [:html, :js].include?(options.output.try(:to_sym))
29
+ $stderr.puts 'Google Analytics: Please specify a valid output ' \
30
+ 'type (html|js).'
31
+ raise ArgumentError, 'Only "html" or "js" allowed' if display?
30
32
  end
31
33
  end
32
34
 
@@ -1,27 +1,49 @@
1
+ require 'erubis'
1
2
  require 'uglifier'
3
+ require 'active_support/core_ext/string/indent'
2
4
 
3
5
  module Middleman
4
6
  module GoogleAnalytics
5
7
  module Helpers
6
8
 
7
9
  def google_analytics_tag
8
- render_script('ga.js.erb')
10
+ render_script('analytics.js.erb')
9
11
  end
10
12
 
11
13
  def google_analytics_universal_tag
12
- render_script('analytics.js.erb')
14
+ render_script('analytics_universal.js.erb')
13
15
  end
14
16
 
15
17
  private
16
18
 
17
19
  def render_script(template)
18
- return nil if development? && !google_analytics_settings.development
20
+ options = extensions[:google_analytics].options
21
+
22
+ return nil if legacy_development? && !options.development
19
23
 
20
- @options = google_analytics_settings
21
24
  file = File.join(File.dirname(__FILE__), template)
22
- content = ERB.new(File.read(file)).result(binding)
23
- content = Uglifier.compile(content) if google_analytics_settings.minify
24
- content_tag(:script, content, type: 'text/javascript')
25
+ context = { options: options }
26
+ content = Erubis::FastEruby.new(File.read(file)).evaluate(context)
27
+ content = Uglifier.compile(content) if options.minify
28
+
29
+ if options.output.to_sym == :html
30
+ content = indent(content) unless options.minify
31
+ content_tag(:script, content, type: 'text/javascript')
32
+ else
33
+ content
34
+ end
35
+ end
36
+
37
+ # Ugly but true
38
+ def indent(content)
39
+ str = "\n"
40
+ content.each_line { |line| str << line.indent(2) }
41
+ str
42
+ end
43
+
44
+ # Support for Middleman >= 3.4
45
+ def legacy_development?
46
+ try(:development?) || try(:app).development?
25
47
  end
26
48
 
27
49
  end
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module GoogleAnalytics
3
- VERSION = "1.1.0"
3
+ VERSION = '2.0.0.rc.1'
4
4
  end
5
5
  end
@@ -1,24 +1,26 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "middleman-google-analytics/version"
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'middleman-google-analytics/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = "middleman-google-analytics"
6
+ s.name = 'middleman-google-analytics'
7
7
  s.version = Middleman::GoogleAnalytics::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Daniel Bayerlein", "Jon Frisby"]
10
- s.email = ["daniel.bayerlein@googlemail.com", "jfrisby@mrjoy.com"]
11
- s.homepage = "https://github.com/danielbayerlein/middleman-google-analytics"
12
- s.summary = "A Middleman plugin for handling Google Analytics tracking code."
13
- s.description = "middleman-google-analytics is a Middleman extension that generates Google Analytics tracking code, and keeps your config in config.rb, where it belongs."
14
- s.license = "MIT"
9
+ s.authors = ['Daniel Bayerlein', 'Jon Frisby']
10
+ s.email = ['daniel.bayerlein@googlemail.com', 'jfrisby@mrjoy.com']
11
+ s.homepage = 'https://github.com/danielbayerlein/middleman-google-analytics'
12
+ s.summary = 'A Middleman plugin for handling Google Analytics tracking code.'
13
+ s.description = 'middleman-google-analytics is a Middleman extension that generates Google Analytics tracking code, and keeps your config in config.rb, where it belongs.'
14
+ s.license = 'MIT'
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
19
+ s.require_paths = ['lib']
20
20
 
21
21
  s.required_ruby_version = '>= 1.9.3'
22
- s.add_dependency("middleman-core", ["~> 3.2"])
23
- s.add_dependency("uglifier", [">= 2.1", "< 3.0"])
22
+ s.add_dependency('middleman-core', ['>= 3.4'])
23
+ s.add_dependency('uglifier', ['~> 2.6'])
24
+ s.add_dependency('activesupport', ['~> 4.1'])
25
+ s.add_dependency('erubis')
24
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-google-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Bayerlein
@@ -9,42 +9,64 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-06 00:00:00.000000000 Z
12
+ date: 2015-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: middleman-core
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.2'
20
+ version: '3.4'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '3.2'
27
+ version: '3.4'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: uglifier
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.1'
35
- - - "<"
34
+ version: '2.6'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
36
40
  - !ruby/object:Gem::Version
37
- version: '3.0'
41
+ version: '2.6'
42
+ - !ruby/object:Gem::Dependency
43
+ name: activesupport
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '4.1'
38
49
  type: :runtime
39
50
  prerelease: false
40
51
  version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '4.1'
56
+ - !ruby/object:Gem::Dependency
57
+ name: erubis
58
+ requirement: !ruby/object:Gem::Requirement
41
59
  requirements:
42
60
  - - ">="
43
61
  - !ruby/object:Gem::Version
44
- version: '2.1'
45
- - - "<"
62
+ version: '0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
46
68
  - !ruby/object:Gem::Version
47
- version: '3.0'
69
+ version: '0'
48
70
  description: middleman-google-analytics is a Middleman extension that generates Google
49
71
  Analytics tracking code, and keeps your config in config.rb, where it belongs.
50
72
  email:
@@ -58,6 +80,7 @@ files:
58
80
  - ".travis.yml"
59
81
  - CHANGELOG.md
60
82
  - Gemfile
83
+ - Gemfile-v3
61
84
  - LICENSE
62
85
  - README.md
63
86
  - Rakefile
@@ -87,10 +110,13 @@ files:
87
110
  - fixtures/full-app/config.rb
88
111
  - fixtures/full-app/source/google-analytics-universal.html.erb
89
112
  - fixtures/full-app/source/google-analytics.html.erb
113
+ - fixtures/output-app/config.rb
114
+ - fixtures/output-app/source/javascripts/google_analytics.js.erb
115
+ - fixtures/output-app/source/javascripts/google_analytics_universal.js.erb
90
116
  - lib/middleman-google-analytics.rb
91
117
  - lib/middleman-google-analytics/analytics.js.erb
118
+ - lib/middleman-google-analytics/analytics_universal.js.erb
92
119
  - lib/middleman-google-analytics/extension.rb
93
- - lib/middleman-google-analytics/ga.js.erb
94
120
  - lib/middleman-google-analytics/helpers.rb
95
121
  - lib/middleman-google-analytics/version.rb
96
122
  - middleman-google-analytics.gemspec
@@ -109,9 +135,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
135
  version: 1.9.3
110
136
  required_rubygems_version: !ruby/object:Gem::Requirement
111
137
  requirements:
112
- - - ">="
138
+ - - ">"
113
139
  - !ruby/object:Gem::Version
114
- version: '0'
140
+ version: 1.3.1
115
141
  requirements: []
116
142
  rubyforge_project:
117
143
  rubygems_version: 2.4.5
@@ -1,16 +0,0 @@
1
- <%
2
- file = @options.debug ? 'u/ga_debug' : 'ga'
3
- gaq = []
4
- gaq << ['_setAccount', "#{@options.tracking_id}"]
5
- gaq << ['_setDomainName', "#{@options.domain_name}"] if @options.domain_name
6
- gaq << ['_setAllowLinker', true] if @options.allow_linker
7
- gaq << ['_gat._anonymizeIp'] if @options.anonymize_ip
8
- gaq << ['_trackPageview']
9
- %>
10
- var _gaq = _gaq || [];
11
- <%= gaq.map! { |x| "_gaq.push(#{x});" }.join("\n ") %>
12
- (function() {
13
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
14
- ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/<%= file %>.js';
15
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
16
- })();