utf8_enforcer_workaround 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -8
- data/Appraisals +0 -8
- data/README.md +19 -3
- data/features/compliant_browser.feature +8 -1
- data/features/support/rails.rb +3 -3
- data/lib/utf8_enforcer_workaround/action_controller/base.rb +5 -8
- data/lib/utf8_enforcer_workaround/action_view/helpers/form_tag_helper.rb +2 -5
- data/lib/utf8_enforcer_workaround/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f591c62a4e63bc4f40ba41248f866c7175d8d331
|
4
|
+
data.tar.gz: 294d1bfe9df4a898a055aaba79869229874de341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74f17d0c3ec3742c112557ef00ac1c1e815fb04a316efcd7e3f07ea466548956ebe3cf100a357c4ed6f2395169e62557a737249056d58f46be225b9e24ffa296
|
7
|
+
data.tar.gz: 4e96fbdbab56875970093d25881260e90fa539648edb7aefc66fd5f36b26ec18841461843b4fa4a16d39a9e065290507f27557acf25ad2429a9d691f969fa3a4
|
data/.travis.yml
CHANGED
@@ -23,20 +23,12 @@ matrix:
|
|
23
23
|
gemfile: gemfiles/rails5.1.gemfile
|
24
24
|
- rvm: 1.9.3
|
25
25
|
gemfile: gemfiles/rails5.2.gemfile
|
26
|
-
- rvm: 1.9.3
|
27
|
-
gemfile: gemfiles/rails6.0.gemfile
|
28
26
|
- rvm: 2.1.10
|
29
27
|
gemfile: gemfiles/rails5.0.gemfile
|
30
28
|
- rvm: 2.1.10
|
31
29
|
gemfile: gemfiles/rails5.1.gemfile
|
32
30
|
- rvm: 2.1.10
|
33
31
|
gemfile: gemfiles/rails5.2.gemfile
|
34
|
-
- rvm: 2.1.10
|
35
|
-
gemfile: gemfiles/rails6.0.gemfile
|
36
|
-
- rvm: 2.2.10
|
37
|
-
gemfile: gemfiles/rails6.0.gemfile
|
38
|
-
- rvm: 2.3.8
|
39
|
-
gemfile: gemfiles/rails6.0.gemfile
|
40
32
|
- rvm: 2.4.9
|
41
33
|
gemfile: gemfiles/rails4.0.gemfile # https://github.com/rails/rails/issues/25125
|
42
34
|
- rvm: 2.4.9
|
data/Appraisals
CHANGED
@@ -50,11 +50,3 @@ appraise "rails5.2" do
|
|
50
50
|
gem 'rspec'
|
51
51
|
gem 'bootsnap', '~> 1.0', require: false
|
52
52
|
end
|
53
|
-
|
54
|
-
# appraise "rails6.0" do
|
55
|
-
# gem "rails", "~> 6.0.0"
|
56
|
-
# gem "sqlite3", '~> 1.4.0'
|
57
|
-
# gem 'capybara'
|
58
|
-
# gem 'rspec'
|
59
|
-
# gem 'bootsnap', '~> 1.0', require: false
|
60
|
-
# end
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
Utf8EnforcerWorkaround
|
2
2
|
======================
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/utf8_enforcer_workaround.svg)](https://badge.fury.io/rb/utf8_enforcer_workaround)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/softace/utf8_enforcer_workaround.png)](http://travis-ci.org/softace/utf8_enforcer_workaround)
|
5
5
|
[![Dependency Status](https://gemnasium.com/softace/utf8_enforcer_workaround.png)](https://gemnasium.com/softace/utf8_enforcer_workaround)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/softace/utf8_enforcer_workaround.png)](https://codeclimate.com/github/softace/utf8_enforcer_workaround)
|
7
7
|
|
8
|
-
|
9
|
-
browsers.
|
8
|
+
For Rails version < 6 Rails inserts a hidden form input element to make IE 8 and older use UTF8. This gem makes the utf8 enforcer element to be applied only for non-standards-complying browsers.
|
10
9
|
|
10
|
+
For Rails 6 the default behaviour does not bloat forms with IE8- specific issues, so this gem is no longer relevant for Rails 6 and forward.
|
11
11
|
|
12
12
|
Requirements
|
13
13
|
------------
|
@@ -20,6 +20,8 @@ Requirements
|
|
20
20
|
* Rails 4.x
|
21
21
|
* Rails 5.x
|
22
22
|
|
23
|
+
From Rails 6.0.0 the default behaviour is *not* to have a hidden tag to enforce utf8 for IE 8 or older, see (https://github.com/rails/rails/commit/96eeea538c9c5b7b60d6f8baed2e86a9e2a920c9). So this gem is not relevant for Rails 6 and upwards.
|
24
|
+
|
23
25
|
Installation
|
24
26
|
------------
|
25
27
|
|
@@ -61,6 +63,20 @@ bundle exec appraisal install
|
|
61
63
|
bundle exec appraisal rake
|
62
64
|
```
|
63
65
|
|
66
|
+
Releasing
|
67
|
+
---------
|
68
|
+
|
69
|
+
Update `lib/utf8_enforcer_workaround/version.rb` and commit.
|
70
|
+
Then
|
71
|
+
|
72
|
+
```
|
73
|
+
git tag v<version>
|
74
|
+
git tag push --tags
|
75
|
+
gem build utf8_enforcer_workaround.gemspec
|
76
|
+
gem push utf8_enforcer_workaround-<version>.gem
|
77
|
+
```
|
78
|
+
|
79
|
+
|
64
80
|
|
65
81
|
Contributing
|
66
82
|
------------
|
@@ -7,7 +7,14 @@ Feature: Default browsers does not see a utf8 param.
|
|
7
7
|
And I run a migration
|
8
8
|
|
9
9
|
Scenario:
|
10
|
-
Given I
|
10
|
+
Given I write to "app/controllers/application_controller.rb" with:
|
11
|
+
"""
|
12
|
+
class ApplicationController < ActionController::Base
|
13
|
+
protect_from_forgery
|
14
|
+
utf8_enforcer_workaround
|
15
|
+
end
|
16
|
+
"""
|
17
|
+
And I start the rails application
|
11
18
|
And I use a compliant browser
|
12
19
|
When I go to the new user page
|
13
20
|
Then there is no utf8 input tag
|
data/features/support/rails.rb
CHANGED
@@ -37,7 +37,7 @@ module RailsCommandHelpers
|
|
37
37
|
when /^3/ then "rails new #{name} --skip-sprockets --skip-javascript"
|
38
38
|
when /^4/ then "rails new #{name} --skip-sprockets --skip-javascript"
|
39
39
|
when /^5/ then "rails new #{name} --skip-sprockets --skip-javascript"
|
40
|
-
else raise "No support for #{framework_version}
|
40
|
+
else raise "No support for rails #{framework_version}"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -47,7 +47,7 @@ module RailsCommandHelpers
|
|
47
47
|
when /^3/ then "script/rails generate"
|
48
48
|
when /^4/ then "rails generate"
|
49
49
|
when /^5/ then "rails generate"
|
50
|
-
else raise "No support for #{framework_version}
|
50
|
+
else raise "No support for rails #{framework_version}"
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -57,7 +57,7 @@ module RailsCommandHelpers
|
|
57
57
|
when /^3/ then "script/rails runner"
|
58
58
|
when /^4/ then "rails runner"
|
59
59
|
when /^5/ then "rails runner"
|
60
|
-
else raise "No support for #{framework_version}
|
60
|
+
else raise "No support for rails #{framework_version}"
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -4,16 +4,13 @@ module Utf8EnforcerWorkaround
|
|
4
4
|
module ActionController
|
5
5
|
module Base
|
6
6
|
extend ActiveSupport::Concern
|
7
|
+
|
7
8
|
module ClassMethods
|
8
9
|
def utf8_enforcer_workaround
|
9
|
-
if ActionPack::VERSION::STRING < "
|
10
|
-
before_filter
|
11
|
-
|
12
|
-
|
13
|
-
elsif ActionPack::VERSION::STRING >= "5.0.0"
|
14
|
-
before_action do
|
15
|
-
@utf8_enforcer_tag_enabled = browser.ie?
|
16
|
-
end
|
10
|
+
if ActionPack::VERSION::STRING < "4.0.0"
|
11
|
+
before_filter { @utf8_enforcer_tag_enabled = browser.ie? }
|
12
|
+
elsif ActionPack::VERSION::STRING >= "4.0.0"
|
13
|
+
before_action { @utf8_enforcer_tag_enabled = browser.ie? }
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
@@ -5,11 +5,7 @@ module Utf8EnforcerWorkaround
|
|
5
5
|
module Helpers
|
6
6
|
module FormTagHelper
|
7
7
|
def utf8_enforcer_tag_with_tag_removed
|
8
|
-
|
9
|
-
utf8_enforcer_tag_without_tag_removed
|
10
|
-
else
|
11
|
-
"".html_safe
|
12
|
-
end
|
8
|
+
@utf8_enforcer_tag_enabled ? utf8_enforcer_tag_without_tag_removed : "".html_safe
|
13
9
|
end
|
14
10
|
end
|
15
11
|
end
|
@@ -18,6 +14,7 @@ end
|
|
18
14
|
|
19
15
|
ActionView::Helpers::FormTagHelper.class_eval do
|
20
16
|
include Utf8EnforcerWorkaround::ActionView::Helpers::FormTagHelper
|
17
|
+
|
21
18
|
alias_method :utf8_enforcer_tag_without_tag_removed, :utf8_enforcer_tag
|
22
19
|
alias_method :utf8_enforcer_tag, :utf8_enforcer_tag_with_tag_removed
|
23
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utf8_enforcer_workaround
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jarl Friis
|
@@ -28,22 +28,22 @@ dependencies:
|
|
28
28
|
name: browser
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.1.0
|
34
31
|
- - "~>"
|
35
32
|
- !ruby/object:Gem::Version
|
36
33
|
version: '0.1'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 0.1.0
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.1.0
|
44
41
|
- - "~>"
|
45
42
|
- !ruby/object:Gem::Version
|
46
43
|
version: '0.1'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.1.0
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,7 +210,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
- !ruby/object:Gem::Version
|
211
211
|
version: '0'
|
212
212
|
requirements: []
|
213
|
-
|
213
|
+
rubyforge_project: utf8_enforcer_workaround
|
214
|
+
rubygems_version: 2.6.14.4
|
214
215
|
signing_key:
|
215
216
|
specification_version: 4
|
216
217
|
summary: Make utf8_enforcer to be applied only for non-standards-complying browsers.
|