gauges-rails 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.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright 2011 Jason Coene
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,36 @@
1
+ # Gauges-rails
2
+
3
+ Easily (and neatly) add Gaug.es to your Rails 3 application!
4
+
5
+ ## Installation
6
+
7
+ **First, add gauges-rails to your Gemfile:**
8
+
9
+ gem 'gauges-rails'
10
+
11
+ **Next, set your Gaug.es site id in your config/application.rb file:**
12
+
13
+ # Set our Gaug.es site id
14
+ config.gauges.site_id = 'YOUR_SITE_ID_HERE'
15
+
16
+ You can obtain the site id from your Gaug.es dashboard. It should resemble an MD5 hash.
17
+
18
+ **Finally, include the tracking code in one of your views.**
19
+
20
+ You can do this in a layout file (typically app/views/layouts/application.html.erb), or on a per-view basis (such as in app/views/dingdongs/index.html.erb). Insert the code as follows:
21
+
22
+ <%= gauges_tracking_code %>
23
+
24
+ *Gauges-rails should work fine with any view template engine. For instancing, HAML users will want to use:*
25
+
26
+ = gauges_tracking_code
27
+
28
+ ## Customization
29
+
30
+ ### Using more than one site id
31
+
32
+ You can pass a hash of arguments to the *gauges_tracking_code* helper method. Example:
33
+
34
+ <%= gauges_tracking_code :site_id => 'MY_CUSTOM_SITE_ID_HERE' %>
35
+
36
+ That's all for now, folks!
@@ -0,0 +1,34 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ begin
4
+ require 'bundler/setup'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
8
+
9
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
10
+ require 'gauges/rails/version'
11
+
12
+ require 'rake'
13
+
14
+ require 'rspec/core'
15
+ require 'rspec/core/rake_task'
16
+
17
+ RSpec::Core::RakeTask.new(:spec)
18
+
19
+ task :build do
20
+ system "gem build gauges-rails.gemspec"
21
+ end
22
+
23
+ task :install => :build do
24
+ system "gem install gauges-rails-#{Gauges::Rails::VERSION}.gem"
25
+ end
26
+
27
+ task :release => :build do
28
+ system "git tag -a #{Gauges::Rails::VERSION} -m 'Tagging #{Gauges::Rails::VERSION}'"
29
+ system "git push --tags"
30
+ system "gem push gauges-rails-#{Gauges::Rails::VERSION}.gem"
31
+ system "rm gauges-rails-#{Gauges::Rails::VERSION}.gem"
32
+ end
33
+
34
+ task :default => :spec
@@ -0,0 +1 @@
1
+ require 'gauges/rails'
@@ -0,0 +1 @@
1
+ require 'gauges/rails/railtie' if defined?(Rails)
@@ -0,0 +1,15 @@
1
+ module Gauges
2
+ module Rails
3
+ module Helper
4
+ def gauges_tracking_code(options={})
5
+ options[:site_id] = ::Rails.application.config.gauges.site_id unless options.key?(:site_id)
6
+ if options[:site_id].nil?
7
+ raise "Please set a Gaug.es site ID in your application configuration or as an argument to gauges_tracking_code, example: gauges_tracking_code(:site_id => '12345')"
8
+ else
9
+ "<script type=\"text/javascript\"> var _gauges = _gauges || []; (function() { var t = document.createElement('script'); t.type = 'text/javascript'; t.async = true; t.id = 'gauges-tracker'; t.setAttribute('data-site-id', '#{options[:site_id]}'); t.src = '//secure.gaug.es/track.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(t, s); })(); </script>".html_safe
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,19 @@
1
+ require 'rails/railtie'
2
+ require 'gauges/rails/helper'
3
+
4
+ module Gauges
5
+ module Rails
6
+ class Railtie < ::Rails::Railtie
7
+
8
+ config.gauges = ActiveSupport::OrderedOptions.new
9
+ config.gauges.site_id = nil
10
+
11
+ initializer :setup_gauges_rails do |app|
12
+ ActiveSupport.on_load(:action_view) do
13
+ include Gauges::Rails::Helper
14
+ end
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,5 @@
1
+ module Gauges
2
+ module Rails
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gauges-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jason Coene
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-08-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70180790271600 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0.rc
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70180790271600
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec-rails
27
+ requirement: &70180790269660 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 2.6.1
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70180790269660
36
+ - !ruby/object:Gem::Dependency
37
+ name: capybara
38
+ requirement: &70180790267680 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.1
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70180790267680
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3
49
+ requirement: &70180790256520 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.4
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70180790256520
58
+ - !ruby/object:Gem::Dependency
59
+ name: launchy
60
+ requirement: &70180790255000 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 2.0.5
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70180790255000
69
+ description: Simple helper to add Gaug.es support to your Rails application.
70
+ email:
71
+ - jcoene@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - lib/gauges/rails/helper.rb
77
+ - lib/gauges/rails/railtie.rb
78
+ - lib/gauges/rails/version.rb
79
+ - lib/gauges/rails.rb
80
+ - lib/gauges-rails.rb
81
+ - MIT-LICENSE
82
+ - Rakefile
83
+ - Gemfile
84
+ - README.md
85
+ homepage: http://github.com/jcoene/gauges-rails
86
+ licenses: []
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ none: false
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ segments:
98
+ - 0
99
+ hash: -3602843286404034390
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ none: false
102
+ requirements:
103
+ - - ! '>='
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ segments:
107
+ - 0
108
+ hash: -3602843286404034390
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 1.8.6
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: Use Gaug.es with your Rails app.
115
+ test_files: []