Add gem ahoy_matey and some dependencies

This commit is contained in:
Eloy Gomez
2015-08-08 12:05:55 +02:00
parent 90a3dcdc16
commit aaeb77d969
8 changed files with 163 additions and 7 deletions

View File

@@ -32,6 +32,10 @@ gem 'acts_as_votable'
gem "recaptcha", require: "recaptcha/rails" gem "recaptcha", require: "recaptcha/rails"
gem 'ckeditor' gem 'ckeditor'
gem 'ahoy_matey' # stats
gem "chartkick" # charts
gem 'groupdate' # group temporary data
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug' gem 'byebug'
@@ -62,4 +66,3 @@ end
group :test do group :test do
gem 'email_spec' gem 'email_spec'
end end

View File

@@ -44,12 +44,23 @@ GEM
awesome_nested_set (>= 3.0) awesome_nested_set (>= 3.0)
acts_as_votable (0.10.0) acts_as_votable (0.10.0)
addressable (2.3.8) addressable (2.3.8)
ahoy_matey (1.2.0)
addressable
browser (>= 0.4.0)
errbase
geocoder
rails
referer-parser (>= 0.3.0)
request_store
user_agent_parser
uuidtools
arel (6.0.2) arel (6.0.2)
awesome_nested_set (3.0.2) awesome_nested_set (3.0.2)
activerecord (>= 4.0.0, < 5) activerecord (>= 4.0.0, < 5)
bcrypt (3.1.10) bcrypt (3.1.10)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
browser (0.9.1)
builder (3.2.2) builder (3.2.2)
byebug (5.0.0) byebug (5.0.0)
columnize (= 0.9.0) columnize (= 0.9.0)
@@ -74,6 +85,7 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
chartkick (1.3.2)
ckeditor (4.1.2) ckeditor (4.1.2)
cocaine cocaine
orm_adapter (~> 0.5.0) orm_adapter (~> 0.5.0)
@@ -117,6 +129,7 @@ GEM
email_spec (1.6.0) email_spec (1.6.0)
launchy (~> 2.1) launchy (~> 2.1)
mail (~> 2.2) mail (~> 2.2)
errbase (0.0.3)
erubis (2.7.0) erubis (2.7.0)
execjs (2.5.2) execjs (2.5.2)
factory_girl (4.5.0) factory_girl (4.5.0)
@@ -127,8 +140,11 @@ GEM
foundation-rails (5.5.2.1) foundation-rails (5.5.2.1)
railties (>= 3.1.0) railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5) sass (>= 3.3.0, < 3.5)
geocoder (1.2.9)
globalid (0.3.5) globalid (0.3.5)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
groupdate (2.4.0)
activesupport (>= 3)
highline (1.7.3) highline (1.7.3)
http-cookie (1.0.2) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
@@ -209,6 +225,8 @@ GEM
rake (10.4.2) rake (10.4.2)
rdoc (4.2.0) rdoc (4.2.0)
recaptcha (0.4.0) recaptcha (0.4.0)
referer-parser (0.3.0)
request_store (1.2.0)
responders (2.1.0) responders (2.1.0)
railties (>= 4.2.0, < 5) railties (>= 4.2.0, < 5)
rest-client (1.8.0) rest-client (1.8.0)
@@ -276,6 +294,8 @@ GEM
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.1) unf_ext (0.0.7.1)
user_agent_parser (2.2.0)
uuidtools (2.1.5)
warden (1.2.3) warden (1.2.3)
rack (>= 1.0) rack (>= 1.0)
web-console (2.2.1) web-console (2.2.1)
@@ -296,6 +316,7 @@ DEPENDENCIES
acts-as-taggable-on acts-as-taggable-on
acts_as_commentable_with_threading acts_as_commentable_with_threading
acts_as_votable acts_as_votable
ahoy_matey
byebug byebug
capistrano (= 3.4.0) capistrano (= 3.4.0)
capistrano-bundler (= 1.1.4) capistrano-bundler (= 1.1.4)
@@ -303,6 +324,7 @@ DEPENDENCIES
capistrano-rails (= 1.1.3) capistrano-rails (= 1.1.3)
capistrano-rvm capistrano-rvm
capybara capybara
chartkick
ckeditor ckeditor
coffee-rails (~> 4.1.0) coffee-rails (~> 4.1.0)
coveralls coveralls
@@ -311,6 +333,7 @@ DEPENDENCIES
email_spec email_spec
factory_girl_rails factory_girl_rails
foundation-rails foundation-rails
groupdate
i18n-tasks i18n-tasks
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails

View File

@@ -15,6 +15,7 @@
//= require foundation //= require foundation
//= require turbolinks //= require turbolinks
//= require ckeditor/init //= require ckeditor/init
//= require ahoy
//= require app //= require app
//= require_tree . //= require_tree .

8
app/models/ahoy/event.rb Normal file
View File

@@ -0,0 +1,8 @@
module Ahoy
class Event < ActiveRecord::Base
self.table_name = "ahoy_events"
belongs_to :visit
belongs_to :user
end
end

View File

@@ -0,0 +1,3 @@
class Ahoy::Store < Ahoy::Stores::ActiveRecordStore
# customize here
end

View File

@@ -0,0 +1,56 @@
class CreateVisits < ActiveRecord::Migration
def change
create_table :visits, id: false do |t|
t.uuid :id, default: nil, primary_key: true
t.uuid :visitor_id, default: nil
# the rest are recommended but optional
# simply remove the columns you don't want
# standard
t.string :ip
t.text :user_agent
t.text :referrer
t.text :landing_page
# user
t.integer :user_id
# add t.string :user_type if polymorphic
# traffic source
t.string :referring_domain
t.string :search_keyword
# technology
t.string :browser
t.string :os
t.string :device_type
t.integer :screen_height
t.integer :screen_width
# location
t.string :country
t.string :region
t.string :city
t.string :postal_code
t.decimal :latitude
t.decimal :longitude
# utm parameters
t.string :utm_source
t.string :utm_medium
t.string :utm_term
t.string :utm_content
t.string :utm_campaign
# native apps
# t.string :platform
# t.string :app_version
# t.string :os_version
t.timestamp :started_at
end
add_index :visits, [:user_id]
end
end

View File

@@ -0,0 +1,20 @@
class CreateAhoyEvents < ActiveRecord::Migration
def change
create_table :ahoy_events, id: false do |t|
t.uuid :id, default: nil, primary_key: true
t.uuid :visit_id, default: nil
# user
t.integer :user_id
# add t.string :user_type if polymorphic
t.string :name
t.jsonb :properties
t.timestamp :time
end
add_index :ahoy_events, [:visit_id]
add_index :ahoy_events, [:user_id]
add_index :ahoy_events, [:time]
end
end

View File

@@ -16,6 +16,18 @@ ActiveRecord::Schema.define(version: 20150806163142) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
create_table "ahoy_events", id: :uuid, default: nil, force: :cascade do |t|
t.uuid "visit_id"
t.integer "user_id"
t.string "name"
t.jsonb "properties"
t.datetime "time"
end
add_index "ahoy_events", ["time"], name: "index_ahoy_events_on_time", using: :btree
add_index "ahoy_events", ["user_id"], name: "index_ahoy_events_on_user_id", using: :btree
add_index "ahoy_events", ["visit_id"], name: "index_ahoy_events_on_visit_id", using: :btree
create_table "comments", force: :cascade do |t| create_table "comments", force: :cascade do |t|
t.integer "commentable_id" t.integer "commentable_id"
t.string "commentable_type" t.string "commentable_type"
@@ -90,6 +102,36 @@ ActiveRecord::Schema.define(version: 20150806163142) do
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
create_table "visits", id: :uuid, default: nil, force: :cascade do |t|
t.uuid "visitor_id"
t.string "ip"
t.text "user_agent"
t.text "referrer"
t.text "landing_page"
t.integer "user_id"
t.string "referring_domain"
t.string "search_keyword"
t.string "browser"
t.string "os"
t.string "device_type"
t.integer "screen_height"
t.integer "screen_width"
t.string "country"
t.string "region"
t.string "city"
t.string "postal_code"
t.decimal "latitude"
t.decimal "longitude"
t.string "utm_source"
t.string "utm_medium"
t.string "utm_term"
t.string "utm_content"
t.string "utm_campaign"
t.datetime "started_at"
end
add_index "visits", ["user_id"], name: "index_visits_on_user_id", using: :btree
create_table "votes", force: :cascade do |t| create_table "votes", force: :cascade do |t|
t.integer "votable_id" t.integer "votable_id"
t.string "votable_type" t.string "votable_type"