rails_info 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +12 -10
- data/app/assets/stylesheets/rails_info/bootstrap_and_overrides.css.less +1 -1
- data/app/controllers/rails_info/logs/server_controller.rb +1 -1
- data/app/presenters/rails_info/logs/server_presenter.rb +5 -1
- data/app/views/rails_info/logs/server/new.html.erb +42 -24
- data/app/views/rails_info/logs/test/rspec/new.html.erb +37 -10
- data/lib/rails_info/logs/server.rb +14 -8
- data/lib/rails_info/version.rb +1 -1
- metadata +26 -26
data/README.rdoc
CHANGED
@@ -1,16 +1,7 @@
|
|
1
|
-
= RailsInfo {<img src="https://secure.travis-ci.org/Applicat/rails_info.png" />}[http://travis-ci.org/Applicat/rails_info] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/Applicat/rails_info]
|
2
|
-
|
3
|
-
Wiki[https://github.com/applicat/rails_info/wiki]
|
1
|
+
= RailsInfo Wiki[https://github.com/applicat/rails_info/wiki] {<img src="https://secure.travis-ci.org/Applicat/rails_info.png" />}[http://travis-ci.org/Applicat/rails_info] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/Applicat/rails_info] {<img src="https://gemnasium.com/Applicat/rails_info.png?travis"/>}[https://gemnasium.com/Applicat/rails_info]
|
4
2
|
|
5
3
|
Experimental engine for a rails application besides admin and continous integration web interface which extends standard /rails/info (properties through public.html iframe and on Rails 3 Edge / Rails 4 also the routes action) about some extra information resources in development environment.
|
6
4
|
|
7
|
-
It should be the place for other rake commands besides "rake routes" such as brakeman or best practices.
|
8
|
-
|
9
|
-
Prepare for sporadic Ruby segmentation faults caused by the Python powered syntax highlighter pygments in the early stages of this project (at least under Ruby 1.9.3 & Rails 3.2.6 on MacOS).
|
10
|
-
There will be a configuration option for deactivating syntax highlighting soon for the time being without a solution for this problem.
|
11
|
-
|
12
|
-
Tested on MacOS with: Rails 3.1 & Ruby 1.9.2, Rails 3.2.6 & Ruby 1.9.3.
|
13
|
-
|
14
5
|
http://img207.imageshack.us/img207/8505/railsinfonavigation001.png
|
15
6
|
|
16
7
|
== Installation
|
@@ -27,6 +18,17 @@ OPTIONAL: users of catch-all-routes like match '*not_found' => 'errors#404' have
|
|
27
18
|
|
28
19
|
* {Modules}[https://github.com/Applicat/rails_info/wiki/modules]
|
29
20
|
|
21
|
+
== Caveats
|
22
|
+
|
23
|
+
Prepare for sporadic Ruby segmentation faults caused by the Python powered syntax highlighter pygments in the early stages of this project (at least under Ruby 1.9.3 & Rails 3.2.6 on MacOS).
|
24
|
+
There will be a configuration option for deactivating syntax highlighting soon for the time being without a solution for this problem.
|
25
|
+
|
26
|
+
Tested on MacOS with: Rails 3.1 & Ruby 1.9.2, Rails 3.2.6 & Ruby 1.9.3.
|
27
|
+
|
28
|
+
= Future
|
29
|
+
|
30
|
+
It should be the place for other rake commands besides "rake routes" such as brakeman or best practices.
|
31
|
+
|
30
32
|
== Contribution
|
31
33
|
|
32
34
|
Just follow the screencast of Ryan Bates on railscasts.com:
|
@@ -4,7 +4,7 @@ class RailsInfo::Logs::ServerController < RailsInfoController
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def update
|
7
|
-
@rails_info_log = ::RailsInfo::Logs::ServerPresenter.new(log: params[:log], debug: params[:debug])
|
7
|
+
@rails_info_log = ::RailsInfo::Logs::ServerPresenter.new(view_context, log: params[:log], debug: params[:debug])
|
8
8
|
render 'new'
|
9
9
|
end
|
10
10
|
end
|
@@ -11,7 +11,8 @@ class RailsInfo::Logs::ServerPresenter < ::RailsInfo::Presenter
|
|
11
11
|
content_tag :div, id: 'actions', class: 'accordions' do
|
12
12
|
html = ''
|
13
13
|
|
14
|
-
@rails_info_log.hash.each do |action
|
14
|
+
@rails_info_log.hash.keys.reverse.each do |action|
|
15
|
+
tabs = @rails_info_log.hash[action]
|
15
16
|
action_presenter = ::RailsInfo::Logs::Server::ActionPresenter.new(
|
16
17
|
@subject, name: action, tabs_data: tabs, index: @action_index
|
17
18
|
)
|
@@ -58,6 +59,9 @@ class RailsInfo::Logs::ServerPresenter < ::RailsInfo::Presenter
|
|
58
59
|
tab_index += 1
|
59
60
|
end
|
60
61
|
|
62
|
+
# free memory
|
63
|
+
@rails_info_log = nil
|
64
|
+
|
61
65
|
html
|
62
66
|
end
|
63
67
|
end
|
@@ -1,24 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<
|
18
|
-
<
|
19
|
-
|
20
|
-
|
21
|
-
<
|
22
|
-
|
23
|
-
<
|
24
|
-
<%= raw
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li><a href="#output">Output</a></li>
|
4
|
+
<li><a href="#reload_from_file">Reload from file</a></li>
|
5
|
+
<li><a href="#reload_from_text">Reload from text</a></li>
|
6
|
+
</ul>
|
7
|
+
<div id="output">
|
8
|
+
<ul class="nav nav-tabs nav-stacked">
|
9
|
+
<li><a name="top" href="#">1 ) Actions</a></li>
|
10
|
+
<li><a href="#writes">2 ) Writes</a></li>
|
11
|
+
</ul>
|
12
|
+
<hr/>
|
13
|
+
<h3><a href="#top">1 ) Actions</a></h3>
|
14
|
+
<hr/>
|
15
|
+
<%= raw @rails_info_log.accordion %>
|
16
|
+
<hr/>
|
17
|
+
<h3><a name="writes" href="#top">2 ) Writes</a></h3>
|
18
|
+
<hr/>
|
19
|
+
<%= raw @rails_info_log.write_tabs %>
|
20
|
+
</div>
|
21
|
+
<div id="reload_from_file">
|
22
|
+
<%= form_tag rails_info_server_log_path, method: 'put' do %>
|
23
|
+
<p>
|
24
|
+
<%= label_tag 'log[rails_root]', raw('<strong>Rails root:</strong>') %>
|
25
|
+
<%= text_field_tag 'log[rails_root]', (params['log']['rails_root'] rescue Rails.root.to_s), class: 'auto_width', size: 75 %>
|
26
|
+
</p>
|
27
|
+
<p>
|
28
|
+
<%= submit_tag 'submit' %>
|
29
|
+
</p>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
32
|
+
<div id="reload_from_text">
|
33
|
+
<%= form_tag rails_info_server_log_path, method: 'put' do %>
|
34
|
+
<p>
|
35
|
+
<%= text_area_tag 'log[body]', (params['log']['body'] rescue nil), cols: 50 %>
|
36
|
+
</p>
|
37
|
+
<p>
|
38
|
+
<%= submit_tag 'submit' %>
|
39
|
+
</p>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
</div>
|
@@ -1,10 +1,37 @@
|
|
1
|
-
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<%= raw @rails_info_log.
|
10
|
-
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li><a href="#output">Output</a></li>
|
4
|
+
<li><a href="#reload_from_file">Reload from file</a></li>
|
5
|
+
<li><a href="#reload_from_text">Reload from text</a></li>
|
6
|
+
</ul>
|
7
|
+
<div id="output">
|
8
|
+
<%= raw @rails_info_log.summary %>
|
9
|
+
<%= raw @rails_info_log.accordion %>
|
10
|
+
</div>
|
11
|
+
<div id>
|
12
|
+
<div id="reload_from_file">
|
13
|
+
<%= form_tag rails_info_rspec_log_path, method: 'put' do %>
|
14
|
+
<p>
|
15
|
+
<%= label_tag 'log[rails_root]', raw('<strong>Rails root:</strong>') %>
|
16
|
+
<%= text_field_tag 'log[rails_root]', (params['log']['rails_root'] rescue "#{Rails.root}/"), class: 'auto_width', size: 75 %>
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
<%= submit_tag 'submit' %>
|
20
|
+
</p>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<div id="reload_from_text">
|
24
|
+
<%= form_tag rails_info_rspec_log_path, method: 'put' do %>
|
25
|
+
<p>
|
26
|
+
<%= label_tag 'log[rails_root]', raw('<strong>Rails root:</strong>') %>
|
27
|
+
<%= text_field_tag 'log[rails_root]', (params['log']['rails_root'] rescue "#{Rails.root}/"), class: 'auto_width', size: 75 %>
|
28
|
+
</p>
|
29
|
+
<p>
|
30
|
+
<%= text_area_tag 'log[body]', (params['log']['body'] rescue nil), class: 'auto_width', cols: 150, rows: 15 %>
|
31
|
+
</p>
|
32
|
+
<p>
|
33
|
+
<%= submit_tag 'submit' %>
|
34
|
+
</p>
|
35
|
+
<% end %>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -4,13 +4,13 @@ class RailsInfo::Logs::Server
|
|
4
4
|
options[:log] ||= {}
|
5
5
|
|
6
6
|
@debug = options[:debug]
|
7
|
-
|
7
|
+
rails_root = options[:log][:rails_root] || Rails.root.to_s
|
8
8
|
env = options[:log][:env] || Rails.env
|
9
9
|
@body = options[:log][:body]
|
10
10
|
@start_after_last_shutdown = options[:log][:start_after_last_shutdown] || true
|
11
11
|
|
12
|
-
|
13
|
-
file_path = "#{
|
12
|
+
if @body.blank?
|
13
|
+
file_path = "#{rails_root}/log/#{env}.log"
|
14
14
|
|
15
15
|
@body = File.new(file_path, 'r').read if File.exist?(file_path)
|
16
16
|
end
|
@@ -44,6 +44,8 @@ class RailsInfo::Logs::Server
|
|
44
44
|
|
45
45
|
delete_empty_tabs
|
46
46
|
set_where_column_as_last_one_in_write_tab
|
47
|
+
|
48
|
+
@body = nil # free memory
|
47
49
|
end
|
48
50
|
|
49
51
|
def reset_log
|
@@ -84,6 +86,9 @@ class RailsInfo::Logs::Server
|
|
84
86
|
reset_log and return if line.match('Ctrl-C to shutdown server') && @start_after_last_shutdown
|
85
87
|
|
86
88
|
parse_route(line) and return
|
89
|
+
|
90
|
+
return if @route.match(/"\/rails\/info.+"/)
|
91
|
+
|
87
92
|
parse_action(line) and return
|
88
93
|
|
89
94
|
return if @action.blank?
|
@@ -189,19 +194,20 @@ class RailsInfo::Logs::Server
|
|
189
194
|
end
|
190
195
|
|
191
196
|
def parse_write(line)
|
192
|
-
|
197
|
+
begin_reg_exp = "\\[[0-9]+m *"
|
198
|
+
reg_exp = "#{begin_reg_exp}((INSERT INTO|UPDATE|DELETE FROM)(.)+)$"
|
193
199
|
|
194
200
|
return false unless line.match(reg_exp)
|
195
201
|
|
196
|
-
table_name = line.match(
|
202
|
+
table_name = line.match("(INSERT INTO|UPDATE|DELETE FROM) {1}`([a-zA-Z0-9_]+)`")[2]
|
197
203
|
|
198
204
|
data = {}
|
199
205
|
|
200
|
-
if line.match(
|
206
|
+
if line.match("#{begin_reg_exp}INSERT INTO( ){1}`(.{1,})`( ){1}(.)+$")
|
201
207
|
data = process_insert(line)
|
202
|
-
elsif line.match(
|
208
|
+
elsif line.match("#{begin_reg_exp}UPDATE( ){1}`(.{1,})`( ){1}(.)+$")
|
203
209
|
data = process_update(table_name, line)
|
204
|
-
elsif line.match(
|
210
|
+
elsif line.match("#{begin_reg_exp}DELETE FROM( ){1}`(.{1,})`( ){1}(.)+$")
|
205
211
|
data = process_delete(table_name, line)
|
206
212
|
else
|
207
213
|
raise NotImplementedError
|
data/lib/rails_info/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70229037335400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70229037335400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: coffee-script
|
27
|
-
requirement: &
|
27
|
+
requirement: &70229037334360 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70229037334360
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: uglifier
|
38
|
-
requirement: &
|
38
|
+
requirement: &70229037333520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70229037333520
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jquery-rails
|
49
|
-
requirement: &
|
49
|
+
requirement: &70229037332760 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70229037332760
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: jquery-ui-rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &70229037323840 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70229037323840
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: pygments.rb
|
71
|
-
requirement: &
|
71
|
+
requirement: &70229037323300 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70229037323300
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: twitter-bootstrap-rails
|
82
|
-
requirement: &
|
82
|
+
requirement: &70229037322840 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70229037322840
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: simple-navigation-bootstrap
|
93
|
-
requirement: &
|
93
|
+
requirement: &70229037322220 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70229037322220
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: awesome_print
|
104
|
-
requirement: &
|
104
|
+
requirement: &70229037321780 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70229037321780
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec-rails
|
115
|
-
requirement: &
|
115
|
+
requirement: &70229037321240 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70229037321240
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: mysql2
|
126
|
-
requirement: &
|
126
|
+
requirement: &70229037320760 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70229037320760
|
135
135
|
description: Engine for a rails application which extends /rails/info about some information
|
136
136
|
resources in development environment.
|
137
137
|
email:
|
@@ -257,7 +257,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
257
|
version: '0'
|
258
258
|
segments:
|
259
259
|
- 0
|
260
|
-
hash:
|
260
|
+
hash: 638750249705134826
|
261
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
262
262
|
none: false
|
263
263
|
requirements:
|
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
266
|
version: '0'
|
267
267
|
segments:
|
268
268
|
- 0
|
269
|
-
hash:
|
269
|
+
hash: 638750249705134826
|
270
270
|
requirements: []
|
271
271
|
rubyforge_project:
|
272
272
|
rubygems_version: 1.8.17
|