garails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,3 +3,9 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in garails.gemspec
4
4
  gemspec
5
5
 
6
+ gem "rails", "~> 3.0.3"
7
+
8
+ group :test do
9
+ gem 'shoulda'
10
+ end
11
+
data/Gemfile.lock CHANGED
@@ -1,20 +1,83 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- garails (0.0.1)
5
- gabbara (~> 0.0.2)
4
+ garails (0.0.3)
5
+ gabbara (~> 0.0.4)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
+ abstract (1.0.0)
11
+ actionmailer (3.0.3)
12
+ actionpack (= 3.0.3)
13
+ mail (~> 2.2.9)
14
+ actionpack (3.0.3)
15
+ activemodel (= 3.0.3)
16
+ activesupport (= 3.0.3)
17
+ builder (~> 2.1.2)
18
+ erubis (~> 2.6.6)
19
+ i18n (~> 0.4)
20
+ rack (~> 1.2.1)
21
+ rack-mount (~> 0.6.13)
22
+ rack-test (~> 0.5.6)
23
+ tzinfo (~> 0.3.23)
24
+ activemodel (3.0.3)
25
+ activesupport (= 3.0.3)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.4)
28
+ activerecord (3.0.3)
29
+ activemodel (= 3.0.3)
30
+ activesupport (= 3.0.3)
31
+ arel (~> 2.0.2)
32
+ tzinfo (~> 0.3.23)
33
+ activeresource (3.0.3)
34
+ activemodel (= 3.0.3)
35
+ activesupport (= 3.0.3)
10
36
  activesupport (3.0.3)
11
- gabbara (0.0.2)
37
+ arel (2.0.6)
38
+ builder (2.1.2)
39
+ erubis (2.6.6)
40
+ abstract (>= 1.0.0)
41
+ gabbara (0.0.4)
12
42
  activesupport
43
+ i18n (0.5.0)
44
+ mail (2.2.12)
45
+ activesupport (>= 2.3.6)
46
+ i18n (>= 0.4.0)
47
+ mime-types (~> 1.16)
48
+ treetop (~> 1.4.8)
49
+ mime-types (1.16)
50
+ polyglot (0.3.1)
51
+ rack (1.2.1)
52
+ rack-mount (0.6.13)
53
+ rack (>= 1.0.0)
54
+ rack-test (0.5.6)
55
+ rack (>= 1.0)
56
+ rails (3.0.3)
57
+ actionmailer (= 3.0.3)
58
+ actionpack (= 3.0.3)
59
+ activerecord (= 3.0.3)
60
+ activeresource (= 3.0.3)
61
+ activesupport (= 3.0.3)
62
+ bundler (~> 1.0)
63
+ railties (= 3.0.3)
64
+ railties (3.0.3)
65
+ actionpack (= 3.0.3)
66
+ activesupport (= 3.0.3)
67
+ rake (>= 0.8.7)
68
+ thor (~> 0.14.4)
69
+ rake (0.8.7)
70
+ shoulda (2.11.3)
71
+ thor (0.14.6)
72
+ treetop (1.4.9)
73
+ polyglot (>= 0.3.1)
74
+ tzinfo (0.3.23)
13
75
 
14
76
  PLATFORMS
15
77
  ruby
16
78
 
17
79
  DEPENDENCIES
18
- activesupport
19
- gabbara (~> 0.0.2)
80
+ gabbara (~> 0.0.4)
20
81
  garails!
82
+ rails (~> 3.0.3)
83
+ shoulda
data/README.rdoc CHANGED
@@ -44,3 +44,9 @@ In your layout for mobile handsets without Javascript support, add at the very b
44
44
 
45
45
  === programmatically
46
46
 
47
+ In your view or controller you can record events by using:
48
+
49
+ ga_event(category, action, label, value)
50
+
51
+ See http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html for details. label and value are optional.
52
+
@@ -0,0 +1,7 @@
1
+ module Garails::EventHelper
2
+ def ga_event(category, action, label = nil, value = nil)
3
+ return unless Garails.ga_setup?
4
+ g = Garails.gabba(request)
5
+ g.event(category, action, label, value)
6
+ end
7
+ end
data/garails.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency("gabbara", "~> 0.0.2")
20
+ s.add_dependency("gabbara", "~> 0.0.4")
21
21
  end
@@ -1,9 +1,10 @@
1
- require "rails"
2
-
3
1
  module Garails
4
2
  class Engine < ::Rails::Engine
5
- initializer 'garails.mobile.helper' do |app|
6
- ActionController::Base.helper Garails::MobileHelper, Garails::JavascriptHelper
3
+ initializer 'garails.view.helper' do |app|
4
+ ActionController::Base.helper Garails::MobileHelper, Garails::JavascriptHelper, Garails::EventHelper
5
+ end
6
+ initializer 'garails.controller.helper' do |app|
7
+ ActionController::Base.send :include, Garails::EventHelper
7
8
  end
8
9
  end
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Garails
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
data/lib/garails.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'gabbara'
2
+
1
3
  module Garails
2
4
 
3
5
  # account identifier as issued by google analytics
@@ -33,7 +35,7 @@ module Garails
33
35
 
34
36
  def self.create_gabba(account, request, opts = {})
35
37
  opts = opts.reverse_merge(:request => request, :logger => Rails.logger)
36
- Gabbara::Gabba.new(account, Garails.ga_hostname, opts)
38
+ ::Gabbara::Gabba.new(account, Garails.ga_hostname, opts)
37
39
  end
38
40
  end
39
41
 
@@ -0,0 +1,21 @@
1
+ require 'test_helper'
2
+
3
+ class GoogleAnalyticsControllerTest < ActionController::TestCase
4
+ tests Garails::GoogleAnalyticsController
5
+
6
+ context "GET to :utm" do
7
+ setup { get :utm, :format => :gif }
8
+ should respond_with :success
9
+ should assign_to(:visitor_id)
10
+ end
11
+
12
+ context "GET to :utm with guid" do
13
+ setup do
14
+ request.env["HTTP_X_DCMGUID"] = "blah"
15
+ get :utm, :format => :gif
16
+ end
17
+ should respond_with :success
18
+ should assign_to(:visitor_id)
19
+ end
20
+
21
+ end
@@ -0,0 +1,3 @@
1
+ log/*.log
2
+ tmp/**/*
3
+ *~
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TestApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,13 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require "action_controller/railtie"
4
+ require "rails/test_unit/railtie"
5
+
6
+ Bundler.require :default, :test
7
+
8
+ module TestApp
9
+ class Application < Rails::Application
10
+ config.encoding = "utf-8"
11
+ config.filter_parameters += [:password]
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ Bundler.setup
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ TestApp::Application.initialize!
@@ -0,0 +1,30 @@
1
+ TestApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
24
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
25
+ # like if you have constraints or database-specific column types
26
+ # config.active_record.schema_format = :sql
27
+
28
+ # Print deprecation notices to the stderr
29
+ config.active_support.deprecation = :stderr
30
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ TestApp::Application.config.secret_token = '50053f3c1b13b80ea9ef92a92fe29c47dbe487827d65f9bf20a55b05cbc3d7c5b934a6dddb93b6860867c48ad40f3259fa573e22b362e6605de501ef42f1aced'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ TestApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # TestApp::Application.config.session_store :active_record_store
@@ -0,0 +1,2 @@
1
+ TestApp::Application.routes.draw do
2
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run TestApp::Application
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
+ # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
24
+ </div>
25
+ </body>
26
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,6 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ $:.unshift File.dirname(__FILE__)
3
+
4
+ require 'test_app/config/environment'
5
+ require 'rails/test_help'
6
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Reinsch
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-21 00:00:00 +09:00
18
+ date: 2010-12-27 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- hash: 27
29
+ hash: 23
30
30
  segments:
31
31
  - 0
32
32
  - 0
33
- - 2
34
- version: 0.0.2
33
+ - 4
34
+ version: 0.0.4
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
37
  description: Google Analytics for Rails
@@ -48,6 +48,7 @@ files:
48
48
  - README.rdoc
49
49
  - Rakefile
50
50
  - app/controllers/garails/google_analytics_controller.rb
51
+ - app/helpers/garails/event_helper.rb
51
52
  - app/helpers/garails/javascript_helper.rb
52
53
  - app/helpers/garails/mobile_helper.rb
53
54
  - app/views/garails/google_analytics.html.erb
@@ -57,6 +58,30 @@ files:
57
58
  - lib/garails.rb
58
59
  - lib/garails/engine.rb
59
60
  - lib/garails/version.rb
61
+ - test/controllers/google_analytics_controller_test.rb
62
+ - test/test_app/.gitignore
63
+ - test/test_app/app/controllers/application_controller.rb
64
+ - test/test_app/app/helpers/application_helper.rb
65
+ - test/test_app/app/views/layouts/application.html.erb
66
+ - test/test_app/config.ru
67
+ - test/test_app/config/application.rb
68
+ - test/test_app/config/boot.rb
69
+ - test/test_app/config/database.yml
70
+ - test/test_app/config/environment.rb
71
+ - test/test_app/config/environments/test.rb
72
+ - test/test_app/config/initializers/backtrace_silencers.rb
73
+ - test/test_app/config/initializers/inflections.rb
74
+ - test/test_app/config/initializers/mime_types.rb
75
+ - test/test_app/config/initializers/secret_token.rb
76
+ - test/test_app/config/initializers/session_store.rb
77
+ - test/test_app/config/routes.rb
78
+ - test/test_app/db/seeds.rb
79
+ - test/test_app/public/404.html
80
+ - test/test_app/public/422.html
81
+ - test/test_app/public/500.html
82
+ - test/test_app/public/favicon.ico
83
+ - test/test_app/script/rails
84
+ - test/test_helper.rb
60
85
  has_rdoc: true
61
86
  homepage: http://github.com/mreinsch/garails
62
87
  licenses: []