shut_up_assets 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +46 -0
- data/Gemfile +13 -0
- data/LICENSE +5 -0
- data/README.md +40 -0
- data/Rakefile +12 -0
- data/lib/shut_up_assets.rb +49 -0
- data/shut_up_assets.gemspec +23 -0
- data/test/integration_test.rb +126 -0
- data/test/test_helper.rb +35 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dcdbbf1627dfe985fc25972091cbe62f422406c5
|
4
|
+
data.tar.gz: 25829a4b001ef53509ade664e8889700698f6a8f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b6112d1cac18e632c5cf9a40a829b8ee1be40bf5c65a67f9192fea727925dbc7816b1038eb8e7f15e46f3c01a7a63bb21bdce98a1185180c45d37c8bb186541a
|
7
|
+
data.tar.gz: d44c6281d225d2b78a3f735212c1336b7be0bc2b94fa7c3290dd907a955673b890f51921c46ae3883f526c15bda5a8509fc27bd465422c4d222370c7ab1b9538
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
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
|
18
|
+
.idea/
|
19
|
+
log
|
20
|
+
.gem/
|
21
|
+
.envrc
|
22
|
+
.ruby-version
|
23
|
+
.ruby-gemhome
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
2.0.0
|
2
|
+
=====
|
3
|
+
|
4
|
+
Forked to ShutUp Assets.
|
5
|
+
|
6
|
+
Breaking Changes
|
7
|
+
----------------
|
8
|
+
|
9
|
+
- Working only with Ruby >= 2.2, Rails >= 4.2
|
10
|
+
|
11
|
+
Enhancements
|
12
|
+
------------
|
13
|
+
|
14
|
+
- Better performance
|
15
|
+
- Update gemspec file, tests & rake
|
16
|
+
|
17
|
+
Bug Fixes
|
18
|
+
---------
|
19
|
+
|
20
|
+
- Fix [Rails stop writing #42](https://github.com/evrone/quiet_assets/issues/42)
|
21
|
+
|
22
|
+
1.1.0
|
23
|
+
=====
|
24
|
+
|
25
|
+
Compare: https://github.com/evrone/quiet_assets/compare/v1.0.3...v1.1.0
|
26
|
+
|
27
|
+
Breaking Changes
|
28
|
+
----------------
|
29
|
+
|
30
|
+
None
|
31
|
+
|
32
|
+
Enhancements
|
33
|
+
------------
|
34
|
+
|
35
|
+
- Add config option to suppress additional paths.
|
36
|
+
(https://github.com/evrone/quiet_assets/pull/34)
|
37
|
+
|
38
|
+
Bug Fixes
|
39
|
+
---------
|
40
|
+
|
41
|
+
None
|
42
|
+
|
43
|
+
1.0.3
|
44
|
+
=====
|
45
|
+
|
46
|
+
No release notes here yet, but PRs are welcome!
|
data/Gemfile
ADDED
data/LICENSE
ADDED
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# ShutUp Assets
|
2
|
+
[![Continuous Integration status](https://api.travis-ci.org/estum/shut_up_assets.svg)](http://travis-ci.org/estum/shut_up_assets)
|
3
|
+
|
4
|
+
ShutUp Assets is a fresh fork of [Quiet Assets](https://github.com/evrone/quiet_assets), it turns off the Rails asset pipeline log. This means that it suppresses messages in your development log such as:
|
5
|
+
|
6
|
+
Started GET "/assets/application.js" for 127.0.0.1 at 2015-01-28 13:35:34 +0300
|
7
|
+
Served asset /application.js - 304 Not Modified (8ms)
|
8
|
+
|
9
|
+
Support Ruby on Rails >= 4.2
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
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
|
+
|
16
|
+
gem 'shut_up_assets', group: :development
|
17
|
+
|
18
|
+
Then, from the command line, run:
|
19
|
+
|
20
|
+
$ bundle
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Simply installing ShutUp 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:
|
26
|
+
|
27
|
+
config.quiet_assets = false
|
28
|
+
|
29
|
+
If you need to supress output for other paths you can do so by specifying:
|
30
|
+
|
31
|
+
config.quiet_assets_paths << '/silent/'
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
Dual licensed under the MIT or GPL licenses:
|
36
|
+
|
37
|
+
+ http://www.opensource.org/licenses/mit-license.php
|
38
|
+
+ http://www.gnu.org/licenses/gpl.html
|
39
|
+
|
40
|
+
Copyright © 2011-2015 Dmitry [@KODerFunk](https://github.com/KODerFunk) Karpunun, Dmitry [@route](https://github.com/route) Vorotilin / [Evrone.com](http://evrone.com)
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'rails/railtie'
|
2
|
+
require 'rails/rack/logger'
|
3
|
+
require 'active_support/configurable'
|
4
|
+
|
5
|
+
class ShutUpAssets < Rails::Railtie # :nodoc-all:
|
6
|
+
class << self
|
7
|
+
def enabled?
|
8
|
+
config.quiet_assets
|
9
|
+
end
|
10
|
+
|
11
|
+
def suppress_on?(request)
|
12
|
+
enabled? && request.get? && request.filtered_path =~ config.shut_up_assets.pattern
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class RackLogger < Rails::Rack::Logger
|
17
|
+
def call_app(request, env)
|
18
|
+
return super unless ShutUpAssets.suppress_on?(request)
|
19
|
+
logger.silence(::Logger::WARN) { super }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
config.quiet_assets = true
|
24
|
+
config.shut_up_assets = ActiveSupport::OrderedOptions.new
|
25
|
+
config.shut_up_assets.paths = []
|
26
|
+
config.shut_up_assets.pattern = nil
|
27
|
+
|
28
|
+
initializer 'shut_up_assets.set_matching_pattern', after: 'sprockets.environment' do |app|
|
29
|
+
config = app.config
|
30
|
+
options = app.config.shut_up_assets
|
31
|
+
|
32
|
+
if ShutUpAssets.enabled?
|
33
|
+
config.assets.logger = false
|
34
|
+
options.pattern = begin
|
35
|
+
pattern = "\/{0,2}#{config.assets.prefix}"
|
36
|
+
pattern = "(#{Regexp.union([pattern].concat(Array.wrap(options.paths))).source})" if options.paths.size > 0
|
37
|
+
/\A#{pattern}/
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
ActiveSupport.on_load(:shut_up_assets) do
|
42
|
+
options.each { |k,v| config.shut_up_assets.send("#{k}=", v) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
config.app_middleware.swap Rails::Rack::Logger, ShutUpAssets::RackLogger
|
47
|
+
|
48
|
+
ActiveSupport.run_load_hooks(:shut_up_assets, self)
|
49
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = 'shut_up_assets'
|
6
|
+
spec.version = '2.0.0'
|
7
|
+
spec.authors = ['Dmitry Karpunin', 'Dmitry Vorotilin', 'Anton Semenov']
|
8
|
+
spec.email = %w(koderfunk@gmail.com d.vorotilin@gmail.com anton.estum@gmail.com)
|
9
|
+
spec.homepage = 'https://github.com/estum/shut_up_assets'
|
10
|
+
spec.description = 'Shuts up asset pipeline log in Rails 4+.'
|
11
|
+
spec.summary = 'Shut up Assets is a fresh fork of Quiet Assets, it turns off Rails asset pipeline log.'
|
12
|
+
spec.licenses = %w(MIT GPL)
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.require_paths = %w(lib)
|
16
|
+
spec.test_files = Dir['test/**/*']
|
17
|
+
|
18
|
+
spec.required_ruby_version = ">= 2.2"
|
19
|
+
|
20
|
+
spec.add_dependency 'railties', '>= 4.2', '< 5.0'
|
21
|
+
spec.add_development_dependency 'rake'
|
22
|
+
spec.add_development_dependency 'bundler'
|
23
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class HomeController < ActionController::Base
|
4
|
+
def index
|
5
|
+
render :text => 'Hi there!'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class IntegrationTest < ActionController::TestCase
|
10
|
+
attr_accessor :app, :output
|
11
|
+
|
12
|
+
def initialize!(&block)
|
13
|
+
app.configure(&block) if block_given?
|
14
|
+
|
15
|
+
app.initialize!
|
16
|
+
|
17
|
+
Rails.logger = ActiveSupport::Logger.new(output)
|
18
|
+
# Rails.logger.formatter = lambda { |s, d, p, m| "#{m}\n" }
|
19
|
+
end
|
20
|
+
|
21
|
+
def request(uri)
|
22
|
+
Rack::MockRequest.env_for(uri)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_quiet_assets_pattern
|
26
|
+
assert_match ShutUpAssets.config.shut_up_assets.pattern, '/assets/picture'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_assets_url_with_option_by_default
|
30
|
+
initialize!
|
31
|
+
|
32
|
+
app.call request('/assets/picture')
|
33
|
+
|
34
|
+
assert_equal '', output.string
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_assets_url_with_turned_on_option
|
38
|
+
initialize! { config.quiet_assets = true }
|
39
|
+
|
40
|
+
app.call request('/assets/picture')
|
41
|
+
|
42
|
+
assert_equal '', output.string
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_in_multi_thread_env
|
46
|
+
initialize! { config.quiet_assets = true }
|
47
|
+
|
48
|
+
th1 = Thread.new do
|
49
|
+
sleep 0.1
|
50
|
+
app.call request('/assets/picture')
|
51
|
+
end
|
52
|
+
|
53
|
+
th2 = Thread.new do
|
54
|
+
sleep 0.1
|
55
|
+
app.call request('/')
|
56
|
+
end
|
57
|
+
|
58
|
+
th3 = Thread.new do
|
59
|
+
sleep 0.1
|
60
|
+
app.call request('/assets/picture')
|
61
|
+
end
|
62
|
+
|
63
|
+
[th1, th2, th3].map { |i| i.join }
|
64
|
+
|
65
|
+
n = output.string.lines.select{|i| i.match(/Started GET "\/"/) }
|
66
|
+
|
67
|
+
assert_equal n.size, 1
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_assets_url_with_turned_off_option
|
71
|
+
initialize! { |app| app.config.quiet_assets = false }\
|
72
|
+
|
73
|
+
app.call request('/assets/picture')
|
74
|
+
|
75
|
+
assert_match(/Started GET \"\/assets\/picture\" for at/, output.string)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_regular_url
|
79
|
+
initialize!
|
80
|
+
|
81
|
+
app.call request('/')
|
82
|
+
|
83
|
+
assert_match(/Started GET \"\/\" for at/, output.string)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_full_url_with_couple_slashes
|
87
|
+
initialize!
|
88
|
+
|
89
|
+
app.call request('http://some-url.com//assets/picture')
|
90
|
+
|
91
|
+
assert_equal '', output.string
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_quiet_url
|
95
|
+
initialize!
|
96
|
+
|
97
|
+
app.call request('/quiet/this')
|
98
|
+
|
99
|
+
assert_match(/Started GET \"\/quiet\/this\" for at/, output.string)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_quiet_url_with_paths_option_as_string_equality
|
103
|
+
initialize! { config.shut_up_assets.paths = '/quiet/' }
|
104
|
+
|
105
|
+
app.call request('/quiet/this')
|
106
|
+
|
107
|
+
assert_equal '', output.string
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_quiet_url_with_paths_option_as_string_appending
|
111
|
+
initialize! { config.shut_up_assets.paths << '/quiet/' }
|
112
|
+
|
113
|
+
app.call request('/quiet/this')
|
114
|
+
|
115
|
+
assert_equal '', output.string
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_quiet_url_with_paths_option_as_array
|
119
|
+
initialize! { config.shut_up_assets.paths += ['/quiet/'] }
|
120
|
+
|
121
|
+
app.call request('/quiet/this')
|
122
|
+
|
123
|
+
assert_equal '', output.string
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'rails'
|
4
|
+
require 'action_controller'
|
5
|
+
require 'shut_up_assets'
|
6
|
+
|
7
|
+
# Ensure backward compatibility with Minitest 4
|
8
|
+
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
|
9
|
+
|
10
|
+
ActiveSupport.test_order = :sorted
|
11
|
+
|
12
|
+
require "minitest/reporters"
|
13
|
+
Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new(:color => true)
|
14
|
+
|
15
|
+
ActionController::TestCase.class_eval do
|
16
|
+
def setup
|
17
|
+
@output = StringIO.new
|
18
|
+
|
19
|
+
@app = Class.new(Rails::Application)
|
20
|
+
|
21
|
+
@app.configure do
|
22
|
+
config.active_support.deprecation = :notify
|
23
|
+
config.secret_token = '685e1a60792fa0d036a82a52c0f97e42'
|
24
|
+
config.eager_load = false
|
25
|
+
|
26
|
+
routes do
|
27
|
+
root :to => 'home#index'
|
28
|
+
get 'assets/picture' => 'home#index'
|
29
|
+
get 'quiet/this' => 'home#index'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
@routes = @app.routes
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shut_up_assets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dmitry Karpunin
|
8
|
+
- Dmitry Vorotilin
|
9
|
+
- Anton Semenov
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: railties
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '4.2'
|
22
|
+
- - "<"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '5.0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '4.2'
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '5.0'
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
type: :development
|
43
|
+
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: bundler
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
description: Shuts up asset pipeline log in Rails 4+.
|
64
|
+
email:
|
65
|
+
- koderfunk@gmail.com
|
66
|
+
- d.vorotilin@gmail.com
|
67
|
+
- anton.estum@gmail.com
|
68
|
+
executables: []
|
69
|
+
extensions: []
|
70
|
+
extra_rdoc_files: []
|
71
|
+
files:
|
72
|
+
- ".gitignore"
|
73
|
+
- ".travis.yml"
|
74
|
+
- CHANGELOG.md
|
75
|
+
- Gemfile
|
76
|
+
- LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- lib/shut_up_assets.rb
|
80
|
+
- shut_up_assets.gemspec
|
81
|
+
- test/integration_test.rb
|
82
|
+
- test/test_helper.rb
|
83
|
+
homepage: https://github.com/estum/shut_up_assets
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
- GPL
|
87
|
+
metadata: {}
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.2'
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 2.4.8
|
105
|
+
signing_key:
|
106
|
+
specification_version: 4
|
107
|
+
summary: Shut up Assets is a fresh fork of Quiet Assets, it turns off Rails asset
|
108
|
+
pipeline log.
|
109
|
+
test_files:
|
110
|
+
- test/integration_test.rb
|
111
|
+
- test/test_helper.rb
|
112
|
+
has_rdoc:
|