middleman-piwik 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3122879e4d4141eb7e6b0288a3ce10e635cc8bf9
4
- data.tar.gz: 6da7d2178d1409bdd29d64cc6567427741af142e
3
+ metadata.gz: c343d3b1ac6e7eba2d62839170e0222565b44827
4
+ data.tar.gz: bd39c647a1ff91312ac76f5f24a9cc34ded48327
5
5
  SHA512:
6
- metadata.gz: e601679a81108d29308cb0df6ed0b42188ddee44936f90b49265c6137b30b14b58518a856dec893a12879856be0bff44100924b3b57165b7d14cd11f31d56000
7
- data.tar.gz: cd93cf85c116357172f52ce755a42d8fd338f5ef249476072983343399882de670a1e59b01553d5938802489473924e0de5c2b26d4c90b8d10c027cde2517e22
6
+ metadata.gz: 64988735aa3ed0c02bb85c96f9f08fa3a5458edb484e872bedf5eed30047a24f9568acc5088837681893aaa40f1ff05c99269cc4ad41e1cfbfe6a5d86d44f0b3
7
+ data.tar.gz: e61520f1641afd8e9587f766efeb2655648838d6095b3184e7ae561c8ca9943e8be851e42e085894861cf383d14c12a7a1cbe555460bb156e1cf69a342b84fec
@@ -1,3 +1,9 @@
1
+ 0.2.0
2
+ -----
3
+
4
+ * Add a url option, so we can use piwik installed in another location than the
5
+ root of the web server.
6
+
1
7
  0.1.1
2
8
  -----
3
9
 
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}/piwik.php?idsite=#{piwik_id}\" style=\"border:0;\" alt=\"\" /></p>"
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';
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  module Piwik
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
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.1.1
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-05-11 00:00:00.000000000 Z
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.1.11
73
+ rubygems_version: 2.2.2
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Piwik tracker integration for Middleman