shhhhh 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 72ad6409327b05a110147876fc2931442bd27b9a
4
+ data.tar.gz: 091f213d91520f2bcabd44d632debbcbbb2fc4e6
5
+ SHA512:
6
+ metadata.gz: fc275ee60f38a157955b23d4f4f66c7d928ec2be507fad4c71232e36b9c1aa267178b3ac685811048c75859c58b9961f6ab2ddf737295b334602bef1d68d6121
7
+ data.tar.gz: 33ca60b5353f8b19bd5320e4ea0e1a6b2bd1ae4f79ed8f9481cd33276cbf51e5516efe95085bbacd7439d7a9e87d46f5ac15fb0b2306ab519b5c6461458baa30
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
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ log/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ shhhhh
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Curtis Edmond
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Shhhhh
2
+
3
+ Keep the asset logging out of your dev logs
4
+
5
+ ## Installation
6
+
7
+ Add this line to the development group in your application's Gemfile:
8
+
9
+ gem 'shhhhh'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install shhhhh
18
+
19
+ ## Usage
20
+
21
+ install the gem and that's really it currently
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/tehcurtis/shhhhh/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/lib/shhhhh.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'shhhhh/middleware'
2
+
3
+ module Shhhhh
4
+ class AnEngine < Rails::Engine
5
+ initializer 'shhhhh.middleware' do |app|
6
+ app.middleware.swap Rails::Rack::Logger, Shhhhh::Middleware
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module Shhhhh
2
+ class Middleware < Rails::Rack::Logger
3
+ protected
4
+
5
+ def call_app(request, env)
6
+ # if the path looks like /assets/some/script.js, don't bother logging
7
+ if env['PATH_INFO'] =~ /\A\/assets\//
8
+ @app.call(env)
9
+ else
10
+ super
11
+ end
12
+
13
+ ensure
14
+ ActiveSupport::LogSubscriber.flush_all!
15
+ end
16
+ end
17
+ end
data/shhhhh.gemspec ADDED
@@ -0,0 +1,18 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'shhhhh'
3
+ s.version = '0.0.1'
4
+ s.date = '2010-04-28'
5
+ s.summary = "shhhhh"
6
+ s.description = "Quiet your logs"
7
+ s.authors = ["Curtis Edmond"]
8
+ s.email = 'curtis.edmond@gmail.com'
9
+ s.files = `git ls-files -z`.split("\x0")
10
+ s.test_files = %w(spec/lib/middleware_spec.rb)
11
+ s.homepage = 'http://rubygems.org/gems/shhhhh'
12
+ s.license = 'MIT'
13
+
14
+ s.add_dependency 'railties', '>= 3.2.19', '< 5.0'
15
+ s.add_development_dependency 'rake', '10.3.2'
16
+ s.add_development_dependency 'tzinfo', '1.2.1'
17
+ s.add_development_dependency 'rspec', '3.0.0'
18
+ end
@@ -0,0 +1,51 @@
1
+ require 'rubygems'
2
+
3
+ require 'rails'
4
+ require 'rails/all'
5
+
6
+ require 'shhhhh'
7
+
8
+ class HomeController < ActionController::Base
9
+ def index
10
+ render :text => 'Hi there!'
11
+ end
12
+ end
13
+
14
+ def request(uri)
15
+ Rack::MockRequest.env_for(uri)
16
+ end
17
+
18
+ RSpec.describe Shhhhh::Middleware do
19
+ before do
20
+ @output = StringIO.new
21
+ @app = Class.new(Rails::Application)
22
+ @app.configure do
23
+
24
+ config.active_support.deprecation = :notify
25
+ config.secret_token = '1'*32
26
+ config.eager_load = false
27
+
28
+ routes {
29
+ root :to => 'home#index'
30
+ get 'assets/picture' => 'home#index'
31
+ }
32
+ end
33
+
34
+ @app.initialize!
35
+ Rails.logger = Logger.new(@output)
36
+ Rails.logger.formatter = lambda { |s, d, p, m| "#{m}\n" }
37
+ @app
38
+ end
39
+
40
+ it do
41
+ @app.call request('/assets/picture')
42
+
43
+ expect(@output.string).to eq ''
44
+ end
45
+
46
+ it do
47
+ @app.call request('/')
48
+
49
+ expect(@output.string).to include 'Started GET'
50
+ end
51
+ end
@@ -0,0 +1,78 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # The settings below are suggested to provide a good initial experience
19
+ # with RSpec, but feel free to customize to your heart's content.
20
+ =begin
21
+ # These two settings work together to allow you to limit a spec run
22
+ # to individual examples or groups you care about by tagging them with
23
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
24
+ # get run.
25
+ config.filter_run :focus
26
+ config.run_all_when_everything_filtered = true
27
+
28
+ # Many RSpec users commonly either run the entire suite or an individual
29
+ # file, and it's useful to allow more verbose output when running an
30
+ # individual spec file.
31
+ if config.files_to_run.one?
32
+ # Use the documentation formatter for detailed output,
33
+ # unless a formatter has already been configured
34
+ # (e.g. via a command-line flag).
35
+ config.default_formatter = 'doc'
36
+ end
37
+
38
+ # Print the 10 slowest examples and example groups at the
39
+ # end of the spec run, to help surface which specs are running
40
+ # particularly slow.
41
+ config.profile_examples = 10
42
+
43
+ # Run specs in random order to surface order dependencies. If you find an
44
+ # order dependency and want to debug it, you can fix the order by providing
45
+ # the seed, which is printed after each run.
46
+ # --seed 1234
47
+ config.order = :random
48
+
49
+ # Seed global randomization in this process using the `--seed` CLI option.
50
+ # Setting this allows you to use `--seed` to deterministically reproduce
51
+ # test failures related to randomization by passing the same `--seed` value
52
+ # as the one that triggered the failure.
53
+ Kernel.srand config.seed
54
+
55
+ # rspec-expectations config goes here. You can use an alternate
56
+ # assertion/expectation library such as wrong or the stdlib/minitest
57
+ # assertions if you prefer.
58
+ config.expect_with :rspec do |expectations|
59
+ # Enable only the newer, non-monkey-patching expect syntax.
60
+ # For more details, see:
61
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
+ expectations.syntax = :expect
63
+ end
64
+
65
+ # rspec-mocks config goes here. You can use an alternate test double
66
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
67
+ config.mock_with :rspec do |mocks|
68
+ # Enable only the newer, non-monkey-patching expect syntax.
69
+ # For more details, see:
70
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71
+ mocks.syntax = :expect
72
+
73
+ # Prevents you from mocking or stubbing a method that does not exist on
74
+ # a real object. This is generally recommended.
75
+ mocks.verify_partial_doubles = true
76
+ end
77
+ =end
78
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shhhhh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Curtis Edmond
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2010-04-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.19
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.19
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: rake
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '='
38
+ - !ruby/object:Gem::Version
39
+ version: 10.3.2
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 10.3.2
47
+ - !ruby/object:Gem::Dependency
48
+ name: tzinfo
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.2.1
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '='
59
+ - !ruby/object:Gem::Version
60
+ version: 1.2.1
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - '='
66
+ - !ruby/object:Gem::Version
67
+ version: 3.0.0
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '='
73
+ - !ruby/object:Gem::Version
74
+ version: 3.0.0
75
+ description: Quiet your logs
76
+ email: curtis.edmond@gmail.com
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - ".gitignore"
82
+ - ".rspec"
83
+ - ".ruby-gemset"
84
+ - ".ruby-version"
85
+ - Gemfile
86
+ - LICENSE.txt
87
+ - README.md
88
+ - lib/shhhhh.rb
89
+ - lib/shhhhh/middleware.rb
90
+ - shhhhh.gemspec
91
+ - spec/lib/middleware_spec.rb
92
+ - spec/spec_helper.rb
93
+ homepage: http://rubygems.org/gems/shhhhh
94
+ licenses:
95
+ - MIT
96
+ metadata: {}
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ requirements: []
112
+ rubyforge_project:
113
+ rubygems_version: 2.2.2
114
+ signing_key:
115
+ specification_version: 4
116
+ summary: shhhhh
117
+ test_files:
118
+ - spec/lib/middleware_spec.rb