snapstats 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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/snapstats/application.js +19 -0
- data/app/assets/javascripts/snapstats/lib/d3.min.js +5 -0
- data/app/assets/javascripts/snapstats/lib/jquery.min.js +4 -0
- data/app/assets/javascripts/snapstats/lib/metricsgraphics.min.js +3 -0
- data/app/assets/javascripts/snapstats/main/main_controller.js +51 -0
- data/app/assets/javascripts/snapstats/performances/performances_controller.js +49 -0
- data/app/assets/javascripts/snapstats/users/users_controller.js +47 -0
- data/app/assets/stylesheets/snapstats/animate.css +3158 -0
- data/app/assets/stylesheets/snapstats/app.css +58 -0
- data/app/assets/stylesheets/snapstats/application.css +18 -0
- data/app/assets/stylesheets/snapstats/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/snapstats/metricsgraphics-demo-dark.css +636 -0
- data/app/assets/stylesheets/snapstats/metricsgraphics.css +363 -0
- data/app/controllers/snapstats/application_controller.rb +5 -0
- data/app/controllers/snapstats/mains_controller.rb +18 -0
- data/app/controllers/snapstats/performances_controller.rb +18 -0
- data/app/controllers/snapstats/users_controller.rb +22 -0
- data/app/helpers/snapstats/application_helper.rb +7 -0
- data/app/views/layouts/snapstats/application.html.erb +20 -0
- data/app/views/snapstats/application/_main_menu.html.erb +8 -0
- data/app/views/snapstats/mains/show.html.erb +87 -0
- data/app/views/snapstats/performances/show.html.erb +80 -0
- data/app/views/snapstats/users/activity.html.erb +49 -0
- data/app/views/snapstats/users/show.html.erb +32 -0
- data/config/routes.rb +23 -0
- data/lib/event_logger/event_logger.rb +45 -0
- data/lib/event_logger/event_logger_static.rb +55 -0
- data/lib/event_logger/event_logger_store.rb +89 -0
- data/lib/event_reader/event_reader.rb +168 -0
- data/lib/ext/redis.rb +19 -0
- data/lib/snapstats/engine.rb +9 -0
- data/lib/snapstats/version.rb +3 -0
- data/lib/snapstats.rb +8 -0
- data/lib/tasks/snapstats_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +29 -0
- data/test/dummy/config/environments/production.rb +80 -0
- data/test/dummy/config/environments/test.rb +36 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +12 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +58 -0
- data/test/dummy/public/422.html +58 -0
- data/test/dummy/public/500.html +57 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/snapstats_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +206 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Snapstats::Engine.routes.draw do
|
2
|
+
|
3
|
+
root to: 'mains#show'
|
4
|
+
|
5
|
+
resource :main do
|
6
|
+
collection do
|
7
|
+
get :chart
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
resource :performance do
|
12
|
+
collection do
|
13
|
+
get :chart
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
resource :user do
|
18
|
+
collection do
|
19
|
+
get 'activity/:id' => 'users#activity', :as => :activity
|
20
|
+
get 'activity/:id/chart' => 'users#chart', :as => :chart
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Snapstats
|
2
|
+
require "event_logger/event_logger_static"
|
3
|
+
require "event_logger/event_logger_store"
|
4
|
+
|
5
|
+
class EventLogger
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@redis = Snapstats::redis
|
9
|
+
end
|
10
|
+
|
11
|
+
def call name, started, finished, unique_id, payload
|
12
|
+
return nil if payload[:controller].scan(/^Snapstats/ui).present?
|
13
|
+
|
14
|
+
@payload = payload
|
15
|
+
@payload[:render_time] = finished - started
|
16
|
+
@user_agent = UserAgent.parse(@payload[:user_agent])
|
17
|
+
|
18
|
+
store_cpm
|
19
|
+
store_daily_activity
|
20
|
+
store_daily_uniqs
|
21
|
+
|
22
|
+
store_daily_platforms
|
23
|
+
store_daily_browsers
|
24
|
+
|
25
|
+
store_user_activity_table
|
26
|
+
store_slowest_controller
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def mkey name
|
32
|
+
Snapstats.mkey name
|
33
|
+
end
|
34
|
+
|
35
|
+
def mtime name
|
36
|
+
Snapstats.mtime name
|
37
|
+
end
|
38
|
+
|
39
|
+
def mday name
|
40
|
+
Snapstats.mday name
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Snapstats
|
2
|
+
|
3
|
+
class EventLogger
|
4
|
+
|
5
|
+
@@is_started = false
|
6
|
+
|
7
|
+
def self.start
|
8
|
+
unless @@is_started
|
9
|
+
|
10
|
+
init_events
|
11
|
+
subscribe
|
12
|
+
|
13
|
+
@@is_started = true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.subscribe
|
18
|
+
ActiveSupport::Notifications.subscribe('process_action.action_controller', self.new)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.init_events
|
22
|
+
|
23
|
+
ActionController::Instrumentation.send(:define_method, "process_action") do |arg|
|
24
|
+
|
25
|
+
raw_payload = {
|
26
|
+
:controller => self.class.name,
|
27
|
+
:action => self.action_name,
|
28
|
+
:params => request.filtered_parameters,
|
29
|
+
:format => request.format.try(:ref),
|
30
|
+
:method => request.method,
|
31
|
+
:path => (request.fullpath rescue "unknown"),
|
32
|
+
|
33
|
+
:ip => request.remote_ip,
|
34
|
+
:stash => request.session['flash'] && request.session['flash'][:log],
|
35
|
+
|
36
|
+
:user_id => request.env['warden'].try(:user).try(:id),
|
37
|
+
:user_email => request.env['warden'].try(:user).try(:email),
|
38
|
+
:user_agent => request.user_agent
|
39
|
+
}
|
40
|
+
|
41
|
+
ActiveSupport::Notifications.instrument("start_processing.action_controller", raw_payload.dup)
|
42
|
+
|
43
|
+
ActiveSupport::Notifications.instrument("process_action.action_controller", raw_payload) do |payload|
|
44
|
+
result = super(arg)
|
45
|
+
payload[:status] = response.status
|
46
|
+
append_info_to_payload(payload)
|
47
|
+
result
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module Snapstats
|
2
|
+
|
3
|
+
class EventLogger
|
4
|
+
|
5
|
+
# Daily report
|
6
|
+
|
7
|
+
def store_cpm
|
8
|
+
@redis.hincrby mday("cpm"), Time.now.beginning_of_minute.to_i, 1
|
9
|
+
end
|
10
|
+
|
11
|
+
def store_daily_activity
|
12
|
+
|
13
|
+
time_key = Time.current.to_i
|
14
|
+
|
15
|
+
value = {
|
16
|
+
path: @payload[:path],
|
17
|
+
ctrl: @payload[:controller],
|
18
|
+
actn: @payload[:action],
|
19
|
+
rntm: @payload.keys.select{ |i| i.to_s.scan(/runtime/ui).present? }.reduce({}){ |sum, i| sum[i.to_s.gsub(/_runtime/ui, '').to_sym] = @payload[i].to_f.round(3); sum },
|
20
|
+
os: @user_agent.platform,
|
21
|
+
brwsr: @user_agent.browser,
|
22
|
+
brver: @user_agent.version.to_s,
|
23
|
+
ip: @payload[:ip],
|
24
|
+
total: @payload[:render_time],
|
25
|
+
email: @payload[:user_email],
|
26
|
+
date: time_key
|
27
|
+
}.to_json
|
28
|
+
|
29
|
+
@redis.zadd mday('activity'), time_key, value
|
30
|
+
|
31
|
+
# add here links to users in sets like
|
32
|
+
|
33
|
+
if @payload[:user_id].present? && @payload[:user_email].present?
|
34
|
+
|
35
|
+
uvalue = {
|
36
|
+
ts: time_key,
|
37
|
+
path: @payload[:path],
|
38
|
+
total: @payload[:render_time],
|
39
|
+
os: @user_agent.platform,
|
40
|
+
brwsr: @user_agent.browser,
|
41
|
+
brver: @user_agent.version.to_s
|
42
|
+
|
43
|
+
}.to_json
|
44
|
+
|
45
|
+
@redis.zadd mday("activity:user:#{@payload[:user_id]}"), time_key, uvalue
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def store_daily_uniqs
|
50
|
+
@redis.hincrby mday('uniq'), @payload[:ip], 1
|
51
|
+
end
|
52
|
+
|
53
|
+
def store_daily_platforms
|
54
|
+
@redis.hset mday('platforms'), "#{@payload[:ip]}_#{@user_agent.platform}", @user_agent.platform
|
55
|
+
end
|
56
|
+
|
57
|
+
def store_daily_browsers
|
58
|
+
@redis.hset mday('browsers'), "#{@payload[:ip]}_#{@user_agent.browser}", @user_agent.browser
|
59
|
+
end
|
60
|
+
|
61
|
+
# User activity
|
62
|
+
|
63
|
+
def store_user_activity_table
|
64
|
+
return nil unless @payload[:user_id].present?
|
65
|
+
|
66
|
+
value = {
|
67
|
+
ts: Time.current.to_i,
|
68
|
+
path: @payload[:path],
|
69
|
+
email: @payload[:user_email]
|
70
|
+
}.to_json
|
71
|
+
|
72
|
+
@redis.hset mkey("activity:users"), @payload[:user_id], value
|
73
|
+
end
|
74
|
+
|
75
|
+
# Performance
|
76
|
+
|
77
|
+
def store_slowest_controller
|
78
|
+
|
79
|
+
value = {
|
80
|
+
ctrl: @payload[:controller],
|
81
|
+
actn: @payload[:action],
|
82
|
+
}.to_json
|
83
|
+
|
84
|
+
@redis.zadd mday('performance:controllers'), @payload[:render_time].to_f, value
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
module Snapstats
|
2
|
+
module EventReader
|
3
|
+
|
4
|
+
class Activity
|
5
|
+
include Virtus.model
|
6
|
+
|
7
|
+
attribute :email, String
|
8
|
+
attribute :path, String
|
9
|
+
attribute :controller, String
|
10
|
+
attribute :action, String
|
11
|
+
attribute :runtimes, Hash
|
12
|
+
attribute :os, String
|
13
|
+
attribute :browser, String
|
14
|
+
attribute :version, String
|
15
|
+
attribute :ip, String
|
16
|
+
attribute :render_time, String
|
17
|
+
attribute :date, Time
|
18
|
+
|
19
|
+
def self.fetch from=0, to=Time.now
|
20
|
+
Snapstats.redis.zrangebyscore(Snapstats.mday("activity"), from.to_i, to.to_i).map do |i|
|
21
|
+
v = JSON.parse(i, :symbolize_names => true)
|
22
|
+
|
23
|
+
self.new(email: v[:email],
|
24
|
+
path: v[:path],
|
25
|
+
controller: v[:ctrl],
|
26
|
+
action: v[:actn],
|
27
|
+
runtimes: v[:rntm],
|
28
|
+
os: v[:os],
|
29
|
+
browser: v[:brwsr],
|
30
|
+
version: v[:brver],
|
31
|
+
ip: v[:ip],
|
32
|
+
render_time: v[:total],
|
33
|
+
date: Time.at(v[:date].to_i))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.fetch_all_chart
|
38
|
+
|
39
|
+
# after 5 minutes i forgot how it works
|
40
|
+
|
41
|
+
fetch(Time.now.beginning_of_day).map{ |i|
|
42
|
+
|
43
|
+
i.runtimes.reduce({}){ |sum, (k,v)| sum[k] = { value: v, date: i.date.to_i }; sum }
|
44
|
+
|
45
|
+
}.reduce({}){ |sum, i|
|
46
|
+
|
47
|
+
i.keys.each{ |rt| sum[rt].present? ? sum[rt] << i[rt] : sum[rt] = [ i[rt] ] }
|
48
|
+
sum
|
49
|
+
}
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
class Performance
|
56
|
+
include Virtus.model
|
57
|
+
|
58
|
+
attribute :controller
|
59
|
+
attribute :action
|
60
|
+
attribute :render_time
|
61
|
+
|
62
|
+
def self.fetch_slowest_controllers
|
63
|
+
Snapstats.redis.zrevrangebyscore(Snapstats.mday('performance:controllers'), '+inf', '-inf', { withscores: true }).map do |i|
|
64
|
+
v = JSON.parse(i.first, :symbolize_names => true)
|
65
|
+
time = i.last
|
66
|
+
|
67
|
+
self.new(controller: v[:ctrl], action: v[:actn], render_time: time)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
class Browsers
|
74
|
+
include Virtus.model
|
75
|
+
|
76
|
+
attribute :name, String
|
77
|
+
attribute :total, Integer
|
78
|
+
|
79
|
+
def self.fetch_platforms
|
80
|
+
data = Snapstats.redis.hgetall(Snapstats.mday("platforms")).values.group_by{ |platform| platform }.map{ |name, platforms|{name => platforms.count} }
|
81
|
+
data.map{|i| self.new(name: i.keys.try(:first), total: i.values.try(:first)) }
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.fetch_browsers
|
85
|
+
data = Snapstats.redis.hgetall(Snapstats.mday("browsers")).values.group_by{ |browser| browser }.map{ |name, browsers|{ name => browsers.count} }
|
86
|
+
data.map{|i| self.new(name: i.keys.try(:first), total: i.values.try(:first)) }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class Uniqs
|
91
|
+
include Virtus.model
|
92
|
+
|
93
|
+
def self.fetch_uniqs
|
94
|
+
Snapstats.redis.hgetall(Snapstats.mday("uniq")).keys.count
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class Cpm
|
99
|
+
include Virtus.model
|
100
|
+
|
101
|
+
|
102
|
+
def self.fetch_all
|
103
|
+
Snapstats.redis.hgetall(Snapstats.mday("cpm"))
|
104
|
+
end
|
105
|
+
|
106
|
+
def self.fetch_all_hash
|
107
|
+
data = Snapstats.redis.hgetall(Snapstats.mday("cpm"))
|
108
|
+
|
109
|
+
cpm = data[Time.now.beginning_of_minute.to_i.to_s] || 0
|
110
|
+
cpd = data.values.reduce(0){ |sum, i| sum + i.to_i }
|
111
|
+
|
112
|
+
cph = data.group_by{ |k, v| Time.at(k.to_i).beginning_of_hour }.reduce({}){|sum, (k, v)| sum[k] = v.map{|i| i.last.to_i}.reduce(:+); sum }
|
113
|
+
cph = cph.values.reduce(:+) / cph.keys.count
|
114
|
+
|
115
|
+
{ cpm: cpm, cph: cph, cpd: cpd }
|
116
|
+
end
|
117
|
+
|
118
|
+
def self.fetch_all_chart
|
119
|
+
fetch_all.map{ |k, v| { date: k, value: v } }
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
class UserActivity
|
125
|
+
include Virtus.model
|
126
|
+
|
127
|
+
attribute :email, String
|
128
|
+
attribute :date, Time
|
129
|
+
attribute :path, String
|
130
|
+
attribute :user_id, String
|
131
|
+
attribute :render_time, String
|
132
|
+
attribute :os, String
|
133
|
+
attribute :browser, String
|
134
|
+
attribute :version, String
|
135
|
+
|
136
|
+
def self.fetch_all
|
137
|
+
Snapstats.redis.hgetall(Snapstats.mkey("activity:users")).map do |uid, values|
|
138
|
+
values = JSON.parse(values, :symbolize_names => true)
|
139
|
+
self.new(email: values[:email], date: Time.at(values[:ts].to_i), path: values[:path], user_id: uid)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def self.fetch_for_user user_id, from='+inf', to='-inf'
|
144
|
+
Snapstats.redis.zrevrangebyscore(Snapstats.mday("activity:user:#{user_id}"), from, to).map do |i|
|
145
|
+
v = JSON.parse(i, :symbolize_names => true)
|
146
|
+
|
147
|
+
self.new( path: v[:path],
|
148
|
+
render_time: v[:total],
|
149
|
+
os: v[:os],
|
150
|
+
browser: v[:brwsr],
|
151
|
+
version: v[:brver],
|
152
|
+
date: Time.at(v[:ts].to_i))
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.fetch_email_by_uid user_id
|
157
|
+
data = Snapstats.redis.hgetall(Snapstats.mkey("activity:users"))[user_id]
|
158
|
+
JSON.parse(data, :symbolize_names => true)[:email] if data
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.fetch_chart_for_user user_id
|
162
|
+
fetch_for_user(user_id).group_by{ |i| i.date.beginning_of_minute }.map{ |k, v| { date: k.to_i, value: v.count } }
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
end
|
data/lib/ext/redis.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Snapstats
|
2
|
+
|
3
|
+
def self.redis
|
4
|
+
@@redis ||= Redis.new(:host => 'localhost', :port => 6379)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.mkey name
|
8
|
+
"snaps:#{name}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.mtime name
|
12
|
+
"snaps:#{Time.now.to_i}:#{name}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.mday name
|
16
|
+
"snaps:#{DateTime.current.beginning_of_day.to_i}:#{name}"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/lib/snapstats.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/test/dummy/Rakefile
ADDED
@@ -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
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
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,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "snapstats"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
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
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
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
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|