rails-futurizer 1.0.0

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: 277ed0db943b5cb95f08c9441ca55db45a223cc3
4
+ data.tar.gz: 5e1f297e00b4976968f12d234906076aea95b177
5
+ SHA512:
6
+ metadata.gz: 2cb0b9105459eae395db0a24e0baa9df2edee9e8e71eea3bf3743d05599a4a2cf0fcbd7458822a12f0b5e334b8866ec29b07239775ceefcafb4c7bb54fc7c41b
7
+ data.tar.gz: 97753285dde6d7c0c4144bc20bd79ff99f8f0be7eb1da6003ada649639696ef1acca624d580e139180541f41481655f67bfd497b247d41b9bde5346b416d78a5
data/History.md ADDED
@@ -0,0 +1,4 @@
1
+ ### Version 1.0.0
2
+ 2014-3-8
3
+
4
+ * Patch filter_parameters in Rails 2 to work correctly with Ruby 2.
data/License.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Brian Auton
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,34 @@
1
+ ## rails-futurizer
2
+ [![Gem Version](https://badge.fury.io/rb/rails-futurizer.png)](http://badge.fury.io/rb/rails-futurizer)
3
+ [![Build Status](https://travis-ci.org/brianauton/rails-futurizer.png?branch=master)](https://travis-ci.org/brianauton/rails-futurizer)
4
+ [![Code Climate](https://codeclimate.com/github/brianauton/rails-futurizer.png)](https://codeclimate.com/github/brianauton/rails-futurizer)
5
+
6
+ Drag your legacy Rails apps into the future a little less painfully.
7
+
8
+ ### Requirements
9
+
10
+ * Ruby 1.8.7 or greater
11
+
12
+ * RubyGems v1.1.0 or greater
13
+
14
+ * Nothing else, although rails-futurizer won't do anything unless
15
+ it's installed alongside a version of Rails for which some
16
+ applicable fixes are available.
17
+
18
+ ### Getting Started
19
+
20
+ Install the rails-futurizer gem alongside rspec in your gemfile.
21
+
22
+ gem "rails-futurizer"
23
+
24
+ That's it! Any applicable fixes will be activated automatically, and
25
+ any that aren't applicable because of your current version of Rails,
26
+ Ruby, etc. will be ignored.
27
+
28
+ ### Fixes Included
29
+
30
+ * When using Rails 2.3 or older with Ruby 2.0 or newer,
31
+ ActionController's filter_parameters behavior will silently fail
32
+ and output all parameters to the log regardless of filtering
33
+ options selected. Rails-futurizer will automatically patch this
34
+ bug if you're using Rails 2.2.1 or newer.
@@ -0,0 +1,15 @@
1
+ if Futurizer.detected? :actionpack => [">= 2.2.1", "< 3"], :ruby => ">= 2"
2
+ Futurizer.require_dependency "action_controller"
3
+
4
+ module ActionController
5
+ class Base
6
+ private
7
+
8
+ def log_processing_for_parameters
9
+ parameters = respond_to?(:filter_parameters, true) ? filter_parameters(params) : params.dup
10
+ parameters = parameters.except!(:controller, :action, :format, :_method)
11
+ logger.info " Parameters: #{parameters.inspect}" unless parameters.empty?
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Futurizer
2
+ module SystemInfo
3
+ def self.version_requirement(specifiers)
4
+ Gem::Requirement.new(*specifiers)
5
+ end
6
+
7
+ def self.gem_version(gem_name)
8
+ return Gem.loaded_specs[gem_name.to_s].version if Gem.loaded_specs[gem_name.to_s]
9
+ end
10
+
11
+ def self.ruby_version
12
+ Gem.ruby_version
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module Futurizer
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,18 @@
1
+ require "futurizer/system_info"
2
+
3
+ module Futurizer
4
+ module VersionDetection
5
+ def self.detected?(specifiers)
6
+ specifiers.all?{ |resource, specifier| resource_detected? resource, specifier }
7
+ end
8
+
9
+ def self.resource_detected?(resource, specifiers)
10
+ version = current_version(resource)
11
+ version && SystemInfo.version_requirement(specifiers).satisfied_by?(version)
12
+ end
13
+
14
+ def self.current_version(resource)
15
+ resource == :ruby ? SystemInfo.ruby_version : SystemInfo.gem_version(resource)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ require "futurizer/version_detection"
2
+
3
+ module Futurizer
4
+ def self.detected?(*args)
5
+ VersionDetection.detected?(*args)
6
+ end
7
+
8
+ def self.apply_patches
9
+ require "futurizer/patches/actionpack/filter_parameters.rb"
10
+ end
11
+
12
+ def self.require_dependency file
13
+ require file
14
+ end
15
+ end
16
+
17
+ Futurizer.apply_patches
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ require "rails-futurizer"
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-futurizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Auton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-08 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'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0.beta2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0.beta2
55
+ description:
56
+ email:
57
+ - brianauton@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - History.md
63
+ - License.txt
64
+ - README.md
65
+ - lib/futurizer/patches/actionpack/filter_parameters.rb
66
+ - lib/futurizer/system_info.rb
67
+ - lib/futurizer/version.rb
68
+ - lib/futurizer/version_detection.rb
69
+ - lib/rails-futurizer.rb
70
+ - rails/init.rb
71
+ homepage: http://github.com/brianauton/rails-futurizer
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 1.8.7
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.1.0
89
+ requirements: []
90
+ rubyforge_project:
91
+ rubygems_version: 2.2.2
92
+ signing_key:
93
+ specification_version: 4
94
+ summary: Drag your legacy Rails apps into the future a little less painfully.
95
+ test_files: []