rack-honoured_deceased 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +81 -0
- data/Rakefile +7 -0
- data/lib/rack/honoured_deceased/version.rb +5 -0
- data/lib/rack/honoured_deceased.rb +19 -0
- data/rack-honoured_deceased.gemspec +27 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a8248b653c0be63a472c674fec60dd2c16131eff
|
4
|
+
data.tar.gz: 45a685615dda51632226b9f2813940fc99efdedd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 53af12e7da5e13d0f352131b6cd8e62ecae35dddb98d1c87824fab663ef6fc626ad4b6004a6cefe60876b308c4e0e3dd72a1cc042dc39569a715ccd9457eda6e
|
7
|
+
data.tar.gz: 7275ea826c8f6f85afa1105cc647506512327f77027231aed8ed9af6aabc29b325c8a28961119fbd333d438abafa8240678b1edf78ec7ef7e9047788aa7b36d2
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Rob
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Rack::HonouredDeceased
|
2
|
+
|
3
|
+
A simple gem to include X-Clacks-Overhead headers for those lost but not forgotten into any rack (rails, sinatra, etc) application.
|
4
|
+
|
5
|
+
Inspired by [this thread](http://redd.it/2yt9j6) on reddit.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rack-honoured_deceased'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rack-honoured_deceased
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Stand Alone Rack App
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# config.ru
|
29
|
+
require 'rack'
|
30
|
+
require 'rack/honoured_deceased'
|
31
|
+
|
32
|
+
use Rack::HonouredDeceased, ["Terry Pratchett"]
|
33
|
+
app = proc do |env|
|
34
|
+
[ 200, {'Content-Type' => 'text/plain'}, ["Your webapp"] ]
|
35
|
+
end
|
36
|
+
```
|
37
|
+
Then run
|
38
|
+
`rackup`
|
39
|
+
|
40
|
+
### Sinatra
|
41
|
+
```ruby
|
42
|
+
require 'sinatra'
|
43
|
+
require 'rack/honoured_deceased'
|
44
|
+
|
45
|
+
use Rack::HonouredDeceased, ["Terry Pratchett"]
|
46
|
+
|
47
|
+
get '/' do
|
48
|
+
'Your webapp'
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
### Rails
|
53
|
+
```ruby
|
54
|
+
# Add it to your Gemfile
|
55
|
+
gem 'rack-honoured_deceased'
|
56
|
+
```
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
# In config/application.rb
|
60
|
+
config.middleware.use Rack::HonouredDeceased, ["Terry Pratchett"]
|
61
|
+
```
|
62
|
+
or
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
# In config.ru
|
66
|
+
use Rack::HonouredDeceased, ["Terry Pratchett"]
|
67
|
+
```
|
68
|
+
## Testing
|
69
|
+
|
70
|
+
`rspec`
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
|
74
|
+
1. Fork it ( https://github.com/jphastings/rack-honoured_deceased/fork )
|
75
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
76
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
77
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
78
|
+
5. Create a new Pull Request
|
79
|
+
|
80
|
+
|
81
|
+
GNU Terry Pratchett
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Rack
|
2
|
+
class HonouredDeceased
|
3
|
+
HEADER_KEY = 'X-Clacks-Overhead'.freeze
|
4
|
+
|
5
|
+
# @param [#call] app A rack application
|
6
|
+
# @param [Array<String>,String] honoured_deceased A name or array of names of names you'd like in the clacks overhead
|
7
|
+
def initialize(app, honoured_deceased = [])
|
8
|
+
@app = app
|
9
|
+
names = [*honoured_deceased].compact
|
10
|
+
@overhead = names.map { |name| "GNU #{name}" }.freeze if names.any?
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
result = @app.call(env)
|
15
|
+
result[1][HEADER_KEY] = @overhead.shuffle if @overhead
|
16
|
+
result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rack/honoured_deceased/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rack-honoured_deceased"
|
8
|
+
spec.version = Rack::HonouredDeceased::VERSION
|
9
|
+
spec.authors = ["Rob", "JP"]
|
10
|
+
spec.email = ["root@sphericalcube.net", "jp@byjp.me"]
|
11
|
+
|
12
|
+
spec.summary = %q{Honour those lost but not forgotten in your rack middleware. GNU Terry Pratchett.}
|
13
|
+
spec.description = %q{Includes the X-Clacks-Overhead header inside your rack application. http://redd.it/2yt9j6}
|
14
|
+
spec.homepage = "https://github.com/jphastings/rack-honoured_deceased"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.8'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
25
|
+
spec.add_development_dependency 'rspec-its', '~> 1.2'
|
26
|
+
spec.add_development_dependency 'rack', '~> 1.6'
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-honoured_deceased
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rob
|
8
|
+
- JP
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.8'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.8'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '10.0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '10.0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '3.3'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '3.3'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec-its
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.2'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rack
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.6'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.6'
|
84
|
+
description: Includes the X-Clacks-Overhead header inside your rack application. http://redd.it/2yt9j6
|
85
|
+
email:
|
86
|
+
- root@sphericalcube.net
|
87
|
+
- jp@byjp.me
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".rspec"
|
94
|
+
- ".travis.yml"
|
95
|
+
- Gemfile
|
96
|
+
- LICENSE.txt
|
97
|
+
- README.md
|
98
|
+
- Rakefile
|
99
|
+
- lib/rack/honoured_deceased.rb
|
100
|
+
- lib/rack/honoured_deceased/version.rb
|
101
|
+
- rack-honoured_deceased.gemspec
|
102
|
+
homepage: https://github.com/jphastings/rack-honoured_deceased
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.4.5
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: Honour those lost but not forgotten in your rack middleware. GNU Terry Pratchett.
|
126
|
+
test_files: []
|