brady8/thumbs_up — Issue #22: Ruby encoding issue
Author: Govinda-Fichtner
Created: 2011-10-28 10:06:57+00:00
State: open

Hello,

just got into a problem installing the 0.4.3 version of the gem in a ruby 1.9.2 environment with bundler.

The error was:

/usr/local/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input': invalid byte sequence in US-ASCII (ArgumentError)
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
from /usr/local/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
from /usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /usr/local/lib/ruby/1.9.1/open-uri.rb:35:in `open'
from /usr/local/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:100:in `spec_from_gem'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/source.rb:77:in `fetch'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:50:in `block in run'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/cli.rb:220:in `install'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/bin/bundle:13:in `'
from /usr/local/bin/bundle:19:in `load'
from /usr/local/bin/bundle:19:in `

'

The error only appears when you installed the gem via "gem install thumbs_up" (which seems to use the gem thumbs_up.gemspec file) and not if you installed it via bundler and the git parameter...

As far as I can see it seems to be related to the magic utf-8 comment in the thumbs_up.gemspec file... the utf-8 magic comment is in line four and should be in line one. If it is in line one I get no errors whatsoever.
According to http://blog.grayproductions.net/articles/ruby_19s_three_default_encodings the magic comment should either be in line one or line two if there is a shebang line present.

Govinda