get_head 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
+ SHA1:
3
+ metadata.gz: d85efa13ef4c1dbe2902c84739e9a9dfa86db074
4
+ data.tar.gz: 09ddbdb8afca63acae150a582c90b827af069414
5
+ SHA512:
6
+ metadata.gz: 7ab5310920c79bf91e2ae243d351ecaa335dab589c57dd4f0d09d0c197b7b3cfad268aa0c50ac86fbebd0889c3bf6e1f19ff13f169c7ee63fb26692f7a5332d2
7
+ data.tar.gz: 919b1dec1ef20e7108873fe8ee4d9aa9c2811d0c34c63d70304e57aaeb1988ce206187cc6539e94747a93400f144f4031614e22b729e39048ee6b045024ff27c
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in get_head.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Sergii Paryzhskyi
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.
@@ -0,0 +1,28 @@
1
+ # GetHead
2
+
3
+ Middleware that helps you to distinguish between HEAD and GET requests. At the moment Rails treats these two requests equally in production mode when you have perform_caching option in environment.rb set to true. By using get_head gem you will be able to check which request is performing at the moment by simply doing `request.head?` in your code.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'get_head'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install get_head
21
+
22
+ ## Usage
23
+
24
+ This middleware will be automatically used by your Rails application. In order to delete it in certain environment, you can add this line to enviroment file(i.e. production.rb) :
25
+
26
+ ```ruby
27
+ config.middleware.delete GetHead::Request
28
+ ```
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'get_head/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "get_head"
8
+ spec.version = GetHead::VERSION
9
+ spec.authors = ["HeeL"]
10
+ spec.email = ["parizhskiy@gmail.com"]
11
+ spec.summary = %q{Middleware that helps you to distinguish between HEAD and GET requests.}
12
+ spec.description = %q{Middleware that helps you to distinguish between HEAD and GET requests.
13
+ At the moment Rails treats these two requests equally in production mode
14
+ when you have perform_caching option in environment.rb set to true.}
15
+ spec.homepage = "https://github.com/HeeL/get_head"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,9 @@
1
+ require "get_head/version"
2
+ require "get_head/request"
3
+ require 'rails'
4
+
5
+ module GetHead
6
+ class Engine < Rails::Engine
7
+ config.app_middleware.insert_before 0, GetHead::Request
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module GetHead
2
+ class Request
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ env['rack.methodoverride.original_method'] = env['REQUEST_METHOD']
9
+ @app.call(env)
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module GetHead
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: get_head
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - HeeL
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: |-
42
+ Middleware that helps you to distinguish between HEAD and GET requests.
43
+ At the moment Rails treats these two requests equally in production mode
44
+ when you have perform_caching option in environment.rb set to true.
45
+ email:
46
+ - parizhskiy@gmail.com
47
+ executables: []
48
+ extensions: []
49
+ extra_rdoc_files: []
50
+ files:
51
+ - .gitignore
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - get_head.gemspec
57
+ - lib/get_head.rb
58
+ - lib/get_head/request.rb
59
+ - lib/get_head/version.rb
60
+ homepage: https://github.com/HeeL/get_head
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.4.5
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Middleware that helps you to distinguish between HEAD and GET requests.
84
+ test_files: []