rails_info 0.0.4 → 0.0.5

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.
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:
@@ -62,6 +62,6 @@ code {
62
62
  // Example:
63
63
  // @linkColor: #ff0000;
64
64
 
65
- #log_rails_root {
65
+ .auto_width {
66
66
  width: auto;
67
67
  }
@@ -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, tabs|
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
- <% form_tag rails_info_server_log_path do %>
2
- <%= check_box_tag 'debug' %> debug?
3
- <p>
4
- <%= text_field_tag 'log[rails_root]', (params['log']['rails_root'] rescue "#{Rails.root}/log/") %>
5
- </p>
6
- <p>
7
- <%= text_area_tag 'log[body]', (params['log']['body'] rescue nil) %>
8
- </p>
9
- <p>
10
- <%= submit_tag 'submit' %>
11
- </p>
12
- <% end %>
13
- <ul class="nav nav-tabs nav-stacked">
14
- <li><a name="top" href="#">1 ) Actions</a></li>
15
- <li><a href="#writes">2 ) Writes</a></li>
16
- </ul>
17
- <hr/>
18
- <h3><a href="#top">1 ) Actions</a></h3>
19
- <hr/>
20
- <%= raw @rails_info_log.accordion %>
21
- <hr/>
22
- <h3><a name="writes" href="#top">2 ) Writes</a></h3>
23
- <hr/>
24
- <%= raw @rails_info_log.write_tabs %>
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
- <%= form_tag rails_info_rspec_log_path, method: 'put' do %>
2
- <p>
3
- <%= check_box_tag 'debug' %> debug? &nbsp;&nbsp;
4
- <%= label_tag 'log[rails_root]', raw('<strong>Rails root:</strong>') %>
5
- <%= text_field_tag 'log[rails_root]', (params['log']['rails_root'] rescue "#{Rails.root}/"), size: 75 %> &nbsp;&nbsp;
6
- <%= submit_tag 'submit' %>
7
- </p>
8
- <% end %>
9
- <%= raw @rails_info_log.summary %>
10
- <%= raw @rails_info_log.accordion %>
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 %> &nbsp;&nbsp;
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 %> &nbsp;&nbsp;
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
- path = options[:log][:path] || "#{Rails.root}/log/"
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
- unless @body
13
- file_path = "#{path}#{env}.log"
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
- reg_exp = /([0-9]+)m( ){2}((INSERT INTO|UPDATE|DELETE FROM)(.)+)$/
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(/(INSERT INTO|UPDATE|DELETE FROM) {1}`([a-zA-Z0-9_]+)`/)[2]
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(/([0-9]+)m( ){2}INSERT INTO( ){1}`(.{1,})`( ){1}(.)+$/)
206
+ if line.match("#{begin_reg_exp}INSERT INTO( ){1}`(.{1,})`( ){1}(.)+$")
201
207
  data = process_insert(line)
202
- elsif line.match(/([0-9]+)m( ){2}UPDATE( ){1}`(.{1,})`( ){1}(.)+$/)
208
+ elsif line.match("#{begin_reg_exp}UPDATE( ){1}`(.{1,})`( ){1}(.)+$")
203
209
  data = process_update(table_name, line)
204
- elsif line.match(/([0-9]+)m( ){2}DELETE FROM( ){1}`(.{1,})`( ){1}(.)+$/)
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
@@ -1,3 +1,3 @@
1
1
  module RailsInfo
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
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
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-09 00:00:00.000000000 Z
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: &70242337984640 !ruby/object:Gem::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: *70242337984640
24
+ version_requirements: *70229037335400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: coffee-script
27
- requirement: &70242337983580 !ruby/object:Gem::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: *70242337983580
35
+ version_requirements: *70229037334360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: uglifier
38
- requirement: &70242337982560 !ruby/object:Gem::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: *70242337982560
46
+ version_requirements: *70229037333520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jquery-rails
49
- requirement: &70242337981960 !ruby/object:Gem::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: *70242337981960
57
+ version_requirements: *70229037332760
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jquery-ui-rails
60
- requirement: &70242337981320 !ruby/object:Gem::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: *70242337981320
68
+ version_requirements: *70229037323840
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pygments.rb
71
- requirement: &70242337980500 !ruby/object:Gem::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: *70242337980500
79
+ version_requirements: *70229037323300
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: twitter-bootstrap-rails
82
- requirement: &70242337979860 !ruby/object:Gem::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: *70242337979860
90
+ version_requirements: *70229037322840
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: simple-navigation-bootstrap
93
- requirement: &70242337979280 !ruby/object:Gem::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: *70242337979280
101
+ version_requirements: *70229037322220
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: awesome_print
104
- requirement: &70242337978780 !ruby/object:Gem::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: *70242337978780
112
+ version_requirements: *70229037321780
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rspec-rails
115
- requirement: &70242337978360 !ruby/object:Gem::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: *70242337978360
123
+ version_requirements: *70229037321240
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: mysql2
126
- requirement: &70242337977840 !ruby/object:Gem::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: *70242337977840
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: -3145686660104229554
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: -3145686660104229554
269
+ hash: 638750249705134826
270
270
  requirements: []
271
271
  rubyforge_project:
272
272
  rubygems_version: 1.8.17