stopwatch 0.0.4 → 1.0.0

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +6 -16
  3. data/CHANGELOG +3 -0
  4. data/Gemfile +0 -11
  5. data/Gemfile.lock +21 -128
  6. data/Rakefile +2 -18
  7. data/lib/load_speed.rb +4 -1
  8. data/lib/stopwatch.rb +1 -34
  9. data/lib/stopwatch/log.rb +16 -3
  10. data/lib/stopwatch/railtie.rb +36 -0
  11. data/lib/stopwatch/version.rb +1 -1
  12. data/spec/stopwatch_spec.rb +66 -0
  13. data/stopwatch.gemspec +6 -0
  14. metadata +56 -109
  15. data/spec/dummy/Rakefile +0 -7
  16. data/spec/dummy/app/controllers/application_controller.rb +0 -3
  17. data/spec/dummy/app/controllers/welcome_controller.rb +0 -9
  18. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  19. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  20. data/spec/dummy/app/views/welcome/index.html.erb +0 -1
  21. data/spec/dummy/config.ru +0 -4
  22. data/spec/dummy/config/application.rb +0 -47
  23. data/spec/dummy/config/boot.rb +0 -10
  24. data/spec/dummy/config/database.yml +0 -22
  25. data/spec/dummy/config/environment.rb +0 -5
  26. data/spec/dummy/config/environments/development.rb +0 -26
  27. data/spec/dummy/config/environments/production.rb +0 -49
  28. data/spec/dummy/config/environments/test.rb +0 -35
  29. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  30. data/spec/dummy/config/initializers/inflections.rb +0 -10
  31. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  32. data/spec/dummy/config/initializers/secret_token.rb +0 -7
  33. data/spec/dummy/config/initializers/session_store.rb +0 -8
  34. data/spec/dummy/config/locales/en.yml +0 -5
  35. data/spec/dummy/config/routes.rb +0 -4
  36. data/spec/dummy/db/.gitkeep +0 -0
  37. data/spec/dummy/public/404.html +0 -26
  38. data/spec/dummy/public/422.html +0 -26
  39. data/spec/dummy/public/500.html +0 -26
  40. data/spec/dummy/public/favicon.ico +0 -0
  41. data/spec/dummy/public/javascripts/test.js +0 -1
  42. data/spec/dummy/public/stylesheets/.gitkeep +0 -0
  43. data/spec/dummy/script/rails +0 -6
  44. data/spec/integration/stopwatch_spec.rb +0 -15
  45. data/spec/spec_helper.rb +0 -30
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f2e13c0b156bbafa1c265a69eec80e39b27d2ba7
4
+ data.tar.gz: 3b323dece7066d744bb50cf8868df17719aa5b60
5
+ SHA512:
6
+ metadata.gz: 06c3dc0a194d7281dceca2762b1fcb929d40f8f844c8b7230fceef3c13fbaff4793ba7801a5dd8dd50090a38638033e67707742015d9f4191f7ecc8864549604
7
+ data.tar.gz: 782169ada96b9f38bb4724496d532d032d60f78a9355b06f97981e025377fad4e26d1635837fd956c9bf91560e44081ebd2543e675b64bffccf90414b912a7f9
@@ -1,17 +1,7 @@
1
- bundler_args: --binstubs
2
-
1
+ sudo: false
2
+ language: ruby
3
3
  rvm:
4
- - 1.8.7
5
- - 1.9.2
6
- - ree
7
-
8
- script: "bundle exec rspec spec"
9
-
10
- notifications:
11
- recipients:
12
- - markmulder@gmail.com
13
-
14
- branches:
15
- only:
16
- - master
17
-
4
+ - 2.3.3
5
+ - 2.2.6
6
+ - 1.9.3-p551
7
+ script: "bundle exec rspec"
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v1.0.0
2
+ * Handles UTF-8 characters in body, thanks @erikj for #2 !
3
+
1
4
  v0.0.4
2
5
  * Only inserts code if the content-type is text/html or application/xhtml+xml
3
6
 
data/Gemfile CHANGED
@@ -1,14 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", "3.0.7"
4
- gem "sqlite3"
5
- gem "capybara"
6
- gem "ffi", "1.0.9"
7
-
8
- gem "rspec-rails", ">= 2.0.0.beta"
9
-
10
- gem "ruby-debug", :platform => :ruby_18
11
- gem "linecache19", :platform => :ruby_19
12
- gem "ruby-debug19", :platform => :ruby_19
13
-
14
3
  gemspec
@@ -1,141 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stopwatch (0.0.3)
4
+ stopwatch (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
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
- archive-tar-minitar (0.5.2)
37
- arel (2.0.10)
38
- builder (2.1.2)
39
- capybara (1.0.0)
40
- mime-types (>= 1.16)
41
- nokogiri (>= 1.3.3)
42
- rack (>= 1.0.0)
43
- rack-test (>= 0.5.4)
44
- selenium-webdriver (~> 0.2.0)
45
- xpath (~> 0.1.4)
46
- childprocess (0.1.9)
47
- ffi (~> 1.0.6)
48
- columnize (0.3.4)
49
- diff-lcs (1.1.2)
50
- erubis (2.6.6)
51
- abstract (>= 1.0.0)
52
- ffi (1.0.9)
53
- i18n (0.5.0)
54
- json_pure (1.5.3)
55
- linecache (0.46)
56
- rbx-require-relative (> 0.0.4)
57
- linecache19 (0.5.12)
58
- ruby_core_source (>= 0.1.4)
59
- mail (2.2.19)
60
- activesupport (>= 2.3.6)
61
- i18n (>= 0.4.0)
62
- mime-types (~> 1.16)
63
- treetop (~> 1.4.8)
64
- mime-types (1.16)
65
- nokogiri (1.5.0)
66
- polyglot (0.3.1)
67
- rack (1.2.3)
68
- rack-mount (0.6.14)
69
- rack (>= 1.0.0)
70
- rack-test (0.5.7)
71
- rack (>= 1.0)
72
- rails (3.0.7)
73
- actionmailer (= 3.0.7)
74
- actionpack (= 3.0.7)
75
- activerecord (= 3.0.7)
76
- activeresource (= 3.0.7)
77
- activesupport (= 3.0.7)
78
- bundler (~> 1.0)
79
- railties (= 3.0.7)
80
- railties (3.0.7)
81
- actionpack (= 3.0.7)
82
- activesupport (= 3.0.7)
83
- rake (>= 0.8.7)
84
- thor (~> 0.14.4)
85
- rake (0.9.2)
86
- rbx-require-relative (0.0.5)
87
- rspec (2.6.0)
88
- rspec-core (~> 2.6.0)
89
- rspec-expectations (~> 2.6.0)
90
- rspec-mocks (~> 2.6.0)
91
- rspec-core (2.6.4)
92
- rspec-expectations (2.6.0)
93
- diff-lcs (~> 1.1.2)
94
- rspec-mocks (2.6.0)
95
- rspec-rails (2.6.1)
96
- actionpack (~> 3.0)
97
- activesupport (~> 3.0)
98
- railties (~> 3.0)
99
- rspec (~> 2.6.0)
100
- ruby-debug (0.10.4)
101
- columnize (>= 0.1)
102
- ruby-debug-base (~> 0.10.4.0)
103
- ruby-debug-base (0.10.4)
104
- linecache (>= 0.3)
105
- ruby-debug-base19 (0.11.25)
106
- columnize (>= 0.3.1)
107
- linecache19 (>= 0.5.11)
108
- ruby_core_source (>= 0.1.4)
109
- ruby-debug19 (0.11.6)
110
- columnize (>= 0.3.1)
111
- linecache19 (>= 0.5.11)
112
- ruby-debug-base19 (>= 0.11.19)
113
- ruby_core_source (0.1.5)
114
- archive-tar-minitar (>= 0.5.2)
115
- rubyzip (0.9.4)
116
- selenium-webdriver (0.2.2)
117
- childprocess (>= 0.1.9)
118
- ffi (>= 1.0.7)
119
- json_pure
120
- rubyzip
121
- sqlite3 (1.3.3)
122
- thor (0.14.6)
123
- treetop (1.4.9)
124
- polyglot (>= 0.3.1)
125
- tzinfo (0.3.29)
126
- xpath (0.1.4)
127
- nokogiri (~> 1.3)
9
+ diff-lcs (1.3)
10
+ rack (1.6.5)
11
+ rspec (3.5.0)
12
+ rspec-core (~> 3.5.0)
13
+ rspec-expectations (~> 3.5.0)
14
+ rspec-mocks (~> 3.5.0)
15
+ rspec-core (3.5.4)
16
+ rspec-support (~> 3.5.0)
17
+ rspec-expectations (3.5.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.5.0)
20
+ rspec-mocks (3.5.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.5.0)
23
+ rspec-support (3.5.0)
128
24
 
129
25
  PLATFORMS
130
26
  ruby
131
27
 
132
28
  DEPENDENCIES
133
- capybara
134
- ffi (= 1.0.9)
135
- linecache19
136
- rails (= 3.0.7)
137
- rspec-rails (>= 2.0.0.beta)
138
- ruby-debug
139
- ruby-debug19
140
- sqlite3
29
+ rack (~> 1.6.5)
30
+ rspec (~> 3.5.0)
141
31
  stopwatch!
32
+
33
+ BUNDLED WITH
34
+ 1.12.5
data/Rakefile CHANGED
@@ -1,22 +1,6 @@
1
- # encoding: UTF-8
2
- require 'rubygems'
3
- require 'bundler'
4
- Bundler::GemHelper.install_tasks
5
-
6
- require 'rake'
7
- require 'rake/rdoctask'
8
-
9
- require 'rspec/core'
10
- require 'rspec/core/rake_task'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
11
3
 
12
4
  RSpec::Core::RakeTask.new(:spec)
13
5
 
14
6
  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
@@ -14,7 +14,10 @@ module Rack
14
14
  index = body.rindex("</body>")
15
15
  if index
16
16
  body.insert(index, performance_code)
17
- headers["Content-Length"] = body.length.to_s
17
+ #
18
+ # handle body w/ UTF8 characters for Ruby 1.9+ to avoid Rack::Lint::LintError
19
+ #
20
+ headers["Content-Length"] = (body.respond_to?(:bytesize) ? body.bytesize : body.length).to_s
18
21
  response = [body]
19
22
  end
20
23
  end
@@ -1,40 +1,7 @@
1
1
  require 'load_speed'
2
2
  require 'stopwatch/log'
3
3
  require 'stopwatch/event'
4
+ require 'stopwatch/railtie' if defined?(::Rails::Railtie)
4
5
 
5
6
  module Stopwatch
6
- class Railtie < Rails::Railtie
7
- initializer "newplugin.initialize" do |app|
8
- app.config.middleware.use "Rack::LoadSpeed"
9
-
10
- # Start processing
11
- ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |*args|
12
- Stopwatch::Log.reset_query_count
13
- Stopwatch::Log.reset_sub_query_count
14
- Stopwatch::Log.reset_events
15
- end
16
-
17
- # Every query
18
- ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload|
19
- if payload[:name] != "CACHE"
20
- Stopwatch::Log.increment_query_count
21
- Stopwatch::Log.increment_sub_query_count
22
- end
23
- end
24
-
25
- # Every partial render
26
- ActiveSupport::Notifications.subscribe(/render/) do |name, start, finish, id, payload|
27
- event = ActiveSupport::Notifications::Event.new(name, start, finish, id, payload)
28
- stopwatch_event = Stopwatch::Event.new(event)
29
- stopwatch_event.query_count = Stopwatch::Log.sub_query_count
30
- Stopwatch::Log.events << stopwatch_event
31
- Stopwatch::Log.reset_sub_query_count
32
- end
33
-
34
- # End of processing
35
- ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
36
- Stopwatch::Log.event = ActiveSupport::Notifications::Event.new(*args)
37
- end
38
- end
39
- end
40
7
  end
@@ -4,13 +4,26 @@ module Stopwatch
4
4
  @@sub_query_count = 0
5
5
  @@events = []
6
6
 
7
- cattr_accessor :event
8
- cattr_accessor :events
9
- cattr_accessor :query_count
7
+ def self.event
8
+ @@event
9
+ end
10
+ def self.event=(event)
11
+ @@event = event
12
+ end
13
+
14
+ def self.events
15
+ @@events
16
+ end
17
+ def self.events=(events)
18
+ @@events = events
19
+ end
10
20
 
11
21
  def self.query_count
12
22
  @@query_count
13
23
  end
24
+ def self.query_count=(query_count)
25
+ @@query_count = query_count
26
+ end
14
27
 
15
28
  def self.sub_query_count
16
29
  @@sub_query_count
@@ -0,0 +1,36 @@
1
+ module Stopwatch
2
+ class Railtie < Rails::Railtie
3
+ initializer "newplugin.initialize" do |app|
4
+ app.config.middleware.use "Rack::LoadSpeed"
5
+
6
+ # Start processing
7
+ ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |*args|
8
+ Stopwatch::Log.reset_query_count
9
+ Stopwatch::Log.reset_sub_query_count
10
+ Stopwatch::Log.reset_events
11
+ end
12
+
13
+ # Every query
14
+ ActiveSupport::Notifications.subscribe "sql.active_record" do |name, start, finish, id, payload|
15
+ if payload[:name] != "CACHE"
16
+ Stopwatch::Log.increment_query_count
17
+ Stopwatch::Log.increment_sub_query_count
18
+ end
19
+ end
20
+
21
+ # Every partial render
22
+ ActiveSupport::Notifications.subscribe(/render/) do |name, start, finish, id, payload|
23
+ event = ActiveSupport::Notifications::Event.new(name, start, finish, id, payload)
24
+ stopwatch_event = Stopwatch::Event.new(event)
25
+ stopwatch_event.query_count = Stopwatch::Log.sub_query_count
26
+ Stopwatch::Log.events << stopwatch_event
27
+ Stopwatch::Log.reset_sub_query_count
28
+ end
29
+
30
+ # End of processing
31
+ ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
32
+ Stopwatch::Log.event = ActiveSupport::Notifications::Event.new(*args)
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,3 @@
1
1
  module Stopwatch
2
- VERSION = "0.0.4"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+ #
3
+ require_relative './../lib/stopwatch'
4
+ require_relative './../lib/load_speed'
5
+
6
+ require 'rack/lint'
7
+ require "rack/mock"
8
+
9
+ describe Rack::LoadSpeed do
10
+ # Copied from https://github.com/rails/rails/blob/3e48bfd49730331d8f09d4d96bb9a58959017a9c/activesupport/lib/active_support/notifications/instrumenter.rb#L78
11
+ # so we don't have to depend on AS
12
+ class Event
13
+ attr_reader :name, :time, :transaction_id, :payload, :children
14
+ attr_accessor :end
15
+
16
+ def initialize(name, start, ending, transaction_id, payload)
17
+ @name = name
18
+ @payload = payload.dup
19
+ @time = start
20
+ @transaction_id = transaction_id
21
+ @end = ending
22
+ @children = []
23
+ @duration = nil
24
+ end
25
+
26
+ def duration
27
+ @duration ||= 1000.0 * (self.end - time)
28
+ end
29
+ end
30
+
31
+ it 'inserts performance data' do
32
+ app = lambda { |env| [200, {'Content-Type' => 'text/html'}, ["<html><body>test</body></html>"]]}
33
+ event = Event.new('test', 1, 2, '123', { identifier: "app/views/tests/index.html.erb" })
34
+ Stopwatch::Log.reset_query_count
35
+ Stopwatch::Log.reset_sub_query_count
36
+ Stopwatch::Log.reset_events
37
+
38
+ Stopwatch::Log.events << Stopwatch::Event.new(event)
39
+ Stopwatch::Log.query_count = 12
40
+ Stopwatch::Log.event = event
41
+
42
+ response = Rack::LoadSpeed.new(app).call({})
43
+
44
+ body = response[2][0]
45
+ expect(body).to include "performance_code"
46
+ expect(body).to include "<strong>1000</strong> ms"
47
+ expect(body).to include "<strong>12</strong> queries"
48
+ end
49
+
50
+ it 'does nothing for JS' do
51
+ app = lambda { |env| [200, {'Content-Type' => 'application/json'}, ["{'id': '1'}"] ] }
52
+ event = Event.new('test', 1, 2, '123', {})
53
+ response = Rack::LoadSpeed.new(app).call({})
54
+
55
+ body = response[2][0]
56
+ expect(body).to eq "{'id': '1'}"
57
+ end
58
+
59
+ it 'check content-length via Rack::Lint' do
60
+ app = lambda { |env| [200, {'Content-Type' => 'text/html'}, ["<html><body>snowman ☃</body></html>"]]}
61
+ loadspeed = Rack::LoadSpeed.new(app)
62
+ request = Rack::MockRequest.new(Rack::Lint.new(loadspeed))
63
+ response = request.get('/')
64
+ expect(response.status).to eq 200
65
+ end
66
+ end
@@ -18,4 +18,10 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
+
22
+ s.required_ruby_version = '>= 1.9'
23
+
24
+ # Keep the rack dependency low so we can still test 1.8.x
25
+ s.add_development_dependency "rack", "~> 1.6.5"
26
+ s.add_development_dependency "rspec", "~> 3.5.0"
21
27
  end
metadata CHANGED
@@ -1,36 +1,53 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: stopwatch
3
- version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 4
10
- version: 0.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Mark Mulder
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-11-14 00:00:00 +01:00
19
- default_executable:
20
- dependencies: []
21
-
22
- description: This gem uses Rack middleware and the Rails 3 Notification API to display page load time and amount of queries executed.
23
- email:
11
+ date: 2017-02-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.6.5
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.6.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.5.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.5.0
41
+ description: This gem uses Rack middleware and the Rails 3 Notification API to display
42
+ page load time and amount of queries executed.
43
+ email:
24
44
  - markmulder@gmail.com
25
45
  executables: []
26
-
27
46
  extensions: []
28
-
29
47
  extra_rdoc_files: []
30
-
31
- files:
32
- - .gitignore
33
- - .travis.yml
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
34
51
  - CHANGELOG
35
52
  - Gemfile
36
53
  - Gemfile.lock
@@ -40,103 +57,33 @@ files:
40
57
  - lib/stopwatch.rb
41
58
  - lib/stopwatch/event.rb
42
59
  - lib/stopwatch/log.rb
60
+ - lib/stopwatch/railtie.rb
43
61
  - lib/stopwatch/version.rb
44
- - spec/dummy/Rakefile
45
- - spec/dummy/app/controllers/application_controller.rb
46
- - spec/dummy/app/controllers/welcome_controller.rb
47
- - spec/dummy/app/helpers/application_helper.rb
48
- - spec/dummy/app/views/layouts/application.html.erb
49
- - spec/dummy/app/views/welcome/index.html.erb
50
- - spec/dummy/config.ru
51
- - spec/dummy/config/application.rb
52
- - spec/dummy/config/boot.rb
53
- - spec/dummy/config/database.yml
54
- - spec/dummy/config/environment.rb
55
- - spec/dummy/config/environments/development.rb
56
- - spec/dummy/config/environments/production.rb
57
- - spec/dummy/config/environments/test.rb
58
- - spec/dummy/config/initializers/backtrace_silencers.rb
59
- - spec/dummy/config/initializers/inflections.rb
60
- - spec/dummy/config/initializers/mime_types.rb
61
- - spec/dummy/config/initializers/secret_token.rb
62
- - spec/dummy/config/initializers/session_store.rb
63
- - spec/dummy/config/locales/en.yml
64
- - spec/dummy/config/routes.rb
65
- - spec/dummy/db/.gitkeep
66
- - spec/dummy/public/404.html
67
- - spec/dummy/public/422.html
68
- - spec/dummy/public/500.html
69
- - spec/dummy/public/favicon.ico
70
- - spec/dummy/public/javascripts/test.js
71
- - spec/dummy/public/stylesheets/.gitkeep
72
- - spec/dummy/script/rails
73
- - spec/integration/stopwatch_spec.rb
74
- - spec/spec_helper.rb
62
+ - spec/stopwatch_spec.rb
75
63
  - stopwatch.gemspec
76
64
  - stopwatch.png
77
- has_rdoc: true
78
65
  homepage: https://github.com/bittersweet/stopwatch
79
66
  licenses: []
80
-
67
+ metadata: {}
81
68
  post_install_message:
82
69
  rdoc_options: []
83
-
84
- require_paths:
70
+ require_paths:
85
71
  - lib
86
- required_ruby_version: !ruby/object:Gem::Requirement
87
- none: false
88
- requirements:
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
89
74
  - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
95
- required_rubygems_version: !ruby/object:Gem::Requirement
96
- none: false
97
- requirements:
75
+ - !ruby/object:Gem::Version
76
+ version: '1.9'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
98
79
  - - ">="
99
- - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
- version: "0"
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
104
82
  requirements: []
105
-
106
83
  rubyforge_project: stopwatch
107
- rubygems_version: 1.4.1
84
+ rubygems_version: 2.5.1
108
85
  signing_key:
109
- specification_version: 3
86
+ specification_version: 4
110
87
  summary: Show the page load duration.
111
- test_files:
112
- - spec/dummy/Rakefile
113
- - spec/dummy/app/controllers/application_controller.rb
114
- - spec/dummy/app/controllers/welcome_controller.rb
115
- - spec/dummy/app/helpers/application_helper.rb
116
- - spec/dummy/app/views/layouts/application.html.erb
117
- - spec/dummy/app/views/welcome/index.html.erb
118
- - spec/dummy/config.ru
119
- - spec/dummy/config/application.rb
120
- - spec/dummy/config/boot.rb
121
- - spec/dummy/config/database.yml
122
- - spec/dummy/config/environment.rb
123
- - spec/dummy/config/environments/development.rb
124
- - spec/dummy/config/environments/production.rb
125
- - spec/dummy/config/environments/test.rb
126
- - spec/dummy/config/initializers/backtrace_silencers.rb
127
- - spec/dummy/config/initializers/inflections.rb
128
- - spec/dummy/config/initializers/mime_types.rb
129
- - spec/dummy/config/initializers/secret_token.rb
130
- - spec/dummy/config/initializers/session_store.rb
131
- - spec/dummy/config/locales/en.yml
132
- - spec/dummy/config/routes.rb
133
- - spec/dummy/db/.gitkeep
134
- - spec/dummy/public/404.html
135
- - spec/dummy/public/422.html
136
- - spec/dummy/public/500.html
137
- - spec/dummy/public/favicon.ico
138
- - spec/dummy/public/javascripts/test.js
139
- - spec/dummy/public/stylesheets/.gitkeep
140
- - spec/dummy/script/rails
141
- - spec/integration/stopwatch_spec.rb
142
- - spec/spec_helper.rb
88
+ test_files:
89
+ - spec/stopwatch_spec.rb
@@ -1,7 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
- end
@@ -1,9 +0,0 @@
1
- class WelcomeController < ApplicationController
2
- def index
3
- end
4
-
5
- def javascript_test
6
- headers['Content-Type'] = 'application/x-javascript'
7
- render :file => "#{Rails.root}/public/javascripts/test.js", :layout => false
8
- end
9
- end
@@ -1,2 +0,0 @@
1
- module ApplicationHelper
2
- end
@@ -1,14 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</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>
@@ -1 +0,0 @@
1
- <h1>You found me</h1>
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
@@ -1,47 +0,0 @@
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
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- if File.exist?(gemfile)
5
- ENV['BUNDLE_GEMFILE'] = gemfile
6
- require 'bundler'
7
- Bundler.setup
8
- end
9
-
10
- $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,22 +0,0 @@
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
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
@@ -1,26 +0,0 @@
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
-
@@ -1,49 +0,0 @@
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
@@ -1,35 +0,0 @@
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
@@ -1,7 +0,0 @@
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!
@@ -1,10 +0,0 @@
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
@@ -1,5 +0,0 @@
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
@@ -1,7 +0,0 @@
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'
@@ -1,8 +0,0 @@
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
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,4 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- root :to => "welcome#index"
3
- match '/javascript_test', :to => "welcome#javascript_test"
4
- end
File without changes
@@ -1,26 +0,0 @@
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>
@@ -1,26 +0,0 @@
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>
@@ -1,26 +0,0 @@
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
@@ -1 +0,0 @@
1
- str = "<body> this is a test</body>";
File without changes
@@ -1,6 +0,0 @@
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'
@@ -1,15 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Navigation" do
4
- include Capybara::DSL
5
-
6
- it "renders the stopwatch box" do
7
- visit "/"
8
- page.should have_css("#performance_code")
9
- end
10
-
11
- it "does not insert html" do
12
- visit "/javascript_test"
13
- page.should_not have_css("#performance_code")
14
- end
15
- end
@@ -1,30 +0,0 @@
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