rack-insight 0.5.27 → 0.5.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/CHANGELOG +32 -0
  2. data/README.md +32 -7
  3. data/lib/rack/insight/app.rb +5 -0
  4. data/lib/rack/insight/config.rb +6 -2
  5. data/lib/rack/insight/enable-button.rb +3 -4
  6. data/lib/rack/insight/panels/request_variables_panel.rb +4 -1
  7. data/lib/rack/insight/public/__insight__/insight.js +134 -128
  8. data/lib/rack/insight/toolbar.rb +9 -6
  9. data/lib/rack/insight/version.rb +1 -1
  10. data/lib/rack/insight/views/toolbar.html.erb +11 -9
  11. metadata +69 -105
  12. checksums.yaml +0 -7
  13. data/.gitignore +0 -13
  14. data/.rspec +0 -1
  15. data/.ruby-gemset +0 -1
  16. data/.ruby-version +0 -1
  17. data/.simplecov +0 -4
  18. data/.travis.yml +0 -10
  19. data/Gemfile +0 -3
  20. data/Gemfile.lock +0 -69
  21. data/TODO +0 -9
  22. data/rack-insight.gemspec +0 -42
  23. data/spec/custom_matchers.rb +0 -0
  24. data/spec/fixtures/config.ru +0 -8
  25. data/spec/fixtures/dummy_panel.rb +0 -2
  26. data/spec/fixtures/sample_app.rb +0 -72
  27. data/spec/fixtures/star_trek_panel.rb +0 -6
  28. data/spec/fixtures/views/star_trek.html.erb +0 -17
  29. data/spec/insight_spec.rb +0 -166
  30. data/spec/instrumentation_spec.rb +0 -231
  31. data/spec/rack/insight/config_spec.rb +0 -22
  32. data/spec/rack/insight/panels/active_record_panel_spec.rb +0 -44
  33. data/spec/rack/insight/panels/active_resource_panel_spec.rb +0 -40
  34. data/spec/rack/insight/panels/cache_panel_spec.rb +0 -179
  35. data/spec/rack/insight/panels/log_panel_spec.rb +0 -43
  36. data/spec/rack/insight/panels/memory_panel_spec.rb +0 -21
  37. data/spec/rack/insight/panels/mongo_panel_spec_pending.rb +0 -52
  38. data/spec/rack/insight/panels/rails_info_panel_spec.rb +0 -30
  39. data/spec/rack/insight/panels/redis_panel_spec.rb +0 -82
  40. data/spec/rack/insight/panels/speedtracer_panel_spec.rb +0 -87
  41. data/spec/rack/insight/panels/sql_panel_spec.rb +0 -150
  42. data/spec/rack/insight/panels/templates_panel_spec.rb +0 -88
  43. data/spec/rack/insight/panels/timer_panel_spec.rb +0 -39
  44. data/spec/rcov.opts +0 -1
  45. data/spec/spec.opts +0 -1
  46. data/spec/spec_helper.rb +0 -120
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 9014b272efd1a4dacfded3cd104d90138f3e862c
4
- data.tar.gz: 737f8d87ce64751c2d453cef210c2ba104cf022a
5
- SHA512:
6
- metadata.gz: 0e824b8ff9e415506009c9445d938dda476b3b9c6effb38f7c9b74d6e11936f92df929017b51bcd4ecb0a05c8c5999a0c42dc29d8c9fa78f42807d8c4b6a60a3
7
- data.tar.gz: f92a70fa12747312cc057ddcbb40ae29123d541fb9f5a2fc5d33d9046456c1086e9932e07d8d6b2f3981da79c17341a67157e3739cab7ca29493f9178a6a1461
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- *.sw?
2
- *.gem
3
- .bundle/
4
- .conductor/
5
- corundum/
6
- doc/
7
- rack-insight-test.log
8
- rack-insight.sqlite
9
- notions-and-tests/
10
- pkg/
11
- .sass-cache/
12
- .yardoc/
13
- gh-pages/
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- foss
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-1.9.3-p448
data/.simplecov DELETED
@@ -1,4 +0,0 @@
1
- SimpleCov.start do
2
- coverage_dir "corundum/docs/coverage"
3
- add_filter "./spec"
4
- end
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 1.9.3
5
- - 1.9.2
6
- # - jruby-19mode # Fails to install sqlite3
7
- # - rbx-19mode
8
- # - ruby-head # Fails to download rubygems.org/latest_specs.4.8.gz
9
- # - jruby-head # Fails to install sqlite3
10
- bundler_args: "--binstubs --without documentation"
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/Gemfile.lock DELETED
@@ -1,69 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- rack-insight (0.5.26)
5
- rack
6
- sqlite3 (>= 1.3.3)
7
- uuidtools (>= 2.1.2)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- diff-lcs (1.2.4)
13
- gem-release (0.6.0)
14
- mini_portile (0.5.1)
15
- nokogiri (1.6.0)
16
- mini_portile (~> 0.5.0)
17
- rack (1.5.2)
18
- rack-protection (1.5.0)
19
- rack
20
- rack-test (0.6.2)
21
- rack (>= 1.0)
22
- rake (10.1.0)
23
- reek (1.2.13)
24
- ripper_ruby_parser (~> 0.0.7)
25
- ruby2ruby (~> 1.2.5)
26
- ruby_parser (~> 2.0)
27
- sexp_processor (~> 3.0)
28
- ripper_ruby_parser (0.0.8)
29
- sexp_processor (~> 3.0)
30
- roodi (2.2.0)
31
- ruby_parser (~> 2.3.0)
32
- rspec (2.14.1)
33
- rspec-core (~> 2.14.0)
34
- rspec-expectations (~> 2.14.0)
35
- rspec-mocks (~> 2.14.0)
36
- rspec-core (2.14.4)
37
- rspec-expectations (2.14.0)
38
- diff-lcs (>= 1.1.3, < 2.0)
39
- rspec-mocks (2.14.2)
40
- ruby2ruby (1.2.5)
41
- ruby_parser (~> 2.0)
42
- sexp_processor (~> 3.0)
43
- ruby_parser (2.3.1)
44
- sexp_processor (~> 3.0)
45
- sexp_processor (3.2.0)
46
- sinatra (1.4.3)
47
- rack (~> 1.4)
48
- rack-protection (~> 1.4)
49
- tilt (~> 1.3, >= 1.3.4)
50
- sqlite3 (1.3.7)
51
- tilt (1.4.1)
52
- uuidtools (2.1.4)
53
- webrat (0.7.3)
54
- nokogiri (>= 1.2.0)
55
- rack (>= 1.0)
56
- rack-test (>= 0.5.3)
57
-
58
- PLATFORMS
59
- ruby
60
-
61
- DEPENDENCIES
62
- gem-release (>= 0.6.0)
63
- rack-insight!
64
- rake (>= 10.1.0)
65
- reek (>= 1.2.13)
66
- roodi (>= 2.2.0)
67
- rspec (>= 2.14.1)
68
- sinatra (>= 1.4.3)
69
- webrat (>= 0.7.3)
data/TODO DELETED
@@ -1,9 +0,0 @@
1
- Speedtracer Resymbolization: seems like it would be possible to get Speedtracer to pull up the Ruby code that was slow... ????
2
-
3
- Speedtracer call tagging: right now we just say "everything is either HTTP or METHOD" - maybe more accurate tagging would be useful.
4
-
5
- Config: panels in required files automatically turned on - explicit exclude?
6
-
7
- Config: Explore other parts that may benefit from a config option.
8
-
9
- UUID: Allow re-use of the Rails UUID set in middleware. How?
data/rack-insight.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/rack/insight/version', __FILE__)
3
-
4
- Gem::Specification.new do |s|
5
- s.name = %q{rack-insight}
6
- s.version = Rack::Insight::VERSION
7
-
8
- s.authors = ["Peter Boling", "Evan Dorn", "Judson Lester", "Bryan Helmkamp"]
9
- s.email = %w{peter.boling@gmail.com}
10
- s.extra_rdoc_files = [
11
- "README.md",
12
- "LICENSE",
13
- "CHANGELOG"
14
- ]
15
-
16
- s.files = `git ls-files`.split($\)
17
- s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
- s.require_paths = ["lib"]
20
-
21
- s.licenses = ["MIT"]
22
- s.platform = Gem::Platform::RUBY
23
-
24
- s.homepage = "https://github.com/pboling/rack-insight"
25
- s.summary = %q{Debugging toolbar for Rack applications implemented as
26
- middleware.}
27
- s.description = %q{Debugging toolbar for Rack applications implemented as
28
- middleware. Based on logical-insight and rack-bug. }
29
-
30
- s.add_runtime_dependency("rack")
31
- s.add_runtime_dependency("uuidtools", ">= 2.1.2") # incurs far fewer dependencies that the uuid gem, and no shell forking
32
- s.add_runtime_dependency("sqlite3", ">= 1.3.3")
33
- #s.add_development_dependency "redcarpet", ">= 3.0.0"
34
- s.add_development_dependency(%q<reek>, [">= 1.2.13"])
35
- s.add_development_dependency(%q<roodi>, [">= 2.2.0"])
36
- s.add_development_dependency(%q<rake>, [">= 10.1.0"])
37
- s.add_development_dependency "rspec", ">= 2.14.1"
38
- s.add_development_dependency "sinatra", ">= 1.4.3"
39
- s.add_development_dependency "webrat", ">= 0.7.3"
40
- #s.add_development_dependency "debugger", ">= 1.6.1"
41
- s.add_development_dependency "gem-release", ">= 0.6.0"
42
- end
File without changes
@@ -1,8 +0,0 @@
1
- require "rubygems"
2
-
3
- $LOAD_PATH.unshift File.dirname(__FILE__)
4
- require "sample_app"
5
-
6
- #Example usage, but moved inside sample app for easier testing
7
- #use Rack::Bug, :password => "secret"
8
- run SampleApp
@@ -1,2 +0,0 @@
1
- class DummyPanel < Rack::Insight::Panel
2
- end
@@ -1,72 +0,0 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
- require "sinatra/base"
3
- require 'logger'
4
-
5
- RAILS_ENV = "development" unless defined?(RAILS_ENV)
6
- log_to = RAILS_ENV == "test" ? StringIO.new : STDOUT
7
- LOGGER = Logger.new(log_to)
8
-
9
- class SampleApp < Sinatra::Base
10
- class OneLastThing
11
- def initialize(app)
12
- @app = app
13
- end
14
-
15
- def call(env)
16
- st,hd,bd = @app.call(env)
17
- unless SampleApp.before_returning.nil?
18
- SampleApp.before_returning.call
19
- SampleApp.before_returning = nil
20
- end
21
- return st,hd,bd
22
- end
23
- end
24
-
25
- class << self
26
- attr_accessor :insight_app
27
- attr_accessor :before_returning
28
- def before_return(&block)
29
- self.before_returning = block
30
- end
31
- end
32
-
33
-
34
-
35
- use Rack::Insight::App, :log_path => "rack-insight-test.log", :on_initialize => proc {|app|
36
- self.insight_app = app
37
- }
38
- use OneLastThing
39
-
40
- set :environment, 'test'
41
-
42
- configure :test do
43
- set :raise_errors, true
44
- end
45
-
46
- get "/redirect" do
47
- redirect "/"
48
- end
49
-
50
- get "/error" do
51
- raise "Error!"
52
- end
53
-
54
- get "/" do
55
- if params[:content_type]
56
- headers["Content-Type"] = params[:content_type]
57
- end
58
- LOGGER.error "I am a log message"
59
- <<-HTML
60
- <html>
61
- <head>
62
- </head>
63
- <body>
64
- <p>Hello</p>
65
- <p><a href="__insight__/bookmarklet.html">Page with bookmarklet for enabling Rack::Insight</a></p>
66
- <p><a href="/error">Page with an error to check insight not rescuing errors</a></p>
67
- </body>
68
- </html>
69
- HTML
70
- end
71
-
72
- end
@@ -1,6 +0,0 @@
1
- class StarTrekPanel < Rack::Insight::Panel;
2
-
3
- def content_for_request(number)
4
- render_template "views/star_trek", :stats => {:captain => "Kirk", :ship => "Enterprise"}
5
- end
6
- end
@@ -1,17 +0,0 @@
1
- <h3>StarTrek Panel!</h3>
2
- <table id="StarTrek">
3
- <thead>
4
- <tr>
5
- <th>
6
- <%= stats[:ship] %>
7
- </th>
8
- </tr>
9
- </thead>
10
- <tbody>
11
- <tr>
12
- <td>
13
- <%= stats[:captain] %>
14
- </td>
15
- </tr>
16
- </tbody>
17
- </table>
data/spec/insight_spec.rb DELETED
@@ -1,166 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Rack::Insight do
4
- before :each do
5
- reset_insight
6
- end
7
-
8
- it "inserts the Rack::Insight toolbar" do
9
- response = get "/"
10
- response.should have_selector("div#rack-insight")
11
- end
12
-
13
- it "updates the Content-Length" do
14
- response = get "/"
15
- response["Content-Length"].should == response.body.size.to_s
16
- end
17
-
18
- it "serves the Rack::Insight assets under /__insight__/" do
19
- response = get "/__insight__/insight.css"
20
- response.should be_ok
21
- end
22
-
23
- it "modifies HTML responses with a charset" do
24
- response = get "/", :content_type => "application/xhtml+xml; charset=utf-8"
25
- response.should have_selector("div#rack-insight")
26
- end
27
-
28
- it "does not modify XMLHttpRequest responses" do
29
- response = get "/", {}, { :xhr => true }
30
- response.should_not have_selector("div#rack-insight")
31
- end
32
-
33
- it "modifies XHTML responses" do
34
- response = get "/", :content_type => "application/xhtml+xml"
35
- response.should have_selector("div#rack-insight")
36
- end
37
-
38
- it "does not modify non-HTML responses" do
39
- response = get "/", :content_type => "text/csv"
40
- response.should_not have_selector("div#rack-insight")
41
- end
42
-
43
- it "does not modify server errors" do
44
- app.disable :raise_errors
45
- response = get "/error"
46
- app.enable :raise_errors
47
- response.should_not have_selector("div#rack-insight")
48
- end
49
-
50
- context "redirected when not configured to intercept redirects" do
51
- it "passes the redirect unmodified" do
52
- response = get "/redirect"
53
- response.status.should == 302
54
- end
55
-
56
- it "does not show the interception page" do
57
- response = get "/redirect"
58
- response.body.should_not contain("Location: /")
59
- end
60
-
61
- it "does not insert the toolbar" do
62
- header 'cookie', ""
63
- response = get "/redirect"
64
- response.should_not have_selector("div#rack-insight")
65
- end
66
-
67
- it "does not insert the toolbar if even toolbar requested" do
68
- response = get "/redirect"
69
- response.should_not have_selector("div#rack-insight")
70
- end
71
- end
72
-
73
- context "redirected when configured to intercept redirects" do
74
- before :each do
75
- app.insight_app.intercept_redirects = true
76
- end
77
-
78
- it "shows the interception page" do
79
- response = get "/redirect"
80
- response.should have_selector("div#rack-insight")
81
- end
82
-
83
- it "should provide a link to the target URL" do
84
- response = get "/redirect"
85
- response.should have_selector("a[href='http://example.org/']")
86
- end
87
-
88
- it "inserts the toolbar if requested" do
89
- response = get "/redirect"
90
- response.should have_selector("div#rack-insight")
91
- end
92
-
93
- it "does not inserts the toolbar if not requested" do
94
- header 'cookie', ""
95
- response = get "/redirect"
96
- response.should_not have_selector("div#rack-insight")
97
- end
98
- end
99
-
100
- context "configured with an IP address restriction" do
101
- before do
102
- app.insight_app.ip_masks = [IPAddr.new("127.0.0.1/255.255.255.0")]
103
- end
104
-
105
- it "inserts the Rack::Insight toolbar when the IP matches" do
106
- response = get_via_rack "/", {}, "REMOTE_ADDR" => "127.0.0.2"
107
- response.should have_selector("div#rack-insight")
108
- end
109
-
110
- it "is disabled when the IP doesn't match" do
111
- response = get_via_rack "/", {}, "REMOTE_ADDR" => "128.0.0.1"
112
- response.should_not have_selector("div#rack-insight")
113
- end
114
-
115
- it "doesn't use any panels" do
116
- DummyPanel.should_not_receive(:new)
117
- app.insight_app.panel_classes = [DummyPanel]
118
- get_via_rack "/", {}, "REMOTE_ADDR" => "128.0.0.1"
119
- end
120
- end
121
-
122
- context "configured with a password" do
123
- before do
124
- app.insight_app.password = "secret"
125
- end
126
-
127
- it "should insert the Rack::Insight toolbar when the password matches" do
128
- sha = Digest::SHA1.hexdigest ["rack-insight", "secret"].join(":")
129
- set_cookie ["rack-insight_enabled=1", "rack-insight_password=#{sha}"]
130
- response = get_via_rack "/"
131
- response.should have_selector("div#rack-insight")
132
- end
133
-
134
- it "should be disabled when the password doesn't match" do
135
- response = get_via_rack "/"
136
- response.should_not have_selector("div#rack-insight")
137
- end
138
- it "doesn't use any panels" do
139
- DummyPanel.should_not_receive(:new)
140
- app.insight_app.panel_classes = [DummyPanel]
141
- get_via_rack "/"
142
- end
143
- end
144
-
145
- # These specs are no longer applicable, since reset_insight no longer clears the sqlite database.
146
- # Clearing of the database is now accomplished in a *config.after :suite do* block
147
-
148
- #context "configured with a SQLite database file path" do
149
- # before do
150
- # # We need to pass the SQLite database file path to the gem
151
- # require 'fileutils'
152
- # FileUtils.rm_rf("my_custom_db_path.sqlite") #because it doesn't count if it's already there
153
- # reset_insight :database_path => 'my_custom_db_path.sqlite'
154
- # end
155
- #
156
- # it "should create a database at the path specified in the options" do
157
- # File.exist?('my_custom_db_path.sqlite').should be_true
158
- # end
159
- #
160
- # after do
161
- # FileUtils.rm_rf("my_custom_db_path.sqlite")
162
- # reset_insight :database_path => nil
163
- # end
164
- #
165
- #end
166
- end