sinatra-silent 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 46b42fa133be333fc5abd76f768716082a4b511ac10f5db4459cf2998f7f8a0d
4
+ data.tar.gz: 3f43f1ebbdac7e6bc3f22c8eae579936d4f73d32adc62a4fcc0c77dc14a222b4
5
+ SHA512:
6
+ metadata.gz: 832eb438ecbc51688368e27caf6752fb11569a39c39943bda55828bf4d4775c418113a69fb07c1ffa06bf34e7b3a14515e6aad99e6a294866ba788782f116bce
7
+ data.tar.gz: e84a56c735c1ade838af1d4eba451b47482cbee74e3450de4e5545c6766f3c95a6a1d6bea02cc32bd163871b73bb186c3ca6a5e9925667aa75969e0f94a8c34c
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1 @@
1
+ sinatra-silent
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.16.3
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in sinatra-silent.gemspec
6
+ gemspec
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sinatra-silent (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ kommando (0.1.2)
11
+ mustermann (1.0.3)
12
+ parallel (1.12.1)
13
+ parallel_tests (2.22.0)
14
+ parallel
15
+ rack (2.0.5)
16
+ rack-protection (2.0.3)
17
+ rack
18
+ rake (10.5.0)
19
+ rspec (3.8.0)
20
+ rspec-core (~> 3.8.0)
21
+ rspec-expectations (~> 3.8.0)
22
+ rspec-mocks (~> 3.8.0)
23
+ rspec-core (3.8.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-expectations (3.8.1)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.8.0)
28
+ rspec-mocks (3.8.0)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.8.0)
31
+ rspec-support (3.8.0)
32
+ sinatra (2.0.3)
33
+ mustermann (~> 1.0)
34
+ rack (~> 2.0)
35
+ rack-protection (= 2.0.3)
36
+ tilt (~> 2.0)
37
+ tilt (2.0.8)
38
+
39
+ PLATFORMS
40
+ ruby
41
+
42
+ DEPENDENCIES
43
+ bundler (~> 1.16)
44
+ kommando
45
+ parallel_tests
46
+ rake (~> 10.0)
47
+ rspec (~> 3.0)
48
+ sinatra (~> 2)
49
+ sinatra-silent!
50
+
51
+ BUNDLED WITH
52
+ 1.16.3
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Matti Paksula
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ # sinatra-silent
2
+
3
+ Silences Sinatra
4
+
5
+ set :silent_sinatra, true
6
+ set :silent_webrick, true
7
+ set :silent_access_log, true
8
+
9
+ # or
10
+
11
+ set :silent_all, true
12
+
13
+ ## development
14
+
15
+ rake
16
+ rake parallel:spec
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ require "parallel_tests/tasks"
5
+ require "kommando"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task default: ["parallel:spec", :e2e]
10
+
11
+ task :e2e do
12
+ k = Kommando.run "ruby e2e/all.rb", output: true
13
+ raise "not clean" unless k.code == 0
14
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sinatra/base"
5
+ require "sinatra/silent"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,13 @@
1
+ require "kommando"
2
+
3
+ k = Kommando.new "ruby e2e/tests/webrick_done.rb", output: true
4
+ got_it = false
5
+ k.out.once "WEBrick::HTTPServer#start done" do
6
+ got_it = true
7
+ end
8
+ k.run
9
+
10
+ raise "webrick done missing" unless got_it
11
+
12
+ puts ""
13
+ puts "OK"
@@ -0,0 +1,15 @@
1
+ require "sinatra/base"
2
+ require_relative "../../lib/sinatra/silent"
3
+ require_relative "../../spec/helper_methods"
4
+
5
+ subject = create_sinatra
6
+ subject.set :silent_webrick, true
7
+ run_async_and_wait(subject)
8
+
9
+ subject.stop!
10
+
11
+ subject.set :silent_webrick, false
12
+ run_async_and_wait(subject)
13
+
14
+ subject.stop!
15
+ sleep 0.25 # wait for flush
@@ -0,0 +1,67 @@
1
+ require_relative "silent/version"
2
+
3
+ module Sinatra
4
+ module Silent
5
+ class SilentLogger
6
+ def method_missing(m, *args, &block)
7
+ end
8
+ end
9
+
10
+ module ClassMethods
11
+ def set(option, value = (not_set = true), ignore_setter = false, &block)
12
+ return if option == {}
13
+
14
+ case option
15
+ when :silent_all
16
+ set :silent_sinatra, true
17
+ set :silent_webrick, true
18
+ set :silent_access_log, true
19
+ when :silent_access_log
20
+ new_server_settings = if value == true
21
+ existing_server_settings.merge(AccessLog: [])
22
+ else
23
+ existing_server_settings.tap { |hash| hash.delete(:AccessLog) }
24
+ end
25
+
26
+ super :server_settings, new_server_settings
27
+ when :silent_sinatra
28
+ case value
29
+ when true
30
+ self.define_singleton_method :suppress_messages? do
31
+ return true
32
+ end
33
+ when false
34
+ self.define_singleton_method :suppress_messages? do
35
+ handler_name =~ /cgi/i || quiet
36
+ end
37
+ end
38
+ when :silent_webrick
39
+ new_server_settings = if value == true
40
+ existing_server_settings.merge(Logger: SilentLogger.new)
41
+ else
42
+ existing_server_settings.tap { |hash| hash.delete(:Logger) }
43
+ end
44
+
45
+ super :server_settings, new_server_settings
46
+ else
47
+ super option, value, ignore_setter, &block
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def existing_server_settings
54
+ return {} unless self.settings.respond_to? :server_settings
55
+ self.settings.server_settings
56
+ end
57
+ end
58
+
59
+ def self.prepended(base)
60
+ class << base
61
+ prepend ClassMethods
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ Sinatra::Base.prepend Sinatra::Silent
@@ -0,0 +1,5 @@
1
+ module Sinatra
2
+ module Silent
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,32 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "sinatra/silent/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sinatra-silent"
8
+ spec.version = Sinatra::Silent::VERSION
9
+ spec.authors = ["Matti Paksula"]
10
+ spec.email = ["matti.paksula@iki.fi"]
11
+
12
+ spec.summary = %q{Silence Sinatra output}
13
+ spec.homepage = "https://github.com/matti/sinatra-silent"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_development_dependency "sinatra", "~> 2"
26
+ spec.add_development_dependency "parallel_tests"
27
+ spec.add_development_dependency "kommando"
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.16"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "rspec", "~> 3.0"
32
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-silent
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Matti Paksula
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: parallel_tests
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: kommando
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description:
98
+ email:
99
+ - matti.paksula@iki.fi
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".ruby-gemset"
107
+ - ".ruby-version"
108
+ - ".travis.yml"
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - e2e/all.rb
117
+ - e2e/tests/webrick_done.rb
118
+ - lib/sinatra/silent.rb
119
+ - lib/sinatra/silent/version.rb
120
+ - sinatra-silent.gemspec
121
+ homepage: https://github.com/matti/sinatra-silent
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.7.6
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Silence Sinatra output
145
+ test_files: []