middleman-application-insights 1.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 88f0a524e7fb338cf1ce3e335476112c1e24ff9f
4
+ data.tar.gz: ee6ced393849eff2c7cf0a7c119a96b1c0adc797
5
+ SHA512:
6
+ metadata.gz: c2df255fae68ec0d303b6b0a75cd52e3564cc9eb280e4771256587bb1f166c6a5f1871416496f80a48a733f289cdd2a552d3e6599a6a04d630da081983f4ce57
7
+ data.tar.gz: 469fa7dd325fdfad5f61cd4a9638f549ca787098191baaf5546be791e60e87472cd229c8ab330a15d77d16d05b1fd5fd55c5df408478b798ecd38b04051dd573
@@ -0,0 +1,29 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Documentation cache and generated files:
13
+ /.yardoc/
14
+ /_yardoc/
15
+ /doc/
16
+ /rdoc/
17
+
18
+ ## Environment normalisation:
19
+ /.bundle/
20
+ /lib/bundler/man/
21
+
22
+ # for a library or gem, you might want to ignore these files since the code is
23
+ # intended to run in multiple environments; otherwise, check them in:
24
+ Gemfile.lock
25
+ .ruby-version
26
+ .ruby-gemset
27
+
28
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
29
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,17 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in middleman-application-insights.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'rake'
8
+ gem 'rdoc'
9
+ gem 'yard'
10
+ end
11
+
12
+ group :test do
13
+ gem 'cucumber'
14
+ gem 'fivemat'
15
+ gem 'aruba'
16
+ gem 'rspec'
17
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Bowstreet GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -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 ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}"
8
+ end
9
+
10
+ require 'rake/clean'
11
+
12
+ task test: :cucumber
13
+ task default: :test
@@ -0,0 +1,4 @@
1
+ PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require 'middleman-core'
3
+ require 'middleman-core/step_definitions'
4
+ require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-application-insights')
@@ -0,0 +1,7 @@
1
+ require 'middleman-core'
2
+ require 'middleman-application-insights/version'
3
+
4
+ ::Middleman::Extensions.register(:application_insights) do
5
+ require 'middleman-application-insights/extension'
6
+ ::Middleman::ApplicationInsightsExtension
7
+ end
@@ -0,0 +1,8 @@
1
+ var appInsights=window.appInsights||function(config){
2
+ function s(config){t[config]=function(){var i=arguments;t.queue.push(function(){t[config].apply(t,i)})}}var t={config:config},r=document,f=window,e="script",o=r.createElement(e),i,u;for(o.src=config.url||"//az416426.vo.msecnd.net/scripts/a/ai.0.js",r.getElementsByTagName(e)[0].parentNode.appendChild(o),t.cookie=r.cookie,t.queue=[],i=["Event","Exception","Metric","PageView","Trace"];i.length;)s("track"+i.pop());return config.disableExceptionTracking||(i="onerror",s("_"+i),u=f[i],f[i]=function(config,r,f,e,o){var s=u&&u(config,r,f,e,o);return s!==!0&&t["_"+i](config,r,f,e,o),s}),t
3
+ }({
4
+ instrumentationKey:"<%= @options.instrumentation_key %>"
5
+ });
6
+
7
+ window.appInsights=appInsights;
8
+ appInsights.trackPageView();
@@ -0,0 +1,32 @@
1
+ require 'middleman-application-insights/helpers'
2
+
3
+ module Middleman
4
+ class ApplicationInsightsExtension < Extension
5
+ option :instrumentation_key, nil, 'Instrumentation Key'
6
+ option :development, true, 'Add tracking in development environment'
7
+
8
+ def initialize(app, options_hash={}, &block)
9
+ super
10
+
11
+ app.set :application_insights_settings, options
12
+ end
13
+
14
+ def after_configuration
15
+ unless options.instrumentation_key
16
+ $stderr.puts 'Application Insights: Please specify an instrumentation key'
17
+ raise 'No instrumentation key given' if display_message?
18
+ end
19
+ end
20
+
21
+ helpers do
22
+ include ::Middleman::ApplicationInsights::Helpers
23
+ end
24
+
25
+ private
26
+
27
+ def display_message?
28
+ app.build? || app.development? && options.development
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,22 @@
1
+ module Middleman
2
+ module ApplicationInsights
3
+ module Helpers
4
+
5
+ def application_insights_tag
6
+ render_script('applicationinsights.js.erb')
7
+ end
8
+
9
+ private
10
+
11
+ def render_script(template)
12
+ return nil if development? && !application_insights_settings.development
13
+
14
+ @options = application_insights_settings
15
+ file = File.join(File.dirname(__FILE__), template)
16
+ content = ERB.new(File.read(file)).result(binding)
17
+ content_tag(:script, content, type: 'text/javascript')
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module Middleman
2
+ module ApplicationInsights
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "middleman-application-insights/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "middleman-application-insights"
7
+ s.version = Middleman::ApplicationInsights::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Matthias Wenz"]
10
+ s.homepage = "https://bowstreet.de"
11
+ s.summary = "A Middleman plugin for Application Insights tracking."
12
+ s.description = "..."
13
+ s.license = "MIT"
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.required_ruby_version = '>= 1.9.3'
21
+ s.add_runtime_dependency("middleman-core", ["~> 3.2"])
22
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: middleman-application-insights
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthias Wenz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-06-15 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: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ description: "..."
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".gitignore"
34
+ - Gemfile
35
+ - LICENSE
36
+ - Rakefile
37
+ - features/support/env.rb
38
+ - lib/middleman-application-insights.rb
39
+ - lib/middleman-application-insights/applicationinsights.js.erb
40
+ - lib/middleman-application-insights/extension.rb
41
+ - lib/middleman-application-insights/helpers.rb
42
+ - lib/middleman-application-insights/version.rb
43
+ - middleman-application-insights.gemspec
44
+ homepage: https://bowstreet.de
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 1.9.3
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.4.6
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: A Middleman plugin for Application Insights tracking.
68
+ test_files:
69
+ - features/support/env.rb
70
+ has_rdoc: