quiet_assets 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +3 -0
- data/LICENSE +5 -0
- data/README.md +33 -0
- data/Rakefile +2 -0
- data/lib/quiet_assets.rb +30 -0
- data/lib/quiet_assets/version.rb +3 -0
- data/quiet_assets.gemspec +16 -0
- metadata +66 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Quiet assets
|
2
|
+
|
3
|
+
Quiet assets turn off assets pipeline log, kind of:
|
4
|
+
|
5
|
+
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-02-13 13:24:04 +0400
|
6
|
+
Served asset /application.js - 304 Not Modified (8ms)
|
7
|
+
|
8
|
+
Support Ruby on Rails ~> 3.1
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'quiet_assets'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
Nothing to do, but if you want to temporarily turn on back assets' log just write:
|
23
|
+
|
24
|
+
config.quite_assets = true
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
Dual licensed under the MIT and GPL licenses:
|
29
|
+
|
30
|
+
+ http://www.opensource.org/licenses/mit-license.php
|
31
|
+
+ http://www.gnu.org/licenses/gpl.html
|
32
|
+
|
33
|
+
Copyright © 2011-2012 Dmitry [KODerFunk](https://github.com/KODerFunk) Karpunun, Dmitry [route](https://github.com/route) Vorotilin / [Evrone.com](http://evrone.com)
|
data/Rakefile
ADDED
data/lib/quiet_assets.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require "quiet_assets/version"
|
2
|
+
|
3
|
+
module QuietAssets
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
# Set as true but user can override it
|
6
|
+
config.quiet_assets = true
|
7
|
+
|
8
|
+
initializer "quiet_assets", :after => "sprockets.environment" do |app|
|
9
|
+
if app.config.quiet_assets == true
|
10
|
+
# Parse PATH_INFO by assets prefix
|
11
|
+
ASSETS_PREFIX = app.config.assets.prefix.split("/").join("/") + "/"
|
12
|
+
app.config.assets.logger = false
|
13
|
+
|
14
|
+
# Just create an alias for call in middleware
|
15
|
+
Rails::Rack::Logger.class_eval do
|
16
|
+
def call_with_quiet_assets(env)
|
17
|
+
old_logger_level, level = Rails.logger.level, Logger::ERROR
|
18
|
+
# Increase log level because of messages that have a low level should not be displayed
|
19
|
+
Rails.logger.level = level if env['PATH_INFO'].index(ASSETS_PREFIX) == 0
|
20
|
+
call_without_quiet_assets(env)
|
21
|
+
ensure
|
22
|
+
# Return back
|
23
|
+
Rails.logger.level = old_logger_level
|
24
|
+
end
|
25
|
+
alias_method_chain :call, :quiet_assets
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path('../lib/quiet_assets/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "quiet_assets"
|
5
|
+
gem.version = QuietAssets::VERSION
|
6
|
+
gem.authors = ["Dmitry Karpunin", "Dmitry Vorotilin"]
|
7
|
+
gem.email = ["koderfunk@gmail.com", "d.vorotilin@gmail.com"]
|
8
|
+
gem.homepage = "http://github.com/evrone/quiet_assets"
|
9
|
+
gem.description = "Quiet assets turn off rails assests log."
|
10
|
+
gem.summary = "Turn off rails assests log."
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.require_paths = ["lib"]
|
14
|
+
|
15
|
+
gem.add_dependency "rails", "~> 3.1"
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: quiet_assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Dmitry Karpunin
|
9
|
+
- Dmitry Vorotilin
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-03-22 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails
|
17
|
+
requirement: &16627800 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.1'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *16627800
|
26
|
+
description: Quiet assets turn off rails assests log.
|
27
|
+
email:
|
28
|
+
- koderfunk@gmail.com
|
29
|
+
- d.vorotilin@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- lib/quiet_assets.rb
|
40
|
+
- lib/quiet_assets/version.rb
|
41
|
+
- quiet_assets.gemspec
|
42
|
+
homepage: http://github.com/evrone/quiet_assets
|
43
|
+
licenses: []
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 1.8.10
|
63
|
+
signing_key:
|
64
|
+
specification_version: 3
|
65
|
+
summary: Turn off rails assests log.
|
66
|
+
test_files: []
|