middleman-piwik 0.1.1 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -0
- data/features/piwik_helpers.feature +30 -1
- data/lib/middleman-piwik/extension.rb +6 -2
- data/lib/middleman-piwik/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c343d3b1ac6e7eba2d62839170e0222565b44827
|
4
|
+
data.tar.gz: bd39c647a1ff91312ac76f5f24a9cc34ded48327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64988735aa3ed0c02bb85c96f9f08fa3a5458edb484e872bedf5eed30047a24f9568acc5088837681893aaa40f1ff05c99269cc4ad41e1cfbfe6a5d86d44f0b3
|
7
|
+
data.tar.gz: e61520f1641afd8e9587f766efeb2655648838d6095b3184e7ae561c8ca9943e8be851e42e085894861cf383d14c12a7a1cbe555460bb156e1cf69a342b84fec
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,7 @@ Just add `gem "middleman-piwik"` to your existing Gemfile and run `bundle instal
|
|
12
12
|
activate :piwik do |p|
|
13
13
|
p.id = 1
|
14
14
|
p.domain = 'piwik.example.net'
|
15
|
+
p.url = '/piwik'
|
15
16
|
end
|
16
17
|
```
|
17
18
|
|
@@ -19,6 +20,8 @@ id is the id of the site, as given by piwik. Usually, it start at 1.
|
|
19
20
|
|
20
21
|
domain is the domain name of the piwik server.
|
21
22
|
|
23
|
+
url is the url of the piwik installation. By default, it take the root of the website.
|
24
|
+
|
22
25
|
## Helper
|
23
26
|
|
24
27
|
The extension adds 3 new helper to Middleman to add the proper javascript and img in your website
|
@@ -7,11 +7,12 @@ Feature: Piwik helpers for js and img.
|
|
7
7
|
activate :piwik do |f|
|
8
8
|
f.id = 3
|
9
9
|
f.domain = 'piwik.example.com'
|
10
|
+
f.url = '/piwik2.2/'
|
10
11
|
end
|
11
12
|
"""
|
12
13
|
Given the Server is running at "test-app"
|
13
14
|
When I go to "/piwik_both.html"
|
14
|
-
Then I should see "piwik.example.com/piwik.php?idsite=3"
|
15
|
+
Then I should see "piwik.example.com/piwik2.2/piwik.php?idsite=3"
|
15
16
|
Then I should see "setSiteId"
|
16
17
|
Then I should see "noscript"
|
17
18
|
|
@@ -42,3 +43,31 @@ Feature: Piwik helpers for js and img.
|
|
42
43
|
When I go to "/piwik_js.html"
|
43
44
|
Then I should not see "noscript"
|
44
45
|
Then I should see 'setSiteId'
|
46
|
+
|
47
|
+
Scenario: Helpers without trailing slash
|
48
|
+
Given a fixture app "test-app"
|
49
|
+
And a file named "config.rb" with:
|
50
|
+
"""
|
51
|
+
activate :piwik do |f|
|
52
|
+
f.id = 6
|
53
|
+
f.domain = 'piwik.example.com'
|
54
|
+
f.url = 'piwik2.2'
|
55
|
+
end
|
56
|
+
"""
|
57
|
+
Given the Server is running at "test-app"
|
58
|
+
When I go to "/piwik_both.html"
|
59
|
+
Then I should see "piwik.example.com/piwik2.2/piwik.php?idsite=6"
|
60
|
+
|
61
|
+
Scenario: Helpers with extra trailing slash
|
62
|
+
Given a fixture app "test-app"
|
63
|
+
And a file named "config.rb" with:
|
64
|
+
"""
|
65
|
+
activate :piwik do |f|
|
66
|
+
f.id = 7
|
67
|
+
f.domain = 'piwik.example.com'
|
68
|
+
f.url = '////piwik2.2////'
|
69
|
+
end
|
70
|
+
"""
|
71
|
+
Given the Server is running at "test-app"
|
72
|
+
When I go to "/piwik_both.html"
|
73
|
+
Then I should see "piwik.example.com/piwik2.2/piwik.php?idsite=7"
|
@@ -3,15 +3,19 @@ module Middleman
|
|
3
3
|
class PiwikExtension < Extension
|
4
4
|
option :id, 1, 'Piwik site id'
|
5
5
|
option :domain, 'piwik.example.org', 'Piwik domain'
|
6
|
+
option :url, '', 'Piwik location'
|
6
7
|
|
7
8
|
def after_configuration
|
8
9
|
app.set :piwik_domain, options.domain
|
9
10
|
app.set :piwik_id, options.id
|
11
|
+
url = '/' + options.url + '/'
|
12
|
+
url.sub!(/^\/*/,'/').sub!(/\/*$/,'/')
|
13
|
+
app.set :piwik_url, url
|
10
14
|
end
|
11
15
|
|
12
16
|
helpers do
|
13
17
|
def insert_piwik_tracker_img
|
14
|
-
"<p><img src=\"https://#{piwik_domain}
|
18
|
+
"<p><img src=\"https://#{piwik_domain}#{piwik_url}piwik.php?idsite=#{piwik_id}\" style=\"border:0;\" alt=\"\" /></p>"
|
15
19
|
end
|
16
20
|
|
17
21
|
def insert_piwik_tracker_js
|
@@ -21,7 +25,7 @@ module Middleman
|
|
21
25
|
_paq.push(['trackPageView']);
|
22
26
|
_paq.push(['enableLinkTracking']);
|
23
27
|
(function() {
|
24
|
-
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://#{piwik_domain}
|
28
|
+
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://#{piwik_domain}#{piwik_url}";
|
25
29
|
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
26
30
|
_paq.push(['setSiteId', #{piwik_id}]);
|
27
31
|
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-piwik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Scherer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman-core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
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
26
|
version: '3.2'
|
27
27
|
description: Piwik tracker integration for Middleman
|
@@ -31,8 +31,8 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
35
|
-
- .travis.yml
|
34
|
+
- ".gitignore"
|
35
|
+
- ".travis.yml"
|
36
36
|
- CHANGELOG.md
|
37
37
|
- CONTRIBUTING.md
|
38
38
|
- Gemfile
|
@@ -60,17 +60,17 @@ require_paths:
|
|
60
60
|
- lib
|
61
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.2.2
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Piwik tracker integration for Middleman
|