quiet_assets 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +5 -3
- data/lib/quiet_assets.rb +16 -19
- data/quiet_assets.gemspec +13 -12
- data/test/test_quiet_assets.rb +85 -0
- metadata +52 -11
- data/.gitignore +0 -18
- data/Gemfile +0 -3
- data/Rakefile +0 -2
- data/lib/quiet_assets/version.rb +0 -3
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
# Quiet assets
|
2
|
+
[![Continuous Integration status](https://secure.travis-ci.org/evrone/quiet_assets.png)](http://travis-ci.org/evrone/quiet_assets)
|
2
3
|
|
3
4
|
Quiet assets turn off assets pipeline log, kind of:
|
4
5
|
|
5
6
|
Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2012-02-13 13:24:04 +0400
|
6
7
|
Served asset /application.js - 304 Not Modified (8ms)
|
7
8
|
|
8
|
-
Support Ruby on Rails
|
9
|
+
Support Ruby on Rails >= 3.1
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
12
|
-
|
13
|
+
We recommend you to use it only for development.
|
14
|
+
Add this line to development group in your Gemfile:
|
13
15
|
|
14
16
|
gem 'quiet_assets', :group => :development
|
15
17
|
|
@@ -25,7 +27,7 @@ Nothing to do, but if you want to temporarily turn on back assets' log just writ
|
|
25
27
|
|
26
28
|
## License
|
27
29
|
|
28
|
-
Dual licensed under the MIT
|
30
|
+
Dual licensed under the MIT or GPL licenses:
|
29
31
|
|
30
32
|
+ http://www.opensource.org/licenses/mit-license.php
|
31
33
|
+ http://www.gnu.org/licenses/gpl.html
|
data/lib/quiet_assets.rb
CHANGED
@@ -1,29 +1,26 @@
|
|
1
|
-
require "quiet_assets/version"
|
2
|
-
|
3
1
|
module QuietAssets
|
4
2
|
class Engine < ::Rails::Engine
|
5
3
|
# Set as true but user can override it
|
6
4
|
config.quiet_assets = true
|
7
5
|
|
8
|
-
initializer
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
initializer 'quiet_assets', :after => 'sprockets.environment' do |app|
|
7
|
+
next unless app.config.quiet_assets
|
8
|
+
# Parse PATH_INFO by assets prefix
|
9
|
+
ASSETS_PREFIX = "/#{app.config.assets.prefix[/\A\/?(.*?)\/?\z/, 1]}/"
|
10
|
+
app.config.assets.logger = false
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
alias_method_chain :call, :quiet_assets
|
12
|
+
# Just create an alias for call in middleware
|
13
|
+
Rails::Rack::Logger.class_eval do
|
14
|
+
def call_with_quiet_assets(env)
|
15
|
+
old_logger_level, level = Rails.logger.level, Logger::ERROR
|
16
|
+
# Increase log level because of messages that have a low level should not be displayed
|
17
|
+
Rails.logger.level = level if env['PATH_INFO'].start_with?(ASSETS_PREFIX)
|
18
|
+
call_without_quiet_assets(env)
|
19
|
+
ensure
|
20
|
+
# Return back
|
21
|
+
Rails.logger.level = old_logger_level
|
26
22
|
end
|
23
|
+
alias_method_chain :call, :quiet_assets
|
27
24
|
end
|
28
25
|
end
|
29
26
|
end
|
data/quiet_assets.gemspec
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
require File.expand_path('../lib/quiet_assets/version', __FILE__)
|
2
|
-
|
3
1
|
Gem::Specification.new do |gem|
|
4
|
-
gem.name =
|
5
|
-
gem.version =
|
6
|
-
gem.authors = [
|
7
|
-
gem.email = [
|
8
|
-
gem.homepage =
|
9
|
-
gem.description =
|
10
|
-
gem.summary =
|
2
|
+
gem.name = 'quiet_assets'
|
3
|
+
gem.version = '1.0.2'
|
4
|
+
gem.authors = ['Dmitry Karpunin', 'Dmitry Vorotilin']
|
5
|
+
gem.email = ['koderfunk@gmail.com', 'd.vorotilin@gmail.com']
|
6
|
+
gem.homepage = 'http://github.com/evrone/quiet_assets'
|
7
|
+
gem.description = 'Quiet assets turn off rails assets log.'
|
8
|
+
gem.summary = 'Turn off rails assets log.'
|
11
9
|
|
12
|
-
gem.files =
|
13
|
-
gem.require_paths =
|
10
|
+
gem.files = %w(LICENSE README.md lib/quiet_assets.rb quiet_assets.gemspec)
|
11
|
+
gem.require_paths = %w(lib)
|
12
|
+
gem.test_files = %w(test/test_quiet_assets.rb)
|
14
13
|
|
15
|
-
gem.add_dependency
|
14
|
+
gem.add_dependency 'railties', '>= 3.1', '< 5.0'
|
15
|
+
gem.add_development_dependency 'rake'
|
16
|
+
gem.add_development_dependency 'tzinfo'
|
16
17
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
require 'rails'
|
4
|
+
require 'rails/all'
|
5
|
+
|
6
|
+
require 'test/unit'
|
7
|
+
require 'active_support/testing/isolation'
|
8
|
+
|
9
|
+
require File.expand_path('../../lib/quiet_assets', __FILE__)
|
10
|
+
|
11
|
+
class HomeController < ActionController::Base
|
12
|
+
def index
|
13
|
+
render :text => 'Hi there!'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class HelperTest < Test::Unit::TestCase
|
18
|
+
include ActiveSupport::Testing::Isolation
|
19
|
+
|
20
|
+
attr_reader :app, :output
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@output = StringIO.new
|
24
|
+
|
25
|
+
# Ruby 1.8 doesn't call self.inherited inside Class.new
|
26
|
+
# Config and routes are unreacheable inside the block here.
|
27
|
+
@app = Class.new(Rails::Application)
|
28
|
+
|
29
|
+
app.configure do
|
30
|
+
config.active_support.deprecation = :notify
|
31
|
+
config.secret_token = '685e1a60792fa0d036a82a52c0f97e42'
|
32
|
+
config.eager_load = false
|
33
|
+
|
34
|
+
routes {
|
35
|
+
root :to => 'home#index'
|
36
|
+
get 'assets/picture' => 'home#index'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def initialize!(&block)
|
42
|
+
app.configure(&block) if block_given?
|
43
|
+
|
44
|
+
app.initialize!
|
45
|
+
|
46
|
+
Rails.logger = Logger.new(output)
|
47
|
+
Rails.logger.formatter = lambda { |s, d, p, m| "#{m}\n" }
|
48
|
+
end
|
49
|
+
|
50
|
+
def request(uri)
|
51
|
+
Rack::MockRequest.env_for(uri)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_assets_url_with_option_by_default
|
55
|
+
initialize!
|
56
|
+
|
57
|
+
app.call request('/assets/picture')
|
58
|
+
|
59
|
+
assert_equal '', output.string
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_assets_url_with_turned_on_option
|
63
|
+
initialize! { config.quiet_assets = true }
|
64
|
+
|
65
|
+
app.call request('/assets/picture')
|
66
|
+
|
67
|
+
assert_equal '', output.string
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_assets_url_with_turned_off_option
|
71
|
+
initialize! { 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
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiet_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,19 +10,62 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
|
-
- -
|
20
|
+
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '3.1'
|
23
|
+
- - <
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '5.0'
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
|
-
version_requirements:
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.1'
|
34
|
+
- - <
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '5.0'
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake
|
39
|
+
requirement: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: !ruby/object:Gem::Requirement
|
48
|
+
none: false
|
49
|
+
requirements:
|
50
|
+
- - ! '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: tzinfo
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
26
69
|
description: Quiet assets turn off rails assets log.
|
27
70
|
email:
|
28
71
|
- koderfunk@gmail.com
|
@@ -31,14 +74,11 @@ executables: []
|
|
31
74
|
extensions: []
|
32
75
|
extra_rdoc_files: []
|
33
76
|
files:
|
34
|
-
- .gitignore
|
35
|
-
- Gemfile
|
36
77
|
- LICENSE
|
37
78
|
- README.md
|
38
|
-
- Rakefile
|
39
79
|
- lib/quiet_assets.rb
|
40
|
-
- lib/quiet_assets/version.rb
|
41
80
|
- quiet_assets.gemspec
|
81
|
+
- test/test_quiet_assets.rb
|
42
82
|
homepage: http://github.com/evrone/quiet_assets
|
43
83
|
licenses: []
|
44
84
|
post_install_message:
|
@@ -59,8 +99,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
99
|
version: '0'
|
60
100
|
requirements: []
|
61
101
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.8.
|
102
|
+
rubygems_version: 1.8.18
|
63
103
|
signing_key:
|
64
104
|
specification_version: 3
|
65
105
|
summary: Turn off rails assets log.
|
66
|
-
test_files:
|
106
|
+
test_files:
|
107
|
+
- test/test_quiet_assets.rb
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/lib/quiet_assets/version.rb
DELETED