logical-insight 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  Insight
2
2
  =========
3
3
 
4
- Insight began life as an LRDesign fork of Insight. We started a fork because the main project wasn't making progress on Rails 3 support. Having made really significant archetectural changes, we'll be keeping Insight a separate project for the forseeable future.
4
+ Insight began life as an LRDesign fork of Rack::Bug by brynary. We started a fork because, at the time, the main project wasn't making progress on Rails 3 support. Since then we've rewritten a lot of the code to make it more modular, easier to extend, and to store information about multiple requests so you can use it to inspect your AJAX requests (or any past request), not just previous page loads.
5
+
6
+ Having made really significant architectural changes, we'll be keeping Insight a separate project for the forseeable future.
5
7
 
6
8
  * Forked From: [http://github.com/brynary/rack-bug](http://github.com/brynary/rack-bug)
7
9
 
@@ -9,7 +11,8 @@ Description
9
11
  -----------
10
12
 
11
13
  Insight adds a diagnostics toolbar to Rack apps. When enabled, it injects a floating div
12
- allowing exploration of logging, database queries, template rendering times, etc.
14
+ allowing exploration of logging, database queries, template rendering times, etc. Insight
15
+ stores debugging info over many requests, incuding AJAX requests.
13
16
 
14
17
  Features
15
18
  --------
@@ -47,10 +50,10 @@ Add this to your Gemfile
47
50
 
48
51
  In config/environments/development.rb, add:
49
52
 
50
- config.middleware.use "Insight",
53
+ config.middleware.use "Insight::App",
51
54
  :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring"
52
55
 
53
- Any environment with Insight loaded will have a link to "Insight" in the upper left. Clicking that link will load the toolbar.
56
+ Any environment with Insight loaded will have a link to "Insight" added to as the last child of BODY to normal responses. Clicking that link will load the toolbar. It's set with an id of "logical-insight-enabler", so it can be styled to go somewhere more noticeable. E.g. "position: absolute; top: 0; left: 0"
54
57
 
55
58
  Using with non-Rails Rack apps
56
59
  ------------------------------
@@ -64,9 +67,9 @@ Configuring custom panels
64
67
 
65
68
  Specify the set of panels you want, in the order you want them to appear:
66
69
 
67
- require "rack/bug"
70
+ require "logical-insight"
68
71
 
69
- ActionController::Dispatcher.middleware.use Insight,
72
+ ActionController::Dispatcher.middleware.use "Insight::App",
70
73
  :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
71
74
  :panel_files => %w[
72
75
  timer_panel
@@ -94,26 +97,34 @@ Restrict access to particular IP addresses:
94
97
 
95
98
  require "ipaddr"
96
99
 
97
- ActionController::Dispatcher.middleware.use "Insight"
100
+ ActionController::Dispatcher.middleware.use "Insight::App"
98
101
  :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
99
102
  :ip_masks => [IPAddr.new("2.2.2.2/0")]
100
103
 
101
104
  Restrict access using a password:
102
105
 
103
- ActionController::Dispatcher.middleware.use "Insight",
106
+ ActionController::Dispatcher.middleware.use "Insight::App",
104
107
  :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
105
108
  :password => "yourpassword"
106
109
 
110
+ #### custom file path for the logging database ####
111
+
112
+ Logical Insight uses SQLite to store data from requests, and outputs a database file in the root directory. If you need the file to be created at another location (i.e. Heroku), you can pass a custom file path.
113
+
114
+ ActionController::Dispatcher.middleware.use "Insight::App"
115
+ :secret_key => "someverylongandveryhardtoguesspreferablyrandomstring",
116
+ :database_path => "tmp/my_insight_db.sqlite"
107
117
 
108
118
  Authors
109
119
  -------
110
120
 
111
121
  - Maintained by [Judson Lester](mailto:judson@lrdesign.com)
112
122
  - Contributions from Luke Melia, Joey Aghion, Tim Connor, and more
123
+ - Based on Rack::Bug by Bryan Helmkamp
113
124
 
114
125
  Thanks
115
126
  ------
116
- Insight owes a lot to Rack::Bug, as the basis project. There's a lot of smart in there.
127
+ Insight owes a lot to Rack::Bug, as the basis project. There's a lot of smart in there. Many thanks to Bryan for building it.
117
128
 
118
129
  Inspiration for Rack::Bug is primarily from the Django debug toolbar. Additional ideas from Rails footnotes, Rack's ShowException middleware, Oink, and Rack::Cache
119
130
 
data/Rakefile CHANGED
@@ -1,3 +1,4 @@
1
+ require 'yaml'
1
2
  require 'corundum'
2
3
  require 'corundum/tasklibs'
3
4
 
@@ -39,6 +39,15 @@ module Insight
39
39
 
40
40
  class << self
41
41
  include Logging
42
+
43
+ def database_path=(value)
44
+ @database_path = value
45
+ end
46
+
47
+ def database_path
48
+ @database_path
49
+ end
50
+
42
51
  def db
43
52
  @db ||= open_database
44
53
  end
@@ -48,7 +57,7 @@ module Insight
48
57
  end
49
58
 
50
59
  def open_database
51
- @db = SQLite3::Database.new("insight.sqlite")
60
+ @db = SQLite3::Database.new(database_path)
52
61
  @db.execute("pragma foreign_keys = on")
53
62
  @db
54
63
  rescue Object => ex
@@ -1,4 +1,5 @@
1
1
  require 'ipaddr'
2
+
2
3
  module Insight
3
4
  module Options
4
5
  class << self
@@ -15,6 +16,7 @@ module Insight
15
16
  option_accessor :password
16
17
  option_accessor :panel_classes
17
18
  option_accessor :intercept_redirects
19
+ option_accessor :database_path
18
20
 
19
21
  # The underlying options Hash. During initialization (or outside of a
20
22
  # request), this is a default values Hash. During a request, this is the
@@ -70,6 +72,8 @@ module Insight
70
72
  end
71
73
  write_option('insight.panel_classes', class_list)
72
74
  end
75
+
76
+ Insight::Database.database_path = read_option('insight.database_path')
73
77
  end
74
78
 
75
79
  def initialize_options(options=nil)
@@ -82,6 +86,7 @@ module Insight
82
86
  'insight.panels' => [],
83
87
  'insight.log_level' => Logger::INFO,
84
88
  'insight.log_path' => "log/insight.log",
89
+ 'insight.database_path' => "insight.sqlite",
85
90
  'insight.panel_files' => %w{
86
91
  rails_info_panel
87
92
  timer_panel
@@ -19,7 +19,8 @@ module Insight
19
19
  def before_detect(method_call, arguments)
20
20
  @event_id += 1
21
21
 
22
- arguments_string = make_string_of(arguments)
22
+ #arguments_string = make_string_of(arguments)
23
+ arguments_string = ""
23
24
  #XXX ServerEvent use method call...
24
25
  event = ServerEvent.new(method_call, arguments_string)
25
26
  @pstack.push event
@@ -138,4 +138,20 @@ describe Insight do
138
138
  get_via_rack "/"
139
139
  end
140
140
  end
141
+
142
+ context "configured with a SQLite database file path" do
143
+ before do
144
+ # We need to pass the SQLite database file path to the gem
145
+ reset_insight :database_path => 'my_custom_db_path.sqlite'
146
+ end
147
+
148
+ it "should create a database at the path specified in the options" do
149
+ File.exist?('my_custom_db_path.sqlite').should be_true
150
+ end
151
+
152
+ after do
153
+ File.delete("my_custom_db_path.sqlite")
154
+ end
155
+
156
+ end
141
157
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logical-insight
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 2
9
- version: 0.4.2
4
+ prerelease:
5
+ version: 0.4.3
10
6
  platform: ruby
11
7
  authors:
12
8
  - Bryan Helmkamp
@@ -16,13 +12,23 @@ autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
14
 
19
- date: 2011-12-13 00:00:00 -08:00
20
- default_executable:
15
+ date: 2011-12-13 00:00:00 Z
21
16
  dependencies:
22
17
  - !ruby/object:Gem::Dependency
23
- name: uuid
24
- prerelease: false
18
+ name: corundum
25
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.13
25
+ type: :development
26
+ prerelease: false
27
+ version_requirements: *id001
28
+ - !ruby/object:Gem::Dependency
29
+ name: uuid
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
26
32
  requirements:
27
33
  - - ~>
28
34
  - !ruby/object:Gem::Version
@@ -32,11 +38,12 @@ dependencies:
32
38
  - 1
33
39
  version: 2.3.1
34
40
  type: :runtime
35
- version_requirements: *id001
41
+ prerelease: false
42
+ version_requirements: *id002
36
43
  - !ruby/object:Gem::Dependency
37
44
  name: sqlite3
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
45
+ requirement: &id003 !ruby/object:Gem::Requirement
46
+ none: false
40
47
  requirements:
41
48
  - - ~>
42
49
  - !ruby/object:Gem::Version
@@ -46,7 +53,8 @@ dependencies:
46
53
  - 3
47
54
  version: 1.3.3
48
55
  type: :runtime
49
- version_requirements: *id002
56
+ prerelease: false
57
+ version_requirements: *id003
50
58
  description: "Debugging toolbar for Rack applications implemented as\n middleware. Rails 3 compatible version maintained by Logical Reality\n Design. "
51
59
  email: evan@lrdesign.com judson@lrdesign.com
52
60
  executables: []
@@ -156,7 +164,6 @@ files:
156
164
  - README.md
157
165
  - Rakefile
158
166
  - Thorfile
159
- has_rdoc: true
160
167
  homepage: https://github.com/LRDesign/logical-insight
161
168
  licenses: []
162
169
 
@@ -166,23 +173,24 @@ rdoc_options: []
166
173
  require_paths:
167
174
  - lib
168
175
  required_ruby_version: !ruby/object:Gem::Requirement
176
+ none: false
169
177
  requirements:
170
178
  - - ">="
171
179
  - !ruby/object:Gem::Version
180
+ hash: -756212099
172
181
  segments:
173
182
  - 0
174
183
  version: "0"
175
184
  required_rubygems_version: !ruby/object:Gem::Requirement
185
+ none: false
176
186
  requirements:
177
187
  - - ">="
178
188
  - !ruby/object:Gem::Version
179
- segments:
180
- - 0
181
189
  version: "0"
182
190
  requirements: []
183
191
 
184
192
  rubyforge_project:
185
- rubygems_version: 1.3.6
193
+ rubygems_version: 1.8.11
186
194
  signing_key:
187
195
  specification_version: 3
188
196
  summary: Debugging toolbar for Rack applications implemented as middleware. Rails 3 compatible version maintained by Logical Reality Design.