quiet_assets 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +9 -8
- data/lib/quiet_assets.rb +13 -8
- data/quiet_assets.gemspec +4 -3
- data/test/test_quiet_assets.rb +35 -2
- metadata +20 -26
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e44be74dccbd0d599faeb9b311e2d885dc2163ca
|
4
|
+
data.tar.gz: 0215c97043b1873b08decd328aadd88f90118e71
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 267186f8e3efebee49e416d496e4a28fec1f1825fa10f2846555755283c9d946d70be5c082167a4afe4ba1ed1c14cb59f8a4375e5ba69814063780f612839bc6
|
7
|
+
data.tar.gz: d743dd75ab70996be06e22c1b51bd91a3c6be8261d3917597c4030978855b40c3a5f2d95a64f139698df996b1a93e1c8fac4b3eaae54c1ce0fff630d40c2f99c
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# Quiet
|
1
|
+
# Quiet Assets
|
2
2
|
[![Continuous Integration status](https://secure.travis-ci.org/evrone/quiet_assets.png)](http://travis-ci.org/evrone/quiet_assets)
|
3
3
|
|
4
|
-
Quiet
|
4
|
+
Quiet Assets turns off the Rails asset pipeline log. This means that it suppresses messages in your development log such as:
|
5
5
|
|
6
6
|
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-02-13 13:24:04 +0400
|
7
7
|
Served asset /application.js - 304 Not Modified (8ms)
|
@@ -10,18 +10,19 @@ Support Ruby on Rails >= 3.1
|
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
It is recommended that this gem only be used for development.
|
14
|
+
To install, add this line to development group in your Gemfile:
|
15
15
|
|
16
|
-
gem 'quiet_assets', :
|
16
|
+
gem 'quiet_assets', group: :development
|
17
17
|
|
18
|
-
|
18
|
+
Then, from the command line, run:
|
19
19
|
|
20
20
|
$ bundle
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
24
|
+
Simply installing Quiet Assets will suppress the log messages automatically. However, if you wish to temporarily re-enable the logging of the asset pipeline messages,
|
25
|
+
place the following in your `config/application.rb` file:
|
25
26
|
|
26
27
|
config.quiet_assets = false
|
27
28
|
|
@@ -32,4 +33,4 @@ Dual licensed under the MIT or GPL licenses:
|
|
32
33
|
+ http://www.opensource.org/licenses/mit-license.php
|
33
34
|
+ http://www.gnu.org/licenses/gpl.html
|
34
35
|
|
35
|
-
Copyright © 2011-
|
36
|
+
Copyright © 2011-2014 Dmitry [@KODerFunk](https://github.com/KODerFunk) Karpunun, Dmitry [@route](https://github.com/route) Vorotilin / [Evrone.com](http://evrone.com)
|
data/lib/quiet_assets.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
1
3
|
module QuietAssets
|
2
4
|
class Engine < ::Rails::Engine
|
3
5
|
# Set as true but user can override it
|
@@ -6,19 +8,22 @@ module QuietAssets
|
|
6
8
|
initializer 'quiet_assets', :after => 'sprockets.environment' do |app|
|
7
9
|
next unless app.config.quiet_assets
|
8
10
|
# Parse PATH_INFO by assets prefix
|
9
|
-
ASSETS_PREFIX =
|
11
|
+
ASSETS_PREFIX = %r[\A/{0,2}#{app.config.assets.prefix}]
|
12
|
+
KEY = 'quiet_assets.old_level'
|
10
13
|
app.config.assets.logger = false
|
11
14
|
|
12
15
|
# Just create an alias for call in middleware
|
13
16
|
Rails::Rack::Logger.class_eval do
|
14
17
|
def call_with_quiet_assets(env)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
begin
|
19
|
+
if env['PATH_INFO'] =~ ASSETS_PREFIX
|
20
|
+
env[KEY] = Rails.logger.level
|
21
|
+
Rails.logger.level = Logger::ERROR
|
22
|
+
end
|
23
|
+
call_without_quiet_assets(env)
|
24
|
+
ensure
|
25
|
+
Rails.logger.level = env[KEY] if env[KEY]
|
26
|
+
end
|
22
27
|
end
|
23
28
|
alias_method_chain :call, :quiet_assets
|
24
29
|
end
|
data/quiet_assets.gemspec
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = 'quiet_assets'
|
3
|
-
gem.version = '1.0.
|
3
|
+
gem.version = '1.0.3'
|
4
4
|
gem.authors = ['Dmitry Karpunin', 'Dmitry Vorotilin']
|
5
5
|
gem.email = ['koderfunk@gmail.com', 'd.vorotilin@gmail.com']
|
6
6
|
gem.homepage = 'http://github.com/evrone/quiet_assets'
|
7
|
-
gem.description = 'Quiet
|
8
|
-
gem.summary = '
|
7
|
+
gem.description = 'Quiet Assets turns off Rails asset pipeline log.'
|
8
|
+
gem.summary = 'Turns off Rails asset pipeline log.'
|
9
|
+
gem.licenses = ['MIT', 'GPL']
|
9
10
|
|
10
11
|
gem.files = %w(LICENSE README.md lib/quiet_assets.rb quiet_assets.gemspec)
|
11
12
|
gem.require_paths = %w(lib)
|
data/test/test_quiet_assets.rb
CHANGED
@@ -67,12 +67,37 @@ class HelperTest < Test::Unit::TestCase
|
|
67
67
|
assert_equal '', output.string
|
68
68
|
end
|
69
69
|
|
70
|
+
def test_in_multi_thread_env
|
71
|
+
initialize! { config.quiet_assets = true }
|
72
|
+
|
73
|
+
th1 = Thread.new do
|
74
|
+
sleep 0.1
|
75
|
+
app.call request('/assets/picture')
|
76
|
+
end
|
77
|
+
|
78
|
+
th2 = Thread.new do
|
79
|
+
sleep 0.1
|
80
|
+
app.call request('/')
|
81
|
+
end
|
82
|
+
|
83
|
+
th3 = Thread.new do
|
84
|
+
sleep 0.1
|
85
|
+
app.call request('/assets/picture')
|
86
|
+
end
|
87
|
+
|
88
|
+
[th1, th2, th3].map { |i| i.join }
|
89
|
+
|
90
|
+
n = output.string.lines.select{|i| i.match(/Started GET "\/"/) }
|
91
|
+
|
92
|
+
assert_equal n.size, 1
|
93
|
+
end
|
94
|
+
|
70
95
|
def test_assets_url_with_turned_off_option
|
71
96
|
initialize! { config.quiet_assets = false }
|
72
97
|
|
73
98
|
app.call request('/assets/picture')
|
74
99
|
|
75
|
-
assert_match
|
100
|
+
assert_match(/Started GET \"\/assets\/picture\" for at/, output.string)
|
76
101
|
end
|
77
102
|
|
78
103
|
def test_regular_url
|
@@ -80,6 +105,14 @@ class HelperTest < Test::Unit::TestCase
|
|
80
105
|
|
81
106
|
app.call request('/')
|
82
107
|
|
83
|
-
assert_match
|
108
|
+
assert_match(/Started GET \"\/\" for at/, output.string)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_full_url_with_couple_slashes
|
112
|
+
initialize!
|
113
|
+
|
114
|
+
app.call request('http://some-url.com//assets/picture')
|
115
|
+
|
116
|
+
assert_equal '', output.string
|
84
117
|
end
|
85
118
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiet_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dmitry Karpunin
|
@@ -10,63 +9,57 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: railties
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - ">="
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '3.1'
|
23
|
-
- - <
|
21
|
+
- - "<"
|
24
22
|
- !ruby/object:Gem::Version
|
25
23
|
version: '5.0'
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
26
|
version_requirements: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
27
|
requirements:
|
31
|
-
- -
|
28
|
+
- - ">="
|
32
29
|
- !ruby/object:Gem::Version
|
33
30
|
version: '3.1'
|
34
|
-
- - <
|
31
|
+
- - "<"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '5.0'
|
37
34
|
- !ruby/object:Gem::Dependency
|
38
35
|
name: rake
|
39
36
|
requirement: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
37
|
requirements:
|
42
|
-
- -
|
38
|
+
- - ">="
|
43
39
|
- !ruby/object:Gem::Version
|
44
40
|
version: '0'
|
45
41
|
type: :development
|
46
42
|
prerelease: false
|
47
43
|
version_requirements: !ruby/object:Gem::Requirement
|
48
|
-
none: false
|
49
44
|
requirements:
|
50
|
-
- -
|
45
|
+
- - ">="
|
51
46
|
- !ruby/object:Gem::Version
|
52
47
|
version: '0'
|
53
48
|
- !ruby/object:Gem::Dependency
|
54
49
|
name: tzinfo
|
55
50
|
requirement: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
51
|
requirements:
|
58
|
-
- -
|
52
|
+
- - ">="
|
59
53
|
- !ruby/object:Gem::Version
|
60
54
|
version: '0'
|
61
55
|
type: :development
|
62
56
|
prerelease: false
|
63
57
|
version_requirements: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
58
|
requirements:
|
66
|
-
- -
|
59
|
+
- - ">="
|
67
60
|
- !ruby/object:Gem::Version
|
68
61
|
version: '0'
|
69
|
-
description: Quiet
|
62
|
+
description: Quiet Assets turns off Rails asset pipeline log.
|
70
63
|
email:
|
71
64
|
- koderfunk@gmail.com
|
72
65
|
- d.vorotilin@gmail.com
|
@@ -80,28 +73,29 @@ files:
|
|
80
73
|
- quiet_assets.gemspec
|
81
74
|
- test/test_quiet_assets.rb
|
82
75
|
homepage: http://github.com/evrone/quiet_assets
|
83
|
-
licenses:
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
- GPL
|
79
|
+
metadata: {}
|
84
80
|
post_install_message:
|
85
81
|
rdoc_options: []
|
86
82
|
require_paths:
|
87
83
|
- lib
|
88
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
85
|
requirements:
|
91
|
-
- -
|
86
|
+
- - ">="
|
92
87
|
- !ruby/object:Gem::Version
|
93
88
|
version: '0'
|
94
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
90
|
requirements:
|
97
|
-
- -
|
91
|
+
- - ">="
|
98
92
|
- !ruby/object:Gem::Version
|
99
93
|
version: '0'
|
100
94
|
requirements: []
|
101
95
|
rubyforge_project:
|
102
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.2.2
|
103
97
|
signing_key:
|
104
|
-
specification_version:
|
105
|
-
summary:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Turns off Rails asset pipeline log.
|
106
100
|
test_files:
|
107
101
|
- test/test_quiet_assets.rb
|