logical-insight 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/History.txt +45 -0
  2. data/MIT-LICENSE.txt +19 -0
  3. data/README.md +123 -0
  4. data/Rakefile +24 -0
  5. data/Thorfile +113 -0
  6. data/lib/insight.rb +17 -0
  7. data/lib/insight/app.rb +189 -0
  8. data/lib/insight/database.rb +186 -0
  9. data/lib/insight/enable-button.rb +43 -0
  10. data/lib/insight/filtered_backtrace.rb +45 -0
  11. data/lib/insight/instrumentation.rb +9 -0
  12. data/lib/insight/instrumentation/backstage.rb +10 -0
  13. data/lib/insight/instrumentation/client.rb +20 -0
  14. data/lib/insight/instrumentation/instrument.rb +109 -0
  15. data/lib/insight/instrumentation/package-definition.rb +58 -0
  16. data/lib/insight/instrumentation/probe-definition.rb +20 -0
  17. data/lib/insight/instrumentation/probe.rb +199 -0
  18. data/lib/insight/instrumentation/setup.rb +32 -0
  19. data/lib/insight/logger.rb +55 -0
  20. data/lib/insight/options.rb +102 -0
  21. data/lib/insight/panel.rb +119 -0
  22. data/lib/insight/panel_app.rb +31 -0
  23. data/lib/insight/panels-content.rb +22 -0
  24. data/lib/insight/panels-header.rb +18 -0
  25. data/lib/insight/panels/active_record_panel.rb +46 -0
  26. data/lib/insight/panels/cache_panel.rb +69 -0
  27. data/lib/insight/panels/cache_panel/panel_app.rb +46 -0
  28. data/lib/insight/panels/cache_panel/stats.rb +98 -0
  29. data/lib/insight/panels/log_panel.rb +54 -0
  30. data/lib/insight/panels/memory_panel.rb +32 -0
  31. data/lib/insight/panels/rails_info_panel.rb +19 -0
  32. data/lib/insight/panels/redis_panel.rb +42 -0
  33. data/lib/insight/panels/redis_panel/redis_extension.rb +23 -0
  34. data/lib/insight/panels/redis_panel/stats.rb +50 -0
  35. data/lib/insight/panels/request_variables_panel.rb +70 -0
  36. data/lib/insight/panels/speedtracer_panel.rb +89 -0
  37. data/lib/insight/panels/speedtracer_panel/trace-app.rb +52 -0
  38. data/lib/insight/panels/speedtracer_panel/tracer.rb +212 -0
  39. data/lib/insight/panels/sql_panel.rb +53 -0
  40. data/lib/insight/panels/sql_panel/panel_app.rb +37 -0
  41. data/lib/insight/panels/sql_panel/query.rb +94 -0
  42. data/lib/insight/panels/templates_panel.rb +58 -0
  43. data/lib/insight/panels/templates_panel/rendering.rb +81 -0
  44. data/lib/insight/panels/timer_panel.rb +40 -0
  45. data/lib/insight/params_signature.rb +61 -0
  46. data/lib/insight/public/__insight__/bookmarklet.html +10 -0
  47. data/lib/insight/public/__insight__/bookmarklet.js +223 -0
  48. data/lib/insight/public/__insight__/insight.css +235 -0
  49. data/lib/insight/public/__insight__/insight.js +123 -0
  50. data/lib/insight/public/__insight__/jquery-1.3.2.js +4376 -0
  51. data/lib/insight/public/__insight__/jquery.tablesorter.min.js +1 -0
  52. data/lib/insight/public/__insight__/spinner.gif +0 -0
  53. data/lib/insight/rack_static_bug_avoider.rb +16 -0
  54. data/lib/insight/redirect_interceptor.rb +25 -0
  55. data/lib/insight/render.rb +72 -0
  56. data/lib/insight/request-recorder.rb +23 -0
  57. data/lib/insight/toolbar.rb +63 -0
  58. data/lib/insight/views/enable-button.html.erb +1 -0
  59. data/lib/insight/views/error.html.erb +17 -0
  60. data/lib/insight/views/headers_fragment.html.erb +20 -0
  61. data/lib/insight/views/panels/active_record.html.erb +17 -0
  62. data/lib/insight/views/panels/cache.html.erb +93 -0
  63. data/lib/insight/views/panels/execute_sql.html.erb +32 -0
  64. data/lib/insight/views/panels/explain_sql.html.erb +32 -0
  65. data/lib/insight/views/panels/log.html.erb +21 -0
  66. data/lib/insight/views/panels/profile_sql.html.erb +32 -0
  67. data/lib/insight/views/panels/rails_info.html.erb +19 -0
  68. data/lib/insight/views/panels/redis.html.erb +46 -0
  69. data/lib/insight/views/panels/request_variables.html.erb +25 -0
  70. data/lib/insight/views/panels/speedtracer/serverevent.html.erb +10 -0
  71. data/lib/insight/views/panels/speedtracer/servertrace.html.erb +12 -0
  72. data/lib/insight/views/panels/speedtracer/traces.html.erb +18 -0
  73. data/lib/insight/views/panels/sql.html.erb +43 -0
  74. data/lib/insight/views/panels/templates.html.erb +6 -0
  75. data/lib/insight/views/panels/timer.html.erb +19 -0
  76. data/lib/insight/views/panels/view_cache.html.erb +19 -0
  77. data/lib/insight/views/redirect.html.erb +16 -0
  78. data/lib/insight/views/request_fragment.html.erb +25 -0
  79. data/lib/insight/views/toolbar.html.erb +29 -0
  80. data/lib/logical-insight.rb +1 -0
  81. data/spec/custom_matchers.rb +31 -0
  82. data/spec/fixtures/config.ru +8 -0
  83. data/spec/fixtures/dummy_panel.rb +2 -0
  84. data/spec/fixtures/sample_app.rb +72 -0
  85. data/spec/insight/panels/active_record_panel_spec.rb +42 -0
  86. data/spec/insight/panels/cache_panel_spec.rb +176 -0
  87. data/spec/insight/panels/log_panel_spec.rb +44 -0
  88. data/spec/insight/panels/memory_panel_spec.rb +19 -0
  89. data/spec/insight/panels/mongo_panel_spec_pending.rb +50 -0
  90. data/spec/insight/panels/rails_info_panel_spec.rb +27 -0
  91. data/spec/insight/panels/redis_panel_spec.rb +66 -0
  92. data/spec/insight/panels/sql_panel_spec.rb +145 -0
  93. data/spec/insight/panels/templates_panel_spec.rb +84 -0
  94. data/spec/insight/panels/timer_panel_spec.rb +36 -0
  95. data/spec/insight_spec.rb +141 -0
  96. data/spec/instrumentation_spec.rb +188 -0
  97. data/spec/rcov.opts +1 -0
  98. data/spec/spec.opts +1 -0
  99. data/spec/spec_helper.rb +93 -0
  100. metadata +187 -0
data/spec/rcov.opts ADDED
@@ -0,0 +1 @@
1
+ -x gems,spec\/
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,93 @@
1
+ require "rubygems"
2
+ require "webrat"
3
+ require "rack/test"
4
+
5
+ RAILS_ENV = "test"
6
+
7
+ $LOAD_PATH.unshift File.dirname(File.dirname(__FILE__)) + '/lib'
8
+ $LOAD_PATH.unshift File.dirname(File.dirname(__FILE__))
9
+
10
+ require "insight"
11
+ require "spec/fixtures/sample_app"
12
+ require "spec/fixtures/dummy_panel"
13
+ require "spec/custom_matchers"
14
+
15
+ RSpec.configure do |config|
16
+ TIME_MS_REGEXP = /\d+\.\d{2}ms/
17
+
18
+ config.include Rack::Test::Methods
19
+ config.include Webrat::Matchers
20
+ config.include CustomMatchers
21
+
22
+ config.before do
23
+ Thread.current["insight.logger"] = Insight::Logger.new(Logger::FATAL, "")
24
+ @added_constants = []
25
+ end
26
+
27
+ config.after do
28
+ @added_constants.each do |parent, added|
29
+ parent.send :remove_const, added
30
+ end
31
+ @added_constants.clear
32
+ end
33
+
34
+ def reset_insight(options=nil)
35
+ system(*%w{rm -f insight.sqlite})
36
+
37
+ Insight::Database.reset
38
+
39
+ app.prototype
40
+ app.insight_app.reset(options)
41
+
42
+ Insight.enable
43
+
44
+ set_cookie "insight_enabled=1"
45
+ end
46
+
47
+ def app
48
+ SampleApp
49
+ end
50
+
51
+ def mock_constant(name)
52
+ parts = name.split("::")
53
+ klass = parts.pop
54
+ mod = parts.inject(Object) do |const, part|
55
+ begin
56
+ const.const_get(part)
57
+ rescue NameError
58
+ @added_constants << [const, part]
59
+ mod = Module.new
60
+ const.const_set(part.to_sym, mod)
61
+ mod
62
+ end
63
+ end
64
+ begin
65
+ mod.const_get(klass)
66
+ rescue NameError
67
+ mod.const_set(klass, Class.new)
68
+ end
69
+ end
70
+
71
+ def mock_method_call(context, method, args=[], kind=:instance, object=Object.new, &block)
72
+ mock_constant(context)
73
+
74
+ called_at = caller[0]
75
+ file, line, real_method = called_at.split(":")
76
+ called_at = [file,line,method].join(":")
77
+
78
+ block ||= proc {}
79
+
80
+ Insight::Instrumentation::Probe::ProbeRunner.probe_run(
81
+ object, context, kind, args, called_at, method, &block)
82
+ end
83
+
84
+ def rack_env(key, value)
85
+ @rack_env ||= {}
86
+ @rack_env[key] = value
87
+ end
88
+
89
+ def get_via_rack(uri, params = {}, env = {}, &block)
90
+ env = env.merge(@rack_env) if @rack_env
91
+ get(uri, params, env, &block)
92
+ end
93
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logical-insight
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.4.0
6
+ platform: ruby
7
+ authors:
8
+ - Bryan Helmkamp
9
+ - Evan Dorn
10
+ - Judson Lester
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2011-05-02 00:00:00 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: uuid
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ segments:
25
+ - 2
26
+ - 3
27
+ - 1
28
+ version: 2.3.1
29
+ type: :runtime
30
+ prerelease: false
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: sqlite3
34
+ requirement: &id002 !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 1
41
+ - 3
42
+ - 3
43
+ version: 1.3.3
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *id002
47
+ description: "Debugging toolbar for Rack applications implemented as\n middleware. Rails 3 compatible version maintained by Logical Reality\n Design. "
48
+ email: evan@lrdesign.com judson@lrdesign.com
49
+ executables: []
50
+
51
+ extensions: []
52
+
53
+ extra_rdoc_files:
54
+ - README.md
55
+ - MIT-LICENSE.txt
56
+ files:
57
+ - lib/logical-insight.rb
58
+ - lib/insight.rb
59
+ - lib/insight/rack_static_bug_avoider.rb
60
+ - lib/insight/toolbar.rb
61
+ - lib/insight/views/request_fragment.html.erb
62
+ - lib/insight/views/enable-button.html.erb
63
+ - lib/insight/views/redirect.html.erb
64
+ - lib/insight/views/headers_fragment.html.erb
65
+ - lib/insight/views/panels/rails_info.html.erb
66
+ - lib/insight/views/panels/execute_sql.html.erb
67
+ - lib/insight/views/panels/timer.html.erb
68
+ - lib/insight/views/panels/view_cache.html.erb
69
+ - lib/insight/views/panels/speedtracer/serverevent.html.erb
70
+ - lib/insight/views/panels/speedtracer/traces.html.erb
71
+ - lib/insight/views/panels/speedtracer/servertrace.html.erb
72
+ - lib/insight/views/panels/sql.html.erb
73
+ - lib/insight/views/panels/templates.html.erb
74
+ - lib/insight/views/panels/explain_sql.html.erb
75
+ - lib/insight/views/panels/log.html.erb
76
+ - lib/insight/views/panels/active_record.html.erb
77
+ - lib/insight/views/panels/cache.html.erb
78
+ - lib/insight/views/panels/request_variables.html.erb
79
+ - lib/insight/views/panels/profile_sql.html.erb
80
+ - lib/insight/views/panels/redis.html.erb
81
+ - lib/insight/views/toolbar.html.erb
82
+ - lib/insight/views/error.html.erb
83
+ - lib/insight/options.rb
84
+ - lib/insight/panel.rb
85
+ - lib/insight/logger.rb
86
+ - lib/insight/database.rb
87
+ - lib/insight/panels-header.rb
88
+ - lib/insight/filtered_backtrace.rb
89
+ - lib/insight/panels-content.rb
90
+ - lib/insight/enable-button.rb
91
+ - lib/insight/instrumentation.rb
92
+ - lib/insight/app.rb
93
+ - lib/insight/panels/request_variables_panel.rb
94
+ - lib/insight/panels/redis_panel.rb
95
+ - lib/insight/panels/rails_info_panel.rb
96
+ - lib/insight/panels/sql_panel/panel_app.rb
97
+ - lib/insight/panels/sql_panel/query.rb
98
+ - lib/insight/panels/cache_panel/panel_app.rb
99
+ - lib/insight/panels/cache_panel/stats.rb
100
+ - lib/insight/panels/timer_panel.rb
101
+ - lib/insight/panels/redis_panel/redis_extension.rb
102
+ - lib/insight/panels/redis_panel/stats.rb
103
+ - lib/insight/panels/sql_panel.rb
104
+ - lib/insight/panels/templates_panel.rb
105
+ - lib/insight/panels/log_panel.rb
106
+ - lib/insight/panels/speedtracer_panel/trace-app.rb
107
+ - lib/insight/panels/speedtracer_panel/tracer.rb
108
+ - lib/insight/panels/active_record_panel.rb
109
+ - lib/insight/panels/cache_panel.rb
110
+ - lib/insight/panels/speedtracer_panel.rb
111
+ - lib/insight/panels/templates_panel/rendering.rb
112
+ - lib/insight/panels/memory_panel.rb
113
+ - lib/insight/request-recorder.rb
114
+ - lib/insight/public/__insight__/bookmarklet.html
115
+ - lib/insight/public/__insight__/bookmarklet.js
116
+ - lib/insight/public/__insight__/spinner.gif
117
+ - lib/insight/public/__insight__/insight.css
118
+ - lib/insight/public/__insight__/jquery.tablesorter.min.js
119
+ - lib/insight/public/__insight__/insight.js
120
+ - lib/insight/public/__insight__/jquery-1.3.2.js
121
+ - lib/insight/redirect_interceptor.rb
122
+ - lib/insight/panel_app.rb
123
+ - lib/insight/instrumentation/instrument.rb
124
+ - lib/insight/instrumentation/package-definition.rb
125
+ - lib/insight/instrumentation/backstage.rb
126
+ - lib/insight/instrumentation/client.rb
127
+ - lib/insight/instrumentation/setup.rb
128
+ - lib/insight/instrumentation/probe.rb
129
+ - lib/insight/instrumentation/probe-definition.rb
130
+ - lib/insight/params_signature.rb
131
+ - lib/insight/render.rb
132
+ - spec/custom_matchers.rb
133
+ - spec/spec_helper.rb
134
+ - spec/instrumentation_spec.rb
135
+ - spec/fixtures/config.ru
136
+ - spec/fixtures/dummy_panel.rb
137
+ - spec/fixtures/sample_app.rb
138
+ - spec/spec.opts
139
+ - spec/insight_spec.rb
140
+ - spec/insight/panels/mongo_panel_spec_pending.rb
141
+ - spec/insight/panels/active_record_panel_spec.rb
142
+ - spec/insight/panels/redis_panel_spec.rb
143
+ - spec/insight/panels/templates_panel_spec.rb
144
+ - spec/insight/panels/memory_panel_spec.rb
145
+ - spec/insight/panels/timer_panel_spec.rb
146
+ - spec/insight/panels/sql_panel_spec.rb
147
+ - spec/insight/panels/rails_info_panel_spec.rb
148
+ - spec/insight/panels/log_panel_spec.rb
149
+ - spec/insight/panels/cache_panel_spec.rb
150
+ - spec/rcov.opts
151
+ - History.txt
152
+ - MIT-LICENSE.txt
153
+ - README.md
154
+ - Rakefile
155
+ - Thorfile
156
+ homepage: http://github.com/lrdesign/lrd_rack_bug
157
+ licenses: []
158
+
159
+ post_install_message:
160
+ rdoc_options: []
161
+
162
+ require_paths:
163
+ - lib
164
+ required_ruby_version: !ruby/object:Gem::Requirement
165
+ none: false
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ hash: -1022035059
170
+ segments:
171
+ - 0
172
+ version: "0"
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "0"
179
+ requirements: []
180
+
181
+ rubyforge_project:
182
+ rubygems_version: 1.8.11
183
+ signing_key:
184
+ specification_version: 3
185
+ summary: Debugging toolbar for Rack applications implemented as middleware. Rails 3 compatible version maintained by Logical Reality Design.
186
+ test_files: []
187
+