Last active
December 14, 2015 22:29
-
-
Save 7hunderbird/5159050 to your computer and use it in GitHub Desktop.
Use this to help get rid of the annoying warning when using Ruby 1.9 and you probably have Activesupport.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. do a `gem env` to get your paths: | |
RubyGems Environment: | |
- RUBYGEMS VERSION: 1.8.23 | |
- RUBY VERSION: 1.9.3 (2013-02-22 patchlevel 392) [x86_64-darwin12.2.0] | |
- INSTALLATION DIRECTORY: /Users/deploy/.rbenv/versions/1.9.3-p392-railsexpress/lib/ruby/gems/1.9.1 | |
- RUBY EXECUTABLE: /Users/deploy/.rbenv/versions/1.9.3-p392-railsexpress/bin/ruby | |
- EXECUTABLE DIRECTORY: /Users/deploy/.rbenv/versions/1.9.3-p392-railsexpress/bin | |
- RUBYGEMS PLATFORMS: | |
- ruby | |
- x86_64-darwin-12 | |
- GEM PATHS: | |
- /Users/deploy/.rbenv/versions/1.9.3-p392-railsexpress/lib/ruby/gems/1.9.1 | |
- /Users/deploy/.gem/ruby/1.9.1 | |
- GEM CONFIGURATION: | |
- :update_sources => true | |
- :verbose => true | |
- :benchmark => false | |
- :backtrace => false | |
- :bulk_threshold => 1000 | |
- :sources => ["http://rubygems.org/"] | |
- "gem" => "--no-ri --no-rdoc" | |
- REMOTE SOURCES: | |
- http://rubygems.org/ | |
2. Open this folder in your text editor of choice: | |
subl . | |
3. Search for the following search term throughout all folders: | |
require 'iconv' | |
4. I found that the json-1.7.7 gem has a great algorithm for figuring out how to require 'iconv' or not. | |
# Shortuct for iconv. | |
if ::String.method_defined?(:encode) && | |
# XXX Rubinius doesn't support ruby 1.9 encoding yet | |
defined?(RUBY_ENGINE) && RUBY_ENGINE != 'rbx' | |
then | |
# Encodes string using Ruby's _String.encode_ | |
def self.iconv(to, from, string) | |
string.encode(to, from) | |
end | |
else | |
require 'iconv' | |
# Encodes string using _iconv_ library | |
def self.iconv(to, from, string) | |
Iconv.conv(to, from, string) | |
end | |
end | |
5. So I would just pick and choose from my results from the search before and comment out require 'iconv' and replace them with the above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Get the gem paths directly:
Search: