bring_back_snowman 1.0.0

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/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bring_back_snowman.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Steve Klabnik
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.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # BringBackSnowman
2
+
3
+ You know you miss this little guy: ☃.
4
+
5
+ If you don't know what that's about, [this blog post explains what's
6
+ up](http://intertwingly.net/blog/2010/07/29/Rails-and-Snowmen).
7
+
8
+ With the impending release of Rails 4, I was thinking about fun things in the
9
+ history of Rails, and thought it'd be fun to bring him back.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'bring_back_snowman'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install bring_back_snowman
24
+
25
+ ## Usage
26
+
27
+ Just do it, and your forms will submit `_snowman=☃` to ensure that your data
28
+ is encoded in UTF-8.
29
+
30
+ It is configurable, if you prefer something else. Add this to your
31
+ `application.rb`:
32
+
33
+ ```
34
+ config.snowman = {:emoji => "😢"}
35
+ ```
36
+
37
+ You may also need to add the 'magic comment' at the top of the file:
38
+
39
+ ```
40
+ # encoding: UTF-8
41
+ ```
42
+
43
+ Please remember that if you don't use something that's UTF-8, this won't
44
+ actually work to fix the bug.
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bring_back_snowman/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "bring_back_snowman"
8
+ gem.version = BringBackSnowman::VERSION
9
+ gem.authors = ["Steve Klabnik"]
10
+ gem.email = ["steve@steveklabnik.com"]
11
+ gem.description = %q{You know you miss this little guy: ☃.}
12
+ gem.summary = %q{You know you miss this little guy: ☃.}
13
+ gem.homepage = "https://github.com/steveklabnik/bring_back_snowman"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,3 @@
1
+ module BringBackSnowman
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: UTF-8
2
+
3
+ require "bring_back_snowman/version"
4
+
5
+ module BringBackSnowman
6
+ class Railtie < Rails::Railtie
7
+ config.snowman = {}
8
+
9
+ config.after_initialize do |app|
10
+ app.config.snowman = {:_snowman => "☃"} if app.config.snowman == {}
11
+ end
12
+ end
13
+ end
14
+
15
+ module ActionView
16
+ module Helpers
17
+ module FormTagHelper
18
+ def utf8_enforcer_tag
19
+ key = Rails.configuration.snowman.keys.first
20
+ value = Rails.configuration.snowman.values.first.unpack("U").first
21
+ tag(:input,
22
+ :type => "hidden",
23
+ :name => key,
24
+ :value => "&##{value}".html_safe)
25
+ end
26
+ end
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bring_back_snowman
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Steve Klabnik
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-20 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! 'You know you miss this little guy: ☃.'
15
+ email:
16
+ - steve@steveklabnik.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - bring_back_snowman.gemspec
27
+ - lib/bring_back_snowman.rb
28
+ - lib/bring_back_snowman/version.rb
29
+ homepage: https://github.com/steveklabnik/bring_back_snowman
30
+ licenses: []
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.23
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: ! 'You know you miss this little guy: ☃.'
53
+ test_files: []
54
+ has_rdoc: