tuttle 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: afd1a594a8f4791f9d32265d0c3845df82ede0f9
4
- data.tar.gz: dd185815e582e48e5e9eeb56df7abcffc2a5fe3f
3
+ metadata.gz: fb3803eeb651c971a088c8f9f8b3b3d49c6ffd18
4
+ data.tar.gz: 64d2b0b4252df7445c67207967e0c41eaec30c16
5
5
  SHA512:
6
- metadata.gz: b3dd8bb7b3411012cd4adba504ae9d80c9882b16f1ba34ad9219005ce572021102feac399a1bf4dd14e5b337f291fc93ab4d55ea83c8314d7d97439f4287a8b9
7
- data.tar.gz: 1fd05873a8248f3ef3a04c0e3975345d648e9c89ea0c0213ef867372dcf949e081237587dbbe6b19be9b59707ede7ac1bcddca21bbe7cbd56ac6d6f1cae9dabd
6
+ metadata.gz: 4bbd9338d565fc7d45aac1162480df1564d86ad0bfa5b8205d16438f8b1c1c36181a51c6789d09e5a14f20716df3d52f10423a0e6e131b52c8f9e3297173585a
7
+ data.tar.gz: 75d0f95727f69ade04dde73568cc500b2b76af0a7d0132a3075e4ff0cc8551793bbe3be027e7dd9b9719a25a8ee320fdc592c1a2243f16d784c86ae50f93684a
@@ -1,3 +1,11 @@
1
+ ### 0.0.4
2
+
3
+ * Features
4
+ * Experimental Rails5 support
5
+ * Paperclip registry inspection
6
+ * ActiveRecord schema cache and schema_cache.dump inspection
7
+ * Configuration control of notification_tracking
8
+
1
9
  ### 0.0.3
2
10
 
3
11
  * Features
@@ -3,6 +3,10 @@ require_dependency 'tuttle/application_controller'
3
3
  module Tuttle
4
4
  class GemsController < ApplicationController
5
5
 
6
+ def index
7
+
8
+ end
9
+
6
10
  def http_clients
7
11
 
8
12
  end
@@ -0,0 +1,14 @@
1
+ require_dependency 'tuttle/application_controller'
2
+ require 'paperclip/version' if defined?(::Paperclip)
3
+
4
+ module Tuttle
5
+ class PaperclipController < ApplicationController
6
+
7
+ def index
8
+ # Note: in development with reloading, classes will show up in the registry multiple times
9
+ render(plain: "Paperclip not installed") and return unless defined?(::Paperclip)
10
+ @pcar = Paperclip::AttachmentRegistry.instance
11
+ end
12
+
13
+ end
14
+ end
@@ -1,5 +1,6 @@
1
1
  require_dependency 'tuttle/application_controller'
2
2
  require 'rails/generators'
3
+ require 'tuttle/presenters/action_dispatch/routing/route_wrapper'
3
4
 
4
5
  module Tuttle
5
6
  class RailsController < ApplicationController
@@ -27,18 +28,36 @@ module Tuttle
27
28
  @conn = ActiveRecord::Base.connection
28
29
  end
29
30
 
31
+ def schema_cache
32
+ @schema_cache_filename = File.join(Rails.application.config.paths['db'].first, 'schema_cache.dump')
33
+ if File.file?(@schema_cache_filename)
34
+ @schema_cache = Marshal.load(File.binread(@schema_cache_filename))
35
+ end
36
+ # TODO: wrap in a facade and handle unloaded file
37
+ @schema_cache ||= ActiveRecord::ConnectionAdapters::SchemaCache.new(nil)
38
+
39
+ # TODO: consider allowing a schema cache clear!
40
+ # TODO: consider allowing a schema_cache.dump reload
41
+ # if @schema_cache.version && params[:reload_schema_cache_dump]
42
+ # ActiveRecord::Base.connection.schema_cache = @schema_cache.dup
43
+ # end
44
+
45
+ @connection_schema_cache = ActiveRecord::Base.connection.schema_cache
46
+ # Note: Rails 5 should also support ActiveRecord::Base.connection_pool.respond_to?(:schema_cache)
47
+ end
48
+
30
49
  def helpers
31
50
  @helpers = ::ApplicationController.send(:modules_for_helpers,[:all])
32
51
  end
33
52
 
34
53
  def assets
35
54
  @sprockets = Rails.application.assets
36
- @engines = @sprockets.instance_variable_get(:@engines)
55
+ @engines = Sprockets::VERSION >= '3' ? @sprockets.instance_variable_get(:@config)[:engines] : @sprockets.instance_variable_get(:@engines)
37
56
  end
38
57
 
39
58
  def routes
40
59
  @routes = Rails.application.routes.routes.collect do |route|
41
- ActionDispatch::Routing::RouteWrapper.new(route)
60
+ Tuttle::Presenters::ActionDispatch::Routing::RouteWrapper.new(route)
42
61
  end
43
62
  # TODO: include engine-mounted routes
44
63
  end
@@ -1,8 +1,25 @@
1
1
  module Tuttle
2
2
  module ApplicationHelper
3
3
 
4
- def truth_label(is_true, true_label='true', false_label='false')
5
- "<span class='label label-#{ is_true ? 'success':'danger'}'>#{ is_true ? true_label : false_label}</span>".html_safe
4
+ def truth_label(is_true, true_label='true'.freeze, false_label='false'.freeze)
5
+ "<span class='label label-#{ is_true ? 'success'.freeze : 'danger'.freeze}'>#{ is_true ? true_label : false_label}</span>".html_safe
6
+ end
7
+
8
+ def tuttle_redacted(enumarator)
9
+ enumarator.collect do |key, value|
10
+ yield key, redact_by_key(key, value)
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def redact_by_key(key, value)
17
+ case key
18
+ when 'password', %r/(_secret|_credentials)/
19
+ '--HIDDEN--'.freeze
20
+ else
21
+ value
22
+ end
6
23
  end
7
24
 
8
25
  end
@@ -39,6 +39,7 @@
39
39
  <li><%= link_to 'Assets', rails_assets_path %></li>
40
40
  <li><%= link_to 'Routes', rails_routes_path %></li>
41
41
  <li><%= link_to 'Database', rails_database_path %></li>
42
+ <li><%= link_to 'Schema Cache', rails_schema_cache_path %></li>
42
43
  <li><%= link_to 'Instrumentation', rails_instrumentation_path %></li>
43
44
  <li><%= link_to 'Inflectors', rails_inflectors_path %></li>
44
45
  <li><%= link_to 'Caching', rails_cache_path %></li>
@@ -47,12 +48,17 @@
47
48
  <li class="dropdown">
48
49
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">Gems <span class="caret"></span></a>
49
50
  <ul class="dropdown-menu" role="menu">
51
+ <li><%= link_to 'Overview', gems_path %></li>
52
+ <li class="divider"></li>
50
53
  <%- if defined?(Devise) %>
51
54
  <li><%= link_to 'Devise', devise_path %></li>
52
55
  <%- end %>
53
56
  <%- if defined?(CanCanCan) %>
54
57
  <li><%= link_to 'CanCanCan', cancancan_path %></li>
55
58
  <%- end %>
59
+ <%- if defined?(::Paperclip) %>
60
+ <li><%= link_to 'Paperclip', paperclip_path %></li>
61
+ <%- end %>
56
62
  <li><%= link_to 'HTTP Clients', gems_http_clients_path %></li>
57
63
  <li><%= link_to 'JSON', gems_json_path %></li>
58
64
  <li><%= link_to 'Other', gems_other_path %></li>
@@ -82,6 +88,11 @@
82
88
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js"></script>
83
89
  <script src="//cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.10.4/typeahead.bundle.min.js"></script>
84
90
  <%= javascript_include_tag "tuttle/application" =%>
91
+ <script type="application/javascript">
92
+ $(function () {
93
+ $('[data-toggle="tooltip"]').tooltip();
94
+ });
95
+ </script>
85
96
  <%= content_for(:javascripts) =%>
86
97
  </body>
87
98
  </html>
@@ -47,7 +47,6 @@ confirm_within = <%= Devise.confirm_within %>
47
47
  confirmation_keys = <%= Devise.confirmation_keys %>
48
48
  reconfirmable = <%= Devise.reconfirmable %>
49
49
  timeout_in = <%= Devise.timeout_in %>
50
- expire_auth_token_on_timeout = <%= Devise.expire_auth_token_on_timeout %>
51
50
  pepper = <%= Devise.pepper %>
52
51
  scoped_views = <%= Devise.scoped_views %>
53
52
  lock_strategy = <%= Devise.lock_strategy %>
@@ -0,0 +1,20 @@
1
+ <h1>Gems</h1>
2
+
3
+ <table class="table">
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Version</th>
7
+ <th>Summary</th>
8
+ <th>License</th>
9
+ <th>Homepage</th>
10
+ </tr>
11
+ <% Bundler.rubygems.all_specs.sort_by(&:name).each do |gemspec| %>
12
+ <tr>
13
+ <td class="text-nowrap"><%= gemspec.name %></td>
14
+ <td><%= gemspec.version.to_s %></td>
15
+ <td><%= gemspec.summary %></td>
16
+ <td><%= gemspec.licenses.join(', ') %></td>
17
+ <td><%= link_to gemspec.homepage, gemspec.homepage if !gemspec.homepage.blank? %></td>
18
+ </tr>
19
+ <% end %>
20
+ </table>
@@ -21,11 +21,21 @@
21
21
 
22
22
  <div class="panel panel-default">
23
23
  <div class="panel-heading">
24
- <h3 class="panel-title">Gems Detected</h3>
24
+ <h3 class="panel-title">Tuttle Gem Helper Tools</h3>
25
25
  </div>
26
26
  <ul class="list-group">
27
- <li class="list-group-item list-group-item-<%= ("constant" == defined?(CanCan)) ? 'success' : 'danger' %>">CanCan</li>
28
- <li class="list-group-item list-group-item-<%= ("constant" == defined?(Devise)) ? 'success' : 'danger' %>">Devise</li>
27
+ <%- if defined?(CanCanCan) %>
28
+ <li class="list-group-item"><%= link_to 'CanCan', cancancan_path %></li>
29
+ <%- end %>
30
+ <%- if defined?(Devise) %>
31
+ <li class="list-group-item"><%= link_to 'Devise', devise_path %></li>
32
+ <%- end %>
33
+ <%- if defined?(Paperclip) %>
34
+ <li class="list-group-item"><%= link_to 'Paperclip', paperclip_path %></li>
35
+ <%- end %>
36
+ <%- if !defined?(CanCanCan) && !defined?(Devise) && !defined?(Paperclip) %>
37
+ <li class="list-group-item list-group-item-warning">None</li>
38
+ <%- end %>
29
39
  </ul>
30
40
  </div>
31
41
 
@@ -0,0 +1,81 @@
1
+ <h1>Paperclip Configuration</h1>
2
+
3
+ <ul class="nav nav-tabs" role="tablist">
4
+ <li class="active"><a href="#overview" role="tab" data-toggle="tab">Overview</a></li>
5
+ <li><a href="#defaults" role="tab" data-toggle="tab">Defaults</a></li>
6
+ <li><a href="#interpolations" role="tab" data-toggle="tab">Interpolations</a></li>
7
+ </ul>
8
+
9
+ <div class="tab-content">
10
+ <div class="tab-pane active" id="overview">
11
+ <dl class="dl-horizontal">
12
+ <dt>Paperclip Version</dt><dd><%= Paperclip::VERSION %></dd>
13
+ </dl>
14
+
15
+ <h3>Paperclip Attachment Registry</h3>
16
+ <table class="table table-compact">
17
+ <tr>
18
+ <th>Class</th>
19
+ <th>Attachment</th>
20
+ <th>Options</th>
21
+ </tr>
22
+ <% Paperclip::AttachmentRegistry.each_definition do |klass, attachment, options| %>
23
+ <tr>
24
+ <td><%= klass %></td>
25
+ <td><%= attachment.inspect %></td>
26
+ <td>
27
+ <ul>
28
+ <% tuttle_redacted(options.sort.each) do |k,v| %>
29
+ <li><%= k %>: <%= v %></li>
30
+ <% end %>
31
+ </ul>
32
+ </td>
33
+ </tr>
34
+ <% end %>
35
+ </table>
36
+ </div>
37
+
38
+ <div class="tab-pane" id="defaults">
39
+ <h3>Default Options</h3>
40
+ <table class="table table-compact">
41
+ <tr>
42
+ <th>Option</th>
43
+ <th>Default</th>
44
+ <!--
45
+ <th>Description</th>
46
+ -->
47
+ </tr>
48
+ <% tuttle_redacted(Paperclip::Attachment.default_options.each) do |k, v| %>
49
+ <tr>
50
+ <td>
51
+ <%= k %>
52
+ </td>
53
+ <td>
54
+ <%= v %>
55
+ </td>
56
+ <!--
57
+ <td>
58
+ Description goes here
59
+ </td>
60
+ -->
61
+ </tr>
62
+ <% end %>
63
+ </table>
64
+ </div>
65
+
66
+ <div class="tab-pane" id="interpolations">
67
+ <h3>Interpolations</h3>
68
+ <table class="table table-compact">
69
+ <tr>
70
+ <th>Option</th>
71
+ </tr>
72
+ <% Paperclip::Interpolations.all.each do |interpolation| %>
73
+ <tr>
74
+ <td>
75
+ :<%= interpolation %>
76
+ </td>
77
+ </tr>
78
+ <% end %>
79
+ </table>
80
+ </div>
81
+ </div>
@@ -9,7 +9,9 @@ EJS version: <%= defined?(EJS) ? '1.1.1' : '-' %><br/>
9
9
 
10
10
  <h3>Configuration</h3>
11
11
  digest: <%= Rails.application.config.assets.digest %><br/>
12
+ <%- if Sprockets::VERSION < '3' %>
12
13
  ** digest value: <%= @sprockets.digest %><br/>
14
+ <%- end %>
13
15
  assets version: <%= Rails.application.config.assets.version %><br/>
14
16
  ** sprockets assets version: <%= @sprockets.version %><br/>
15
17
  assets prefix: <%= Rails.application.config.assets.prefix %><br/>
@@ -49,6 +49,11 @@ DalliStore options
49
49
  -%>
50
50
 
51
51
  <h2>Monitoring/Instrumentation</h2>
52
+ <%- unless Tuttle.track_notifications %>
53
+ <div class="alert alert-warning" role="alert">
54
+ <p>Note: Tuttle cache instrumentation has not been enabled. Use <code>config.track_notifications=true</code> to enable.</p>
55
+ </div>
56
+ <%- end %>
52
57
 
53
58
  <h3>Recent cache interactions</h3>
54
59
 
@@ -97,11 +97,11 @@ Log Level = <%= Rails.configuration.log_level %>
97
97
  <tr><th>#</th><th>Name</th><th>Context Class</th><th>Group</th><th>After</th><th>Before</th></tr>
98
98
  <%- idx = 0 %>
99
99
  <%- Rails.application.initializers.tsort_each do |initializer| %>
100
- <%- options = initializer.instance_variable_get('@options') %>
100
+ <%- options = initializer.instance_variable_get('@options'.freeze) %>
101
101
  <tr>
102
102
  <td><%= idx+=1 %></td>
103
103
  <td><%= initializer.name %></td>
104
- <td><%= initializer.instance_variable_get('@context').class.name %></td>
104
+ <td><%= initializer.instance_variable_get('@context'.freeze).class.name %></td>
105
105
  <td><%= options.try(:[],:group) %></td>
106
106
  <td><%= options.try(:[],:after) %></td>
107
107
  <td><%= options.try(:[],:before) %></td>
@@ -174,7 +174,7 @@ Log Level = <%= Rails.configuration.log_level %>
174
174
  <tr>
175
175
  <td>:<%= format %></td>
176
176
  <td><%= today.to_s(format) %></td>
177
- <td><%= formatter.respond_to?(:call) ? 'Dynamic Proc' : formatter %></td>
177
+ <td><%= formatter.respond_to?(:call) ? 'Dynamic Proc'.freeze : formatter %></td>
178
178
  </tr>
179
179
  <%- end %>
180
180
  </table>
@@ -194,7 +194,7 @@ Log Level = <%= Rails.configuration.log_level %>
194
194
  <tr>
195
195
  <td>:<%= format %></td>
196
196
  <td><%= today.to_s(format) %></td>
197
- <td><%= formatter.respond_to?(:call) ? 'Dynamic Proc' : formatter %></td>
197
+ <td><%= formatter.respond_to?(:call) ? 'Dynamic Proc'.freeze : formatter %></td>
198
198
  </tr>
199
199
  <%- end %>
200
200
  </table>
@@ -1,5 +1,10 @@
1
1
  <h1>Instrumentation</h1>
2
2
 
3
+ <%- unless Tuttle.track_notifications %>
4
+ <div class="alert alert-warning" role="alert">
5
+ <p>Note: Tuttle cache instrumentation has not been enabled. Use <code>config.track_notifications=true</code> to enable.</p>
6
+ </div>
7
+ <%- end %>
3
8
  <p>Events (<%= @events.size %>)</p>
4
9
 
5
10
  <table class="table">
@@ -46,7 +46,13 @@ No models were found in this application
46
46
  Stored attributes = <%= model.stored_attributes %><br/>
47
47
  Save callbacks = <%= model.send('_save_callbacks').count %><br/>
48
48
  Associations = <%= model.reflect_on_all_associations.count %><br/>
49
- Reflections = <%= model.reflections.keys.to_s %>
49
+ Reflections = <%= model.reflections.keys.to_s %><br/>
50
+
51
+ <% next if model.abstract_class? || ! model.table_exists? %>
52
+ <% if model.respond_to?(:find_by_statement_cache) %>
53
+ FindBy Statement Cache:<br/>
54
+ <%= model.find_by_statement_cache.map {|k,v| "#{k}=>#{v.query_builder.instance_variable_get(:@sql)}"}.join('<br/>') %>
55
+ <% end %>
50
56
  </div>
51
57
  </div>
52
58
 
@@ -2,21 +2,27 @@
2
2
  table td { white-space: nowrap; }
3
3
  </style>
4
4
  <h2>Routes</h2>
5
+ <p>
6
+ Rails routing is described in the <a href="http://guides.rubyonrails.org/routing.html">Rails
7
+ Routing from the Outside In</a> guide.
8
+ </p>
9
+ <p>
10
+ In addition to the routes defined in your <code>config/routes.rb</code> file,
11
+ Rails has internal routes and other Engines can contribute routes to the application.
12
+ </p>
5
13
 
6
14
  <table class="table table-striped table-condensed">
7
15
  <tr>
8
- <th>precedence</th>
9
- <th>name</th>
10
- <th>verb</th>
11
- <th>path</th>
12
- <th>endpoint/app</th>
13
- <th>constraints</th>
14
- <th>regexp</th>
15
- <th>json_regexp</th>
16
- <th>controller</th>
17
- <th>action</th>
18
- <th>internal?</th>
19
- <th>engine?</th>
16
+ <th><span data-toggle="tooltip" title="Route paths are checked in the order they are defined.">Precedence</span></th>
17
+ <th><span data-toggle="tooltip" title="The route name is used to generate Named Helpers like myaction_path">Name</span></th>
18
+ <th><span data-toggle="tooltip" title="The HTTP method for this route">Verb</span></th>
19
+ <th><span data-toggle="tooltip" title="The URI for the route.">Path</span></th>
20
+ <th><span data-toggle="tooltip" title="Most routes will map to a Controller#Action but some will be handled by engines or Rails internals">Endpoint or App</span></th>
21
+ <th><span data-toggle="tooltip" title="Routes can be constrained to match parameters">Constraints</span></th>
22
+ <th><span data-toggle="tooltip" title="The Controller for the route">Controller</span></th>
23
+ <th><span data-toggle="tooltip" title="The Action for the route">Action</span></th>
24
+ <th><span data-toggle="tooltip" title="Internal routes are handle by Rails under the covers">Internal?</span></th>
25
+ <th><span data-toggle="tooltip" title="Some routes are handled my mounted engines">Engine?</span></th>
20
26
  </tr>
21
27
  <% @routes.each do |route| %>
22
28
  <tr>
@@ -24,14 +30,12 @@
24
30
  <td><%= route.name %></td>
25
31
  <td><%= route.verb %></td>
26
32
  <td><%= route.path %></td>
27
- <td><%= route.rack_app ? route.rack_app : route.endpoint %></td>
33
+ <td><%= route.endpoint_or_app_name %></td>
28
34
  <td><%= route.constraints %></td>
29
- <td><%= route.regexp %></td>
30
- <td><%= route.json_regexp %></td>
31
- <td><%= route.controller unless route.rack_app %></td>
32
- <td><%= route.action unless route.rack_app %></td>
33
- <td><%= !!route.internal? %></td>
34
- <td><%= !!route.engine? %></td>
35
+ <td><%= route.controller %></td>
36
+ <td><%= route.action %></td>
37
+ <td><%= route.is_internal_to_rails? %></td>
38
+ <td><%= route.engine? %></td>
35
39
  </tr>
36
40
  <% end %>
37
41
  </table>
@@ -0,0 +1,81 @@
1
+ <h2>Database Schema Cache</h2>
2
+
3
+ <p>
4
+ ActiveRecord maintains a cache of table, column, and primary key information
5
+ that it uses to build the SQL for queries.
6
+ </p>
7
+
8
+ <p>
9
+ This cache of information can either be built lazily as models are accessed
10
+ or can be loaded from a dump file during application startup.
11
+ </p>
12
+
13
+ <p>
14
+ Preloading the schema cache from the dump can greatly improve application
15
+ performance, especially with a large number of tables.
16
+ </p>
17
+
18
+ <h3>Schema Cache Dump</h3>
19
+ <p>
20
+ The <code>schema_cache.dump</code> file is created using <code>rake db:schema:cache:dump</code>.
21
+ The dump file must match the version of the latest migration that has been run.
22
+ </p>
23
+ <ul>
24
+ <li>File location: <code><%= @schema_cache_filename %></code></li>
25
+ <li>File exists?: <%= truth_label(File.file?(@schema_cache_filename)) %></li>
26
+ <li>Cached DB Version: <code><%= @schema_cache.version %></code></li>
27
+ <li>Current DB version: <code><%= ActiveRecord::Migrator.current_version %></code></li>
28
+ <li>Size: <code><%= @schema_cache.version.present? ? @schema_cache.size : 0 %></code> (count of tables, columns, primary_keys, etc.)</li>
29
+ </ul>
30
+
31
+ <h3>Current Schema Cache</h3>
32
+ <p>
33
+ The current schema cache includes any table definitions that have been loaded from the cache dump or lazily evaluated as queries are built.
34
+ The names of all tables are loaded very early. Primary keys, column names, or full column definitions are only loaded as the query builder requires them.
35
+ </p>
36
+ <p>
37
+ The schema cache contains <code><%= @connection_schema_cache.size %></code> entries and
38
+ <%= truth_label(@connection_schema_cache.version.present?,'DOES','DOES NOT') %>
39
+ appear to have been loaded from the schema cache dump.
40
+ </p>
41
+ <% if !Rails.application.config.cache_classes %>
42
+ <p>Note: The schema cache is only loaded once on application startup. During development, with code reloading, it is likely to be reset.</p>
43
+ <% end %>
44
+
45
+ <% cached_tablenames = @connection_schema_cache.instance_variable_get(:@tables) %>
46
+ <% cached_columns = @connection_schema_cache.instance_variable_get(:@columns) %>
47
+ <% cached_columns_hash = @connection_schema_cache.instance_variable_get(:@columns_hash) %>
48
+ <% cached_primary_keys = @connection_schema_cache.instance_variable_get(:@primary_keys) %>
49
+
50
+ <table class="table table-striped table-condensed">
51
+ <tr>
52
+ <th>Table Name</th>
53
+ <th>Table Exists?</th>
54
+ <th>Primary Key</th>
55
+ <th>Columns Size</th>
56
+ <th>Columns Hash Size</th>
57
+ <th>Partial?</th>
58
+ <th>Full?</th>
59
+ </tr>
60
+ <% cached_tablenames.each do |key, value|%>
61
+ <tr>
62
+ <td><%= key %></td>
63
+ <td><%= truth_label(value) %></td>
64
+ <td><%= cached_primary_keys.fetch(key,'--'.freeze) %></td>
65
+ <td><%= cached_columns[key].try(:size) || '--'.freeze %></td>
66
+ <td><%= cached_columns_hash[key].try(:size) || '--'.freeze %></td>
67
+ <td><%= truth_label(cached_primary_keys.include?(key)||cached_columns.include?(key)||cached_columns_hash.include?(key)) %></td>
68
+ <td><%= truth_label(cached_primary_keys.include?(key)&&cached_columns.include?(key)&&cached_columns_hash.include?(key)) %></td>
69
+ </tr>
70
+ <% end %>
71
+ <% if cached_tablenames.blank? %>
72
+ <tr>
73
+ <td colspan="7" class="warning text-center">
74
+ No data exists in the schema cache
75
+ </br>
76
+ This most likely means that the connection has been reset either by
77
+ code reloading or some connection problem
78
+ </td>
79
+ </tr>
80
+ <% end %>
81
+ </table>
@@ -4,7 +4,6 @@
4
4
  <li class="active"><a href="#ruby" role="tab" data-toggle="tab">Ruby</a></li>
5
5
  <li><a href="#environment" role="tab" data-toggle="tab">Environment</a></li>
6
6
  <li><a href="#bundler" role="tab" data-toggle="tab">Bundler</a></li>
7
- <li><a href="#gems" role="tab" data-toggle="tab">Gems</a></li>
8
7
  <li><a href="#gc" role="tab" data-toggle="tab">Garbage Collection</a></li>
9
8
  </ul>
10
9
 
@@ -50,27 +49,6 @@
50
49
  </dl>
51
50
  </div>
52
51
 
53
- <div class="tab-pane" id="gems">
54
- <table class="table">
55
- <tr>
56
- <th>Name</th>
57
- <th>Version</th>
58
- <th>Summary</th>
59
- <th>License</th>
60
- <th>Homepage</th>
61
- </tr>
62
- <% Bundler.rubygems.all_specs.sort_by(&:name).each do |gemspec| %>
63
- <tr>
64
- <td class="text-nowrap"><%= gemspec.name %></td>
65
- <td><%= gemspec.version.to_s %></td>
66
- <td><%= gemspec.summary %></td>
67
- <td><%= gemspec.licenses.join(', ') %></td>
68
- <td><%= link_to gemspec.homepage, gemspec.homepage if !gemspec.homepage.blank? %></td>
69
- </tr>
70
- <% end %>
71
- </table>
72
- </div>
73
-
74
52
  <div class="tab-pane" id="gc">
75
53
  <dl class="dl-horizontal">
76
54
  <%- GC.stat.each_pair do |key,val| %>
@@ -4,7 +4,7 @@ Tuttle::Engine.routes.draw do
4
4
 
5
5
  namespace :rails do
6
6
  get '', :action => :index
7
- get :controllers, :models, :database, :helpers, :assets, :routes, :instrumentation, :inflectors, :cache
7
+ get :controllers, :models, :database, :schema_cache, :helpers, :assets, :routes, :instrumentation, :inflectors, :cache
8
8
  end
9
9
 
10
10
  namespace :ruby do
@@ -13,9 +13,14 @@ Tuttle::Engine.routes.draw do
13
13
  end
14
14
 
15
15
  namespace :gems do
16
+ get '', :action => :index
16
17
  get :http_clients, :json, :other
17
18
  end
18
19
 
20
+ if defined?(Paperclip)
21
+ get '/paperclip' => 'paperclip#index'
22
+ end
23
+
19
24
  if defined?(Devise)
20
25
  get '/devise' => 'devise#index'
21
26
  end
@@ -1,9 +1,14 @@
1
1
  require 'tuttle/engine'
2
+ require 'tuttle/version'
2
3
 
3
4
  module Tuttle
4
5
 
5
6
  mattr_accessor :automount_engine
6
7
  mattr_accessor :enabled
8
+ mattr_accessor :track_notifications
9
+
10
+ @@automount_engine = @@enabled = nil
11
+ @@track_notifications = false
7
12
 
8
13
  def self.setup
9
14
  yield self
@@ -43,10 +43,10 @@ module Tuttle
43
43
  end
44
44
 
45
45
  initializer :tuttle_global_instrumenter, group: :all do
46
- next unless Tuttle.enabled
47
-
48
46
  Tuttle::Engine.events = []
49
47
  Tuttle::Engine.event_counts = Hash.new(0)
48
+ Tuttle::Engine.cache_events = []
49
+ next unless Tuttle.enabled && Tuttle.track_notifications
50
50
 
51
51
  # For now, only instrument non-production mode
52
52
  unless Rails.env.production?
@@ -57,7 +57,6 @@ module Tuttle
57
57
  end
58
58
  end
59
59
 
60
- Tuttle::Engine.cache_events = []
61
60
  # Note: For Rails < 4.2 instrumentation is not enabled by default. Hitting the cache inspector page will enable it for that session.
62
61
  Tuttle::Engine.logger.info('Initializing cache_read subscriber')
63
62
  ActiveSupport::Notifications.subscribe('cache_read.active_support') do |*args|
@@ -0,0 +1,31 @@
1
+ module Tuttle
2
+ module Presenters
3
+ module ActionDispatch
4
+ module Routing
5
+ class RouteWrapper < ::ActionDispatch::Routing::RouteWrapper
6
+
7
+ def endpoint_or_app_name
8
+ uses_dispatcher? ? endpoint : (rack_app.is_a?(Class) ? rack_app : rack_app.class)
9
+ end
10
+
11
+ def controller
12
+ super if uses_dispatcher?
13
+ end
14
+
15
+ def action
16
+ super if uses_dispatcher?
17
+ end
18
+
19
+ def uses_dispatcher?
20
+ rack_app.respond_to?(:dispatcher?)
21
+ end
22
+
23
+ def is_internal_to_rails?
24
+ !!internal?
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Tuttle
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuttle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Gynn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-31 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.4
19
+ version: 4.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 5.0.0
22
+ version: '5.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.1.4
29
+ version: 4.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 5.0.0
32
+ version: '5.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ files:
77
77
  - app/controllers/tuttle/devise_controller.rb
78
78
  - app/controllers/tuttle/gems_controller.rb
79
79
  - app/controllers/tuttle/home_controller.rb
80
+ - app/controllers/tuttle/paperclip_controller.rb
80
81
  - app/controllers/tuttle/rails_controller.rb
81
82
  - app/controllers/tuttle/ruby_controller.rb
82
83
  - app/helpers/tuttle/application_helper.rb
@@ -86,9 +87,11 @@ files:
86
87
  - app/views/tuttle/cancancan/rule_tester.html.erb
87
88
  - app/views/tuttle/devise/index.html.erb
88
89
  - app/views/tuttle/gems/http_clients.html.erb
90
+ - app/views/tuttle/gems/index.html.erb
89
91
  - app/views/tuttle/gems/json.html.erb
90
92
  - app/views/tuttle/gems/other.html.erb
91
93
  - app/views/tuttle/home/index.html.erb
94
+ - app/views/tuttle/paperclip/index.html.erb
92
95
  - app/views/tuttle/rails/assets.html.erb
93
96
  - app/views/tuttle/rails/cache.html.erb
94
97
  - app/views/tuttle/rails/controllers.html.erb
@@ -99,6 +102,7 @@ files:
99
102
  - app/views/tuttle/rails/instrumentation.html.erb
100
103
  - app/views/tuttle/rails/models.html.erb
101
104
  - app/views/tuttle/rails/routes.html.erb
105
+ - app/views/tuttle/rails/schema_cache.html.erb
102
106
  - app/views/tuttle/ruby/index.html.erb
103
107
  - app/views/tuttle/ruby/miscellaneous.html.erb
104
108
  - app/views/tuttle/ruby/tuning.html.erb
@@ -106,6 +110,7 @@ files:
106
110
  - lib/tasks/tuttle_tasks.rake
107
111
  - lib/tuttle.rb
108
112
  - lib/tuttle/engine.rb
113
+ - lib/tuttle/presenters/action_dispatch/routing/route_wrapper.rb
109
114
  - lib/tuttle/version.rb
110
115
  homepage: https://github.com/dgynn/tuttle
111
116
  licenses:
@@ -127,8 +132,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
132
  version: '0'
128
133
  requirements: []
129
134
  rubyforge_project:
130
- rubygems_version: 2.4.6
135
+ rubygems_version: 2.4.8
131
136
  signing_key:
132
137
  specification_version: 4
133
138
  summary: Tuttle for Rails
134
139
  test_files: []
140
+ has_rdoc: