middleman-hotjar 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f6fe7047ec7ef07bfb9fb7767af7a34b86fb05db
4
+ data.tar.gz: 3be4e79b074b17d475086483b1311215af71e88e
5
+ SHA512:
6
+ metadata.gz: 17b060923cb725f14a23dc3f79ed00d8b063ea59f7e7070f6285e2e187979d9e7b92c0cfed2b06425fa148e67681b22909606c4b3c64ac163830ee0b89ebf0c1
7
+ data.tar.gz: ad3bf83abf312e31ee4efb550a6dd8ddbb254b764af91bd730a1a7ec2ff008e9a3496bf705fa8c88c755c93179ba2b8d683b5ceeeefe6594293997bed58df70e
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ # This is a library
2
+ Gemfile.lock
3
+ .ruby-version
4
+ .ruby-gemset
5
+
6
+ # Ignore pkg folder
7
+ /pkg
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ # If you do not have OpenSSL installed, update
2
+ # the following line to use "http://" instead
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in middleman-hotjar.gemspec
6
+ gemspec
7
+
8
+ group :development do
9
+ gem 'rake'
10
+ gem 'rdoc'
11
+ gem 'yard'
12
+ end
13
+
14
+ group :test do
15
+ gem 'capybara'
16
+ gem 'cucumber'
17
+ gem 'aruba'
18
+ gem 'rspec'
19
+ end
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'cucumber/rake/task'
5
+
6
+ Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
7
+ t.cucumber_opts = "--color --tags 'not @wip' --strict"
8
+ end
9
+
10
+ require 'rake/clean'
11
+
12
+ task test: :cucumber
13
+ task default: :test
@@ -0,0 +1,18 @@
1
+ Feature: Hotjar tag helper
2
+
3
+ Scenario: Basic tracking code
4
+ Given the Server is running at "basic-app"
5
+ When I go to "/hotjar.html"
6
+ Then I should see:
7
+ """
8
+ <script>
9
+ (function(h,o,t,j,a,r){
10
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
11
+ h._hjSettings={hjid:123,hjsv:6};
12
+ a=o.getElementsByTagName('head')[0];
13
+ r=o.createElement('script');r.async=1;
14
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
15
+ a.appendChild(r);
16
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
17
+ </script>
18
+ """
@@ -0,0 +1,6 @@
1
+ ENV['TEST'] = 'true'
2
+
3
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
4
+ require 'middleman-core'
5
+ require 'middleman-core/step_definitions'
6
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-hotjar')
@@ -0,0 +1,3 @@
1
+ activate :hotjar do |hj|
2
+ hj.hjid = '123'
3
+ end
@@ -0,0 +1 @@
1
+ <%= hotjar_tag %>
@@ -0,0 +1,34 @@
1
+ require 'middleman-core'
2
+
3
+ class HotjarExtension < ::Middleman::Extension
4
+ option :hjid, nil, 'Hotjar ID'
5
+ option :hotjar_id, nil, 'Hotjar ID'
6
+ option :id, nil, 'Hotjar ID'
7
+
8
+ def after_configuration
9
+ options[:id] = options.id || options.hjid || options.hotjar_id
10
+ if options.id.nil?
11
+ $stderr.puts 'Hotjar: please specify a Hotjar ID'
12
+ raise ArgumentError, 'No Hotjar ID given' if app.build?
13
+ end
14
+ end
15
+
16
+ helpers do
17
+ def hotjar_tag
18
+ options = extensions[:hotjar].options
19
+ <<~HOTJAR_TAG
20
+ <!-- Hotjar Tracking Code -->
21
+ <script>
22
+ (function(h,o,t,j,a,r){
23
+ h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
24
+ h._hjSettings={hjid:#{options.id},hjsv:6};
25
+ a=o.getElementsByTagName('head')[0];
26
+ r=o.createElement('script');r.async=1;
27
+ r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
28
+ a.appendChild(r);
29
+ })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
30
+ </script>
31
+ HOTJAR_TAG
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,6 @@
1
+ require "middleman-core"
2
+
3
+ Middleman::Extensions.register :hotjar do
4
+ require "middleman-hotjar/extension"
5
+ HotjarExtension
6
+ end
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "middleman-hotjar"
6
+ s.version = "0.0.1"
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Kieran Hunt"]
9
+ s.email = ["kieran.hunt92@gmail.com"]
10
+ s.homepage = "http://github.com/KieranHunt/middleman-hotjar"
11
+ s.summary = %q{Add Hotjar analytics to your middleman site}
12
+ # s.description = %q{A longer description of your extension}
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ # The version of middleman-core your extension depends on
20
+ s.add_runtime_dependency("middleman-core", [">= 4.2.1"])
21
+
22
+ # Additional dependencies
23
+ # s.add_runtime_dependency("gem-name", "gem-version")
24
+ end
@@ -0,0 +1,3 @@
1
+ activate :hotjar do |hj|
2
+ hj.hjid = '123'
3
+ end
@@ -0,0 +1 @@
1
+ <%= hotjar_tag %>
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-hotjar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kieran Hunt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: middleman-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.1
27
+ description:
28
+ email:
29
+ - kieran.hunt92@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - Rakefile
37
+ - features/hotjar.feature
38
+ - features/support/env.rb
39
+ - fixtures/basic-app/config.rb
40
+ - fixtures/basic-app/source/hotjar.html.erb
41
+ - lib/middleman-hotjar.rb
42
+ - lib/middleman-hotjar/extension.rb
43
+ - middleman-hotjar.gemspec
44
+ - tmp/aruba/basic-app/config.rb
45
+ - tmp/aruba/basic-app/source/hotjar.html.erb
46
+ homepage: http://github.com/KieranHunt/middleman-hotjar
47
+ licenses: []
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubyforge_project:
65
+ rubygems_version: 2.6.11
66
+ signing_key:
67
+ specification_version: 4
68
+ summary: Add Hotjar analytics to your middleman site
69
+ test_files:
70
+ - features/hotjar.feature
71
+ - features/support/env.rb