quiet_assets 1.0.3 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e44be74dccbd0d599faeb9b311e2d885dc2163ca
4
- data.tar.gz: 0215c97043b1873b08decd328aadd88f90118e71
3
+ metadata.gz: e0158767be04a157b37fd57a27f30b4f932ac4cc
4
+ data.tar.gz: 1fd75da999cb4fb428600cfd3c1dcbd1b8ff1231
5
5
  SHA512:
6
- metadata.gz: 267186f8e3efebee49e416d496e4a28fec1f1825fa10f2846555755283c9d946d70be5c082167a4afe4ba1ed1c14cb59f8a4375e5ba69814063780f612839bc6
7
- data.tar.gz: d743dd75ab70996be06e22c1b51bd91a3c6be8261d3917597c4030978855b40c3a5f2d95a64f139698df996b1a93e1c8fac4b3eaae54c1ce0fff630d40c2f99c
6
+ metadata.gz: 2fddf17594e8664ae46f5eb1a5d3e42530f44a59b3ce0be00ce79c16440f8b4f7793dabc9e352c308ff7e262882955e959efa0d3b74ad6636ae267724cc8aee2
7
+ data.tar.gz: bb20619792f4d898593186477c535acf24d6ce1dc3bee50706f4403c5f5f45c8f28d3ab69bdf1e58f07c6dd93a315e9a26a54ae7601b21b02c74eeb4e4c925b0
data/README.md CHANGED
@@ -26,6 +26,11 @@ place the following in your `config/application.rb` file:
26
26
 
27
27
  config.quiet_assets = false
28
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
+
29
34
  ## License
30
35
 
31
36
  Dual licensed under the MIT or GPL licenses:
@@ -4,11 +4,15 @@ module QuietAssets
4
4
  class Engine < ::Rails::Engine
5
5
  # Set as true but user can override it
6
6
  config.quiet_assets = true
7
+ config.quiet_assets_paths = []
7
8
 
8
9
  initializer 'quiet_assets', :after => 'sprockets.environment' do |app|
9
10
  next unless app.config.quiet_assets
10
11
  # Parse PATH_INFO by assets prefix
11
- ASSETS_PREFIX = %r[\A/{0,2}#{app.config.assets.prefix}]
12
+ paths = [ %r[\A/{0,2}#{app.config.assets.prefix}] ]
13
+ # Add additional paths
14
+ paths += [*config.quiet_assets_paths]
15
+ ASSETS_REGEX = /\A(#{paths.join('|')})/
12
16
  KEY = 'quiet_assets.old_level'
13
17
  app.config.assets.logger = false
14
18
 
@@ -16,7 +20,7 @@ module QuietAssets
16
20
  Rails::Rack::Logger.class_eval do
17
21
  def call_with_quiet_assets(env)
18
22
  begin
19
- if env['PATH_INFO'] =~ ASSETS_PREFIX
23
+ if env['PATH_INFO'] =~ ASSETS_REGEX
20
24
  env[KEY] = Rails.logger.level
21
25
  Rails.logger.level = Logger::ERROR
22
26
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'quiet_assets'
3
- gem.version = '1.0.3'
3
+ gem.version = '1.1.0'
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'
@@ -34,6 +34,7 @@ class HelperTest < Test::Unit::TestCase
34
34
  routes {
35
35
  root :to => 'home#index'
36
36
  get 'assets/picture' => 'home#index'
37
+ get 'quiet/this' => 'home#index'
37
38
  }
38
39
  end
39
40
  end
@@ -115,4 +116,37 @@ class HelperTest < Test::Unit::TestCase
115
116
 
116
117
  assert_equal '', output.string
117
118
  end
119
+
120
+ def test_quiet_url
121
+ initialize!
122
+
123
+ app.call request('/quiet/this')
124
+
125
+ assert_match(/Started GET \"\/quiet\/this\" for at/, output.string)
126
+ end
127
+
128
+ def test_quiet_url_with_paths_option_as_string_equality
129
+ initialize! { config.quiet_assets_paths = '/quiet/' }
130
+
131
+ app.call request('/quiet/this')
132
+
133
+ assert_equal '', output.string
134
+ end
135
+
136
+ def test_quiet_url_with_paths_option_as_string_appending
137
+ initialize! { config.quiet_assets_paths << '/quiet/' }
138
+
139
+ app.call request('/quiet/this')
140
+
141
+ assert_equal '', output.string
142
+ end
143
+
144
+ def test_quiet_url_with_paths_option_as_array
145
+ initialize! { config.quiet_assets_paths += ['/quiet/'] }
146
+
147
+ app.call request('/quiet/this')
148
+
149
+ assert_equal '', output.string
150
+ end
151
+
118
152
  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.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Karpunin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-19 00:00:00.000000000 Z
12
+ date: 2014-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties