gxapi_rails 0.0.2
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 +7 -0
- data/LICENSE.txt +20 -0
- data/README.md +161 -0
- data/Rakefile +25 -0
- data/app/helpers/gxapi_helper.rb +108 -0
- data/lib/gxapi.rb +160 -0
- data/lib/gxapi/base.rb +100 -0
- data/lib/gxapi/controller_methods.rb +41 -0
- data/lib/gxapi/engine.rb +14 -0
- data/lib/gxapi/google_analytics.rb +193 -0
- data/lib/gxapi/ostruct.rb +86 -0
- data/lib/gxapi/version.rb +3 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/posts_controller.rb +11 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/posts_helper.rb +2 -0
- data/spec/dummy/app/models/post.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/posts/_form.html.erb +25 -0
- data/spec/dummy/app/views/posts/edit.html.erb +6 -0
- data/spec/dummy/app/views/posts/index.html.erb +36 -0
- data/spec/dummy/app/views/posts/new.html.erb +5 -0
- data/spec/dummy/app/views/posts/show.html.erb +15 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +70 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/database.yml.default +111 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +38 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/gxapi.yml +17 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/konfig/application.rb +16 -0
- data/spec/dummy/config/konfig/development.rb +10 -0
- data/spec/dummy/config/konfig/production.rb +3 -0
- data/spec/dummy/config/konfig/test.rb +3 -0
- data/spec/dummy/config/konfig/test_prod.rb +3 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/test.p12 +0 -0
- data/spec/dummy/data/log/dummy/development.log +113 -0
- data/spec/dummy/data/log/dummy/test.log +927 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +1443 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/features/display_variant_js_spec.rb +34 -0
- data/spec/helpers/gxapi_helper_spec.rb +63 -0
- data/spec/lib/gxapi/base_spec.rb +80 -0
- data/spec/lib/gxapi/google_analytics_spec.rb +70 -0
- data/spec/lib/gxapi_spec.rb +32 -0
- data/spec/spec_helper.rb +32 -0
- metadata +233 -0
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= form_for(@post) do |f| %>
|
2
|
+
<% if @post.errors.any? %>
|
3
|
+
<div id="error_explanation">
|
4
|
+
<h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
5
|
+
|
6
|
+
<ul>
|
7
|
+
<% @post.errors.full_messages.each do |msg| %>
|
8
|
+
<li><%= msg %></li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<div class="field">
|
15
|
+
<%= f.label :title %><br />
|
16
|
+
<%= f.text_field :title %>
|
17
|
+
</div>
|
18
|
+
<div class="field">
|
19
|
+
<%= f.label :body %><br />
|
20
|
+
<%= f.text_area :body %>
|
21
|
+
</div>
|
22
|
+
<div class="actions">
|
23
|
+
<%= f.submit %>
|
24
|
+
</div>
|
25
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<h1>Listing posts</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Body</th>
|
7
|
+
<th></th>
|
8
|
+
<th></th>
|
9
|
+
<th></th>
|
10
|
+
</tr>
|
11
|
+
|
12
|
+
<% if @posts.present? %>
|
13
|
+
<% @posts.each do |post| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= post.title %></td>
|
16
|
+
<td><%= post.body %></td>
|
17
|
+
<td><%= link_to 'Show', post %></td>
|
18
|
+
<td><%= link_to 'Edit', edit_post_path(post) %></td>
|
19
|
+
<td><%= link_to 'Destroy', post, :data => {:confirm => 'Are you sure?'}, :method => :delete %></td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
<% end -%>
|
23
|
+
</table>
|
24
|
+
|
25
|
+
<br />
|
26
|
+
|
27
|
+
<%= link_to 'New Post', new_post_path %>
|
28
|
+
|
29
|
+
<% if gxapi_variant_name == 'fake_var' -%>
|
30
|
+
<h3>Fake Var Version</h3>
|
31
|
+
<% end -%>
|
32
|
+
|
33
|
+
|
34
|
+
<%= gxapi_experiment_js %>
|
35
|
+
|
36
|
+
<%= gxapi_experiment_js(:test) %>
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "active_resource/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
# require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require(:default, :assets, Rails.env)
|
12
|
+
require "gxapi"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Enable escaping HTML in JSON.
|
45
|
+
config.active_support.escape_html_entities_in_json = true
|
46
|
+
|
47
|
+
# Use SQL instead of Active Record's schema dumper when creating the database.
|
48
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
49
|
+
# like if you have constraints or database-specific column types
|
50
|
+
# config.active_record.schema_format = :sql
|
51
|
+
|
52
|
+
# Enforce whitelist mode for mass assignment.
|
53
|
+
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
54
|
+
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
55
|
+
# parameters by using an attr_accessible or attr_protected declaration.
|
56
|
+
config.active_record.whitelist_attributes = true
|
57
|
+
|
58
|
+
# Enable the asset pipeline
|
59
|
+
config.assets.enabled = true
|
60
|
+
|
61
|
+
# Version of your assets, change this if you want to expire all your assets
|
62
|
+
config.assets.version = '1.0'
|
63
|
+
|
64
|
+
config.after_initialize do
|
65
|
+
ActionController::Base.asset_host = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
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,111 @@
|
|
1
|
+
# common to all environments
|
2
|
+
default: &default
|
3
|
+
adapter: mysql2
|
4
|
+
port: 3306
|
5
|
+
host: localhost
|
6
|
+
database: lb_development
|
7
|
+
username: root
|
8
|
+
password:
|
9
|
+
reconnect: true
|
10
|
+
|
11
|
+
# dev
|
12
|
+
development: &development
|
13
|
+
<<: *default
|
14
|
+
# host: localhost
|
15
|
+
# #username: lifebooker_prod
|
16
|
+
# #password: lbcup45_p
|
17
|
+
# database: lb_development
|
18
|
+
# # delayed_jobs:
|
19
|
+
# # <<: *default
|
20
|
+
# # host: localhost
|
21
|
+
# # username: lifebooker_prod
|
22
|
+
# # password: lbcup45_p
|
23
|
+
# # database: delayed_jobs
|
24
|
+
|
25
|
+
host: 174.129.253.40
|
26
|
+
username: lifebooker
|
27
|
+
password: 725014d3a774e7c91f243b6df352c15
|
28
|
+
database: lb_production
|
29
|
+
delayed_jobs:
|
30
|
+
<<: *default
|
31
|
+
host: ec2-107-22-92-104.compute-1.amazonaws.com
|
32
|
+
username: lifebooker
|
33
|
+
password: 725014d3a774e7c91f243b6df352c15
|
34
|
+
database: loot_scores_delayed_jobs
|
35
|
+
|
36
|
+
# staging
|
37
|
+
staging:
|
38
|
+
<<: *default
|
39
|
+
host: 10.82.6.113
|
40
|
+
username: lifebooker
|
41
|
+
password: 725014d3a774e7c91f243b6df352c15
|
42
|
+
database: lb_production
|
43
|
+
delayed_jobs:
|
44
|
+
<<: *default
|
45
|
+
host: ec2-107-22-92-104.compute-1.amazonaws.com
|
46
|
+
username: lifebooker
|
47
|
+
password: 725014d3a774e7c91f243b6df352c15
|
48
|
+
database: loot_scores_delayed_jobs
|
49
|
+
|
50
|
+
# dev ie6
|
51
|
+
ie6:
|
52
|
+
<<: *default
|
53
|
+
host: ec2-184-73-53-30.compute-1.amazonaws.com
|
54
|
+
username: lifebooker_prod
|
55
|
+
password: lbcup45_p
|
56
|
+
database: lb_production
|
57
|
+
|
58
|
+
|
59
|
+
test:
|
60
|
+
<<: *default
|
61
|
+
host: localhost
|
62
|
+
username: root
|
63
|
+
password:
|
64
|
+
database: lb_test
|
65
|
+
delayed_jobs:
|
66
|
+
<<: *default
|
67
|
+
host: localhost
|
68
|
+
username: root
|
69
|
+
password:
|
70
|
+
database: lb_test
|
71
|
+
loot_scores:
|
72
|
+
<<: *default
|
73
|
+
host: localhost
|
74
|
+
username: root
|
75
|
+
password:
|
76
|
+
database: lb_test
|
77
|
+
|
78
|
+
# prod credentials
|
79
|
+
default_prod: &default_prod
|
80
|
+
<<: *default
|
81
|
+
host: 10.87.155.110
|
82
|
+
username: lifebooker
|
83
|
+
password: 725014d3a774e7c91f243b6df352c15
|
84
|
+
database: lb_production
|
85
|
+
delayed_jobs:
|
86
|
+
<<: *default
|
87
|
+
host: 10.38.55.125
|
88
|
+
username: lifebooker
|
89
|
+
password: 725014d3a774e7c91f243b6df352c15
|
90
|
+
database: delayed_jobs
|
91
|
+
|
92
|
+
default_slave: &default_slave
|
93
|
+
<<: *default
|
94
|
+
username: lifebooker
|
95
|
+
password: 725014d3a774e7c91f243b6df352c15
|
96
|
+
database: lb_production
|
97
|
+
host: 10.120.21.13
|
98
|
+
|
99
|
+
# production with replication
|
100
|
+
production:
|
101
|
+
<<: *default_prod
|
102
|
+
slave_database:
|
103
|
+
<<: *default_slave
|
104
|
+
|
105
|
+
# same as prod, but without a slave database
|
106
|
+
production_master:
|
107
|
+
<<: *default_prod
|
108
|
+
|
109
|
+
# same as prod but with only the slave db
|
110
|
+
production_slave:
|
111
|
+
<<: *default_slave
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Raise exception on mass assignment protection for Active Record models
|
26
|
+
config.active_record.mass_assignment_sanitizer = :strict
|
27
|
+
|
28
|
+
# Log the query plan for queries taking more than this (works
|
29
|
+
# with SQLite, MySQL, and PostgreSQL)
|
30
|
+
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
31
|
+
|
32
|
+
# Do not compress assets
|
33
|
+
config.assets.compress = false
|
34
|
+
|
35
|
+
# Expands the lines which load the assets
|
36
|
+
config.assets.debug = true
|
37
|
+
|
38
|
+
end
|