view_marker 1.0.0

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.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,30 @@
1
+ # ViewMarker
2
+
3
+ Marks Rails logs with a message at the beginning of view rendering:
4
+
5
+ ```
6
+ Started GET "/en/about.html" for 127.0.0.1 at 2012-01-27 12:46:29 +0100
7
+ Processing by PagesController#about as HTML
8
+ Parameters: {"lang"=>"en"}
9
+ ---------------------------- Started view rendering ----------------------------
10
+ Rendered pages/about.html.erb within layouts/application (0.9ms)
11
+ User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
12
+ Rendered layouts/_controls.html.erb (44.6ms)
13
+ Rendered layouts/_header.html.erb (0.0ms)
14
+ Rendered layouts/_navigation.html.erb (5.8ms)
15
+ Completed 200 OK in 66ms (Views: 64.9ms | ActiveRecord: 0.3ms)
16
+ ```
17
+
18
+ Can be useful to identify queries fired in views.
19
+
20
+ ## Installation
21
+
22
+ ViewMarker hooks into `ActionController` and therefore only works with Rails.
23
+
24
+ To use it just include it in your Gemfile:
25
+
26
+ ```ruby
27
+ gem 'view_marker'
28
+ ```
29
+
30
+ And run `bundle install`.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,9 @@
1
+ require "view_marker/version"
2
+ require "view_marker/rails/action_controller/extensions"
3
+ require "action_controller"
4
+
5
+ module ViewMarker
6
+ ActiveSupport.on_load(:action_controller) do
7
+ include ViewMarker::Rails::ActionController::Extensions
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ require "active_support/concern"
2
+
3
+ module ViewMarker
4
+ module Rails
5
+ module ActionController
6
+
7
+ module Extensions
8
+ extend ActiveSupport::Concern
9
+
10
+ included do
11
+ alias_method_chain :render, :hook_for_logging
12
+ end
13
+
14
+ # Add a line to the log to mark the beginning of the view
15
+ def render_with_hook_for_logging(options = nil, extra_options = {})
16
+ logger.debug ' Started view rendering '.center(80, '-')
17
+ render_without_hook_for_logging(options, extra_options)
18
+ end
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module ViewMarker
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "view_marker/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "view_marker"
7
+ s.version = ViewMarker::VERSION
8
+ s.authors = ["Robert Glaser"]
9
+ s.email = ["mail@robert-glaser.de"]
10
+ s.homepage = ""
11
+ s.summary = %q{Marks Rails logs with a message at the beginning of view rendering}
12
+ s.description = %q{Marks Rails logs with a message at the beginning of view rendering}
13
+
14
+ s.rubyforge_project = "view_marker"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_runtime_dependency "rails"
22
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: view_marker
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Glaser
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70153952332500 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70153952332500
25
+ description: Marks Rails logs with a message at the beginning of view rendering
26
+ email:
27
+ - mail@robert-glaser.de
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.md
35
+ - Rakefile
36
+ - lib/view_marker.rb
37
+ - lib/view_marker/rails/action_controller/extensions.rb
38
+ - lib/view_marker/version.rb
39
+ - view_marker.gemspec
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: view_marker
60
+ rubygems_version: 1.8.10
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Marks Rails logs with a message at the beginning of view rendering
64
+ test_files: []