harukizaemon-acts_as_teapot 1.0.1
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.
- data/CHANGELOG.rdoc +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +20 -0
- data/acts_as_teapot.gemspec +22 -0
- data/lib/acts_as_teapot/action_controller/abstract_request.rb +10 -0
- data/lib/acts_as_teapot/action_controller/routing.rb +9 -0
- data/lib/acts_as_teapot/action_controller/status_codes.rb +10 -0
- data/lib/acts_as_teapot/application_controller.rb +12 -0
- data/lib/acts_as_teapot.rb +5 -0
- metadata +63 -0
data/CHANGELOG.rdoc
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Acts As Teapot
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
= Acts As Teapot
|
2
|
+
|
3
|
+
Acts As Teapot is a Ruby on Rails plugin that ensures your Ruby on Rails applications conform to RFC2324. Our assumption
|
4
|
+
here is that your application is not a coffee pot and does not understand the Hyper Text Coffee Pot Control Protocol
|
5
|
+
(HTCPCP/1.0). Thus, if ever a BREW request or any other request with the Content-Type set to
|
6
|
+
"application/coffee-pot-command" is received, the server will respond with 418 I’m a teapot.
|
7
|
+
|
8
|
+
== Installation
|
9
|
+
|
10
|
+
You have two choices for installation. The first uses a gem (recommended):
|
11
|
+
|
12
|
+
config.gem "harukizaemon-acts_as_teapot", :lib => "acts_as_teapot", :source => "http://gems.github.com"
|
13
|
+
|
14
|
+
Or you can use the Rails plugin
|
15
|
+
|
16
|
+
$ ruby script/plugin install git://github.com/harukizaemon/acts_as_teapot.git
|
17
|
+
|
18
|
+
=== License
|
19
|
+
|
20
|
+
This plugin is copyright 2009 by Simon Harris and is released under the MIT license.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "acts_as_teapot"
|
3
|
+
s.version = "1.0.1"
|
4
|
+
s.date = "2009-01-11"
|
5
|
+
s.summary = "Ensure your Ruby on Rails applications conform to RFC2324."
|
6
|
+
s.email = "simon.harris@cogentconsulting.com.au"
|
7
|
+
s.homepage = "http://github.com/harukizaemon/acts_as_teapot"
|
8
|
+
s.description = "Ensure your Ruby on Rails applications conform to RFC2324."
|
9
|
+
s.has_rdoc = true
|
10
|
+
s.authors = ["Simon Harris"]
|
11
|
+
s.files = ["CHANGELOG.rdoc",
|
12
|
+
"MIT-LICENSE",
|
13
|
+
"README.rdoc",
|
14
|
+
"acts_as_teapot.gemspec",
|
15
|
+
"lib/acts_as_teapot.rb",
|
16
|
+
"lib/acts_as_teapot/application_controller.rb",
|
17
|
+
"lib/acts_as_teapot/action_controller/abstract_request.rb",
|
18
|
+
"lib/acts_as_teapot/action_controller/routing.rb",
|
19
|
+
"lib/acts_as_teapot/action_controller/status_codes.rb"]
|
20
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
21
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActsAsTeapot
|
2
|
+
module ApplicationController
|
3
|
+
def self.included(base)
|
4
|
+
base.prepend_before_filter :rfc2324_check
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
def rfc2324_check
|
9
|
+
head(:im_a_teapot) if request.method == :brew || (request.content_type && request.content_type == Mime::HTCPCP)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
ApplicationController.send(:include, ApplicationController::Base)
|
2
|
+
ActionController::AbstractRequest.send(:include, ActsAsTeapot::ActionController::AbstractRequest)
|
3
|
+
ActionController::Routing.send(:include, ActsAsTeapot::ActionController::Routing)
|
4
|
+
ActionController::StatusCodes.send(:include, ActsAsTeapot::ActionController::StatusCodes)
|
5
|
+
Mime::Type.register("application/coffee-pot-command", :htcpcp)
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: harukizaemon-acts_as_teapot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Harris
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-11 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Ensure your Ruby on Rails applications conform to RFC2324.
|
17
|
+
email: simon.harris@cogentconsulting.com.au
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- CHANGELOG.rdoc
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- CHANGELOG.rdoc
|
27
|
+
- MIT-LICENSE
|
28
|
+
- README.rdoc
|
29
|
+
- acts_as_teapot.gemspec
|
30
|
+
- lib/acts_as_teapot.rb
|
31
|
+
- lib/acts_as_teapot/application_controller.rb
|
32
|
+
- lib/acts_as_teapot/action_controller/abstract_request.rb
|
33
|
+
- lib/acts_as_teapot/action_controller/routing.rb
|
34
|
+
- lib/acts_as_teapot/action_controller/status_codes.rb
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/harukizaemon/acts_as_teapot
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --main
|
40
|
+
- README.rdoc
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: "0"
|
48
|
+
version:
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: "0"
|
54
|
+
version:
|
55
|
+
requirements: []
|
56
|
+
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 1.2.0
|
59
|
+
signing_key:
|
60
|
+
specification_version: 2
|
61
|
+
summary: Ensure your Ruby on Rails applications conform to RFC2324.
|
62
|
+
test_files: []
|
63
|
+
|