disable_assets_logger 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Include rake in Gemfile so that `bundle exec rake` doesn't raise an error
4
+ gem 'rake', :group => :test
5
+
6
+ # Specify your gem's dependencies in disable_assets_logger.gemspec
7
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Nathan Broadbent
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # Disable Assets Logger
2
+
3
+ Stop asset requests from being logged in your terminal.
4
+
5
+ Thanks to [@macournoyer](https://github.com/macournoyer) for [the original code](https://github.com/rails/rails/issues/2639#issuecomment-6591735).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's `Gemfile`, in the `:development` group:
10
+
11
+ group :development do
12
+ gem 'disable_assets_logger'
13
+ end
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install disable_assets_logger
22
+
23
+ ## Usage
24
+
25
+ Just add it your `Gemfile`, and you're done. Note that this gem will be disabled in production.
26
+
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'disable_assets_logger/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "disable_assets_logger"
8
+ gem.version = DisableAssetsLogger::VERSION
9
+ gem.authors = ["Nathan Broadbent"]
10
+ gem.email = ["nathan.f77@gmail.com"]
11
+ gem.description = %q{Disable assets logger in development, so asset requests don't show in your terminal}
12
+ gem.summary = %q{Disable assets logger in development}
13
+ gem.homepage = ""
14
+ gem.license = "MIT"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,3 @@
1
+ require "disable_assets_logger/version"
2
+ require "disable_assets_logger/middleware"
3
+ require "disable_assets_logger/railtie"
@@ -0,0 +1,16 @@
1
+ module DisableAssetsLogger
2
+ class Middleware
3
+ def initialize(app)
4
+ @app = app
5
+ Rails.application.assets.logger = Logger.new('/dev/null')
6
+ end
7
+
8
+ def call(env)
9
+ original_level = Rails.logger.level
10
+ Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0
11
+ @app.call(env)
12
+ ensure
13
+ Rails.logger.level = original_level
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ module DisableAssetsLogger
2
+ class Railtie < Rails::Railtie
3
+ initializer "disable_assets_logger" do
4
+ unless Rails.env.production?
5
+ Rails.application.middleware.insert_before Rails::Rack::Logger, DisableAssetsLogger::Middleware
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module DisableAssetsLogger
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: disable_assets_logger
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nathan Broadbent
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-11 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Disable assets logger in development, so asset requests don't show in
15
+ your terminal
16
+ email:
17
+ - nathan.f77@gmail.com
18
+ executables: []
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - disable_assets_logger.gemspec
28
+ - lib/disable_assets_logger.rb
29
+ - lib/disable_assets_logger/middleware.rb
30
+ - lib/disable_assets_logger/railtie.rb
31
+ - lib/disable_assets_logger/version.rb
32
+ homepage: ''
33
+ licenses:
34
+ - MIT
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ segments:
46
+ - 0
47
+ hash: -3599785288836899538
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ segments:
55
+ - 0
56
+ hash: -3599785288836899538
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 1.8.24
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Disable assets logger in development
63
+ test_files: []