stopwatch 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG +8 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +120 -0
- data/Rakefile +20 -0
- data/lib/load_speed.rb +17 -1
- data/lib/stopwatch.rb +11 -0
- data/lib/stopwatch/version.rb +1 -1
- data/lib/stopwatch_event.rb +15 -0
- data/lib/stopwatch_log.rb +19 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/welcome/index.html.erb +1 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +47 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -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/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/integration/stopwatch_spec.rb +10 -0
- data/spec/spec_helper.rb +30 -0
- metadata +68 -6
data/CHANGELOG
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
stopwatch (0.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.7)
|
11
|
+
actionpack (= 3.0.7)
|
12
|
+
mail (~> 2.2.15)
|
13
|
+
actionpack (3.0.7)
|
14
|
+
activemodel (= 3.0.7)
|
15
|
+
activesupport (= 3.0.7)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.7)
|
24
|
+
activesupport (= 3.0.7)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.7)
|
28
|
+
activemodel (= 3.0.7)
|
29
|
+
activesupport (= 3.0.7)
|
30
|
+
arel (~> 2.0.2)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.7)
|
33
|
+
activemodel (= 3.0.7)
|
34
|
+
activesupport (= 3.0.7)
|
35
|
+
activesupport (3.0.7)
|
36
|
+
arel (2.0.10)
|
37
|
+
builder (2.1.2)
|
38
|
+
capybara (0.4.1.2)
|
39
|
+
celerity (>= 0.7.9)
|
40
|
+
culerity (>= 0.2.4)
|
41
|
+
mime-types (>= 1.16)
|
42
|
+
nokogiri (>= 1.3.3)
|
43
|
+
rack (>= 1.0.0)
|
44
|
+
rack-test (>= 0.5.4)
|
45
|
+
selenium-webdriver (>= 0.0.27)
|
46
|
+
xpath (~> 0.1.3)
|
47
|
+
celerity (0.8.9)
|
48
|
+
childprocess (0.1.9)
|
49
|
+
ffi (~> 1.0.6)
|
50
|
+
culerity (0.2.15)
|
51
|
+
diff-lcs (1.1.2)
|
52
|
+
erubis (2.6.6)
|
53
|
+
abstract (>= 1.0.0)
|
54
|
+
ffi (1.0.9)
|
55
|
+
i18n (0.5.0)
|
56
|
+
json_pure (1.5.1)
|
57
|
+
mail (2.2.19)
|
58
|
+
activesupport (>= 2.3.6)
|
59
|
+
i18n (>= 0.4.0)
|
60
|
+
mime-types (~> 1.16)
|
61
|
+
treetop (~> 1.4.8)
|
62
|
+
mime-types (1.16)
|
63
|
+
nokogiri (1.4.4)
|
64
|
+
polyglot (0.3.1)
|
65
|
+
rack (1.2.3)
|
66
|
+
rack-mount (0.6.14)
|
67
|
+
rack (>= 1.0.0)
|
68
|
+
rack-test (0.5.7)
|
69
|
+
rack (>= 1.0)
|
70
|
+
rails (3.0.7)
|
71
|
+
actionmailer (= 3.0.7)
|
72
|
+
actionpack (= 3.0.7)
|
73
|
+
activerecord (= 3.0.7)
|
74
|
+
activeresource (= 3.0.7)
|
75
|
+
activesupport (= 3.0.7)
|
76
|
+
bundler (~> 1.0)
|
77
|
+
railties (= 3.0.7)
|
78
|
+
railties (3.0.7)
|
79
|
+
actionpack (= 3.0.7)
|
80
|
+
activesupport (= 3.0.7)
|
81
|
+
rake (>= 0.8.7)
|
82
|
+
thor (~> 0.14.4)
|
83
|
+
rake (0.8.7)
|
84
|
+
rspec (2.6.0)
|
85
|
+
rspec-core (~> 2.6.0)
|
86
|
+
rspec-expectations (~> 2.6.0)
|
87
|
+
rspec-mocks (~> 2.6.0)
|
88
|
+
rspec-core (2.6.0)
|
89
|
+
rspec-expectations (2.6.0)
|
90
|
+
diff-lcs (~> 1.1.2)
|
91
|
+
rspec-mocks (2.6.0)
|
92
|
+
rspec-rails (2.6.0)
|
93
|
+
actionpack (~> 3.0)
|
94
|
+
activesupport (~> 3.0)
|
95
|
+
railties (~> 3.0)
|
96
|
+
rspec (~> 2.6.0)
|
97
|
+
rubyzip (0.9.4)
|
98
|
+
selenium-webdriver (0.2.0)
|
99
|
+
childprocess (>= 0.1.7)
|
100
|
+
ffi (>= 1.0.7)
|
101
|
+
json_pure
|
102
|
+
rubyzip
|
103
|
+
sqlite3 (1.3.3)
|
104
|
+
thor (0.14.6)
|
105
|
+
treetop (1.4.9)
|
106
|
+
polyglot (>= 0.3.1)
|
107
|
+
tzinfo (0.3.27)
|
108
|
+
xpath (0.1.4)
|
109
|
+
nokogiri (~> 1.3)
|
110
|
+
|
111
|
+
PLATFORMS
|
112
|
+
ruby
|
113
|
+
|
114
|
+
DEPENDENCIES
|
115
|
+
capybara
|
116
|
+
ffi (= 1.0.9)
|
117
|
+
rails (= 3.0.7)
|
118
|
+
rspec-rails (>= 2.0.0.beta)
|
119
|
+
sqlite3
|
120
|
+
stopwatch!
|
data/Rakefile
CHANGED
@@ -1,2 +1,22 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'rubygems'
|
1
3
|
require 'bundler'
|
2
4
|
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
|
9
|
+
require 'rspec/core'
|
10
|
+
require 'rspec/core/rake_task'
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
13
|
+
|
14
|
+
task :default => :spec
|
15
|
+
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'Stopwatch'
|
19
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
+
rdoc.rdoc_files.include('README.rdoc')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
data/lib/load_speed.rb
CHANGED
@@ -9,7 +9,8 @@ module Rack
|
|
9
9
|
status, headers, response = @app.call(env)
|
10
10
|
|
11
11
|
if status == 200
|
12
|
-
body =
|
12
|
+
body = ""
|
13
|
+
response.each {|part| body << part}
|
13
14
|
index = body.rindex("</body>")
|
14
15
|
if index
|
15
16
|
body.insert(index, performance_code)
|
@@ -24,13 +25,21 @@ module Rack
|
|
24
25
|
protected
|
25
26
|
|
26
27
|
def performance_code
|
28
|
+
events = "<table><tr><td>view</td><td>duration</td><td>queries</td></tr>"
|
29
|
+
StopwatchLog.events.each do |event|
|
30
|
+
events << "<tr><td>#{event.template}</td><td>#{event.duration}</td><td>#{event.query_count}</td></tr>"
|
31
|
+
end
|
32
|
+
events << "</table>"
|
33
|
+
|
27
34
|
html = <<-EOF
|
28
35
|
<style>
|
29
36
|
#performance_code {
|
37
|
+
z-index: 1000;
|
30
38
|
position: absolute;
|
31
39
|
top: 0;
|
32
40
|
right: 0;
|
33
41
|
height: 25px;
|
42
|
+
overflow: hidden;
|
34
43
|
background-color: #DE7A93;
|
35
44
|
color: white;
|
36
45
|
padding: 0 10px 0 10px;
|
@@ -39,10 +48,17 @@ module Rack
|
|
39
48
|
font-size: 10pt;
|
40
49
|
text-align: right;
|
41
50
|
}
|
51
|
+
|
52
|
+
#performance_code:hover {
|
53
|
+
height: auto;
|
54
|
+
width: auto;
|
55
|
+
padding-bottom: 10px;
|
56
|
+
}
|
42
57
|
</style>
|
43
58
|
<div id="performance_code">
|
44
59
|
<strong>#{StopwatchLog.event.duration.to_i}</strong> ms
|
45
60
|
<strong>#{StopwatchLog.query_count}</strong> queries
|
61
|
+
#{events}
|
46
62
|
</div>
|
47
63
|
EOF
|
48
64
|
html
|
data/lib/stopwatch.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'load_speed'
|
2
2
|
require 'stopwatch_log'
|
3
|
+
require 'stopwatch_event'
|
3
4
|
|
4
5
|
module Stopwatch
|
5
6
|
class Railtie < Rails::Railtie
|
@@ -8,6 +9,7 @@ module Stopwatch
|
|
8
9
|
|
9
10
|
ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |*args|
|
10
11
|
StopwatchLog.reset_query_count
|
12
|
+
StopwatchLog.reset_events
|
11
13
|
end
|
12
14
|
|
13
15
|
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
|
@@ -16,6 +18,15 @@ module Stopwatch
|
|
16
18
|
|
17
19
|
ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload|
|
18
20
|
StopwatchLog.increment_query_count if payload[:name] != "CACHE"
|
21
|
+
StopwatchLog.increment_sub_query_count if payload[:name] != "CACHE"
|
22
|
+
end
|
23
|
+
|
24
|
+
ActiveSupport::Notifications.subscribe "render_partial.action_view" do |*args|
|
25
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
26
|
+
stopwatch_event = StopwatchEvent.new(event)
|
27
|
+
stopwatch_event.query_count = StopwatchLog.sub_query_count
|
28
|
+
StopwatchLog.events << stopwatch_event
|
29
|
+
StopwatchLog.reset_sub_query_count
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
data/lib/stopwatch/version.rb
CHANGED
data/lib/stopwatch_log.rb
CHANGED
@@ -1,17 +1,36 @@
|
|
1
1
|
class StopwatchLog
|
2
2
|
@@query_count = 0
|
3
|
+
@@sub_query_count = 0
|
4
|
+
@@events = []
|
3
5
|
|
4
6
|
cattr_accessor :event
|
7
|
+
cattr_accessor :events
|
5
8
|
|
6
9
|
def self.query_count
|
7
10
|
@@query_count
|
8
11
|
end
|
9
12
|
|
13
|
+
def self.sub_query_count
|
14
|
+
@@sub_query_count
|
15
|
+
end
|
16
|
+
|
10
17
|
def self.reset_query_count
|
11
18
|
@@query_count = 0
|
12
19
|
end
|
13
20
|
|
21
|
+
def self.reset_sub_query_count
|
22
|
+
@@sub_query_count = 0
|
23
|
+
end
|
24
|
+
|
14
25
|
def self.increment_query_count
|
15
26
|
@@query_count += 1
|
16
27
|
end
|
28
|
+
|
29
|
+
def self.increment_sub_query_count
|
30
|
+
@@sub_query_count += 1
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.reset_events
|
34
|
+
@@events = []
|
35
|
+
end
|
17
36
|
end
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>You found me</h1>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
Bundler.require
|
10
|
+
require "stopwatch"
|
11
|
+
|
12
|
+
module Dummy
|
13
|
+
class Application < Rails::Application
|
14
|
+
config.middleware.use "Rack::LoadSpeed"
|
15
|
+
|
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
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
39
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
40
|
+
|
41
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
42
|
+
config.encoding = "utf-8"
|
43
|
+
|
44
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
45
|
+
config.filter_parameters += [:password]
|
46
|
+
end
|
47
|
+
end
|
@@ -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,26 @@
|
|
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 webserver 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_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Dummy::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
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
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,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
|
+
Dummy::Application.config.secret_token = 'b11275ac81d6b3f46081117a1d9ee56524a1614ffa815ccca372ba2acd3b97dcc13195721412a97585f4546e5bb32acbfc2004f7f758ac9c7a0ef7d316450624'
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
Dummy::Application.config.session_store :cookie_store, :key => '_dummy_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
|
+
# Dummy::Application.config.session_store :active_record_store
|
File without changes
|
@@ -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
|
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'
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Configure Rails Envinronment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
+
require "rails/test_help"
|
6
|
+
require "rspec/rails"
|
7
|
+
|
8
|
+
ActionMailer::Base.delivery_method = :test
|
9
|
+
ActionMailer::Base.perform_deliveries = true
|
10
|
+
ActionMailer::Base.default_url_options[:host] = "test.com"
|
11
|
+
|
12
|
+
Rails.backtrace_cleaner.remove_silencers!
|
13
|
+
|
14
|
+
# Configure capybara for integration testing
|
15
|
+
require "capybara/rails"
|
16
|
+
Capybara.default_driver = :rack_test
|
17
|
+
Capybara.default_selector = :css
|
18
|
+
|
19
|
+
# Load support files
|
20
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
# Remove this line if you don't want RSpec's should and should_not
|
24
|
+
# methods or matchers
|
25
|
+
require 'rspec/expectations'
|
26
|
+
config.include RSpec::Matchers
|
27
|
+
|
28
|
+
# == Mock Framework
|
29
|
+
config.mock_with :rspec
|
30
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stopwatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mark Mulder
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-28 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -30,13 +30,46 @@ extra_rdoc_files: []
|
|
30
30
|
|
31
31
|
files:
|
32
32
|
- .gitignore
|
33
|
+
- CHANGELOG
|
33
34
|
- Gemfile
|
35
|
+
- Gemfile.lock
|
34
36
|
- README.md
|
35
37
|
- Rakefile
|
36
38
|
- lib/load_speed.rb
|
37
39
|
- lib/stopwatch.rb
|
38
40
|
- lib/stopwatch/version.rb
|
41
|
+
- lib/stopwatch_event.rb
|
39
42
|
- lib/stopwatch_log.rb
|
43
|
+
- spec/dummy/Rakefile
|
44
|
+
- spec/dummy/app/controllers/application_controller.rb
|
45
|
+
- spec/dummy/app/controllers/welcome_controller.rb
|
46
|
+
- spec/dummy/app/helpers/application_helper.rb
|
47
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
48
|
+
- spec/dummy/app/views/welcome/index.html.erb
|
49
|
+
- spec/dummy/config.ru
|
50
|
+
- spec/dummy/config/application.rb
|
51
|
+
- spec/dummy/config/boot.rb
|
52
|
+
- spec/dummy/config/database.yml
|
53
|
+
- spec/dummy/config/environment.rb
|
54
|
+
- spec/dummy/config/environments/development.rb
|
55
|
+
- spec/dummy/config/environments/production.rb
|
56
|
+
- spec/dummy/config/environments/test.rb
|
57
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
58
|
+
- spec/dummy/config/initializers/inflections.rb
|
59
|
+
- spec/dummy/config/initializers/mime_types.rb
|
60
|
+
- spec/dummy/config/initializers/secret_token.rb
|
61
|
+
- spec/dummy/config/initializers/session_store.rb
|
62
|
+
- spec/dummy/config/locales/en.yml
|
63
|
+
- spec/dummy/config/routes.rb
|
64
|
+
- spec/dummy/db/.gitkeep
|
65
|
+
- spec/dummy/public/404.html
|
66
|
+
- spec/dummy/public/422.html
|
67
|
+
- spec/dummy/public/500.html
|
68
|
+
- spec/dummy/public/favicon.ico
|
69
|
+
- spec/dummy/public/stylesheets/.gitkeep
|
70
|
+
- spec/dummy/script/rails
|
71
|
+
- spec/integration/stopwatch_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
40
73
|
- stopwatch.gemspec
|
41
74
|
- stopwatch.png
|
42
75
|
has_rdoc: true
|
@@ -73,5 +106,34 @@ rubygems_version: 1.4.1
|
|
73
106
|
signing_key:
|
74
107
|
specification_version: 3
|
75
108
|
summary: Show the page load duration.
|
76
|
-
test_files:
|
77
|
-
|
109
|
+
test_files:
|
110
|
+
- spec/dummy/Rakefile
|
111
|
+
- spec/dummy/app/controllers/application_controller.rb
|
112
|
+
- spec/dummy/app/controllers/welcome_controller.rb
|
113
|
+
- spec/dummy/app/helpers/application_helper.rb
|
114
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
115
|
+
- spec/dummy/app/views/welcome/index.html.erb
|
116
|
+
- spec/dummy/config.ru
|
117
|
+
- spec/dummy/config/application.rb
|
118
|
+
- spec/dummy/config/boot.rb
|
119
|
+
- spec/dummy/config/database.yml
|
120
|
+
- spec/dummy/config/environment.rb
|
121
|
+
- spec/dummy/config/environments/development.rb
|
122
|
+
- spec/dummy/config/environments/production.rb
|
123
|
+
- spec/dummy/config/environments/test.rb
|
124
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
125
|
+
- spec/dummy/config/initializers/inflections.rb
|
126
|
+
- spec/dummy/config/initializers/mime_types.rb
|
127
|
+
- spec/dummy/config/initializers/secret_token.rb
|
128
|
+
- spec/dummy/config/initializers/session_store.rb
|
129
|
+
- spec/dummy/config/locales/en.yml
|
130
|
+
- spec/dummy/config/routes.rb
|
131
|
+
- spec/dummy/db/.gitkeep
|
132
|
+
- spec/dummy/public/404.html
|
133
|
+
- spec/dummy/public/422.html
|
134
|
+
- spec/dummy/public/500.html
|
135
|
+
- spec/dummy/public/favicon.ico
|
136
|
+
- spec/dummy/public/stylesheets/.gitkeep
|
137
|
+
- spec/dummy/script/rails
|
138
|
+
- spec/integration/stopwatch_spec.rb
|
139
|
+
- spec/spec_helper.rb
|