3

我正在尝试运行的协作项目中的 pdf-writer gem 有问题,我正在使用RVM, Ruby 1.9.2p180, Rails 3.1.0on Ubuntu 10.10

我创建了一个新gemset的来使用 Bundler 安装所需的 gem,但是当我尝试运行该应用程序时,我得到了休闲错误;

josethernandezc@DG965WH:~/Desktop/conest31$ rails s
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII) (SyntaxError)
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: invalid multibyte char (US-ASCII)
/home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712: syntax error, unexpected $end, expecting keyword_end
content = "%PDF-#{@version}\n%âãÏÓ\n"
                                ^
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /home/josethernandezc/Desktop/conest31/config/application.rb:58:in `<top (required)>'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in `require'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:52:in `block in <top (required)>'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in `tap'
from /home/josethernandezc/.rvm/gems/ruby-1.9.2-p180@conest31/gems/railties-3.1.0/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

问题出在pdf-writer-1.1.8/lib/pdf/writer.rb:712,特别是;content = "%PDF-#{@version}\n%âãÏÓ\n"

任何建议都会很棒,我试图用谷歌搜索错误,但我没有找到任何特定于 pdf-writer 的东西......

4

3 回答 3

3

pdf-writer is not compatible with Ruby 1.9. There is a fork which is: https://github.com/metaskills/pdf-writer

Change the pdf-writer line in your Gemfile for:

gem 'pdf-writer', :git => 'git://github.com/metaskills/pdf-writer.git'
于 2012-11-05T10:51:18.667 回答
1

pdf-writer 的分支也适用于 Ruby 2.1,谢谢。

gem 'pdf-writer', :git => 'git://github.com/mwlang/pdf-writer.git'
于 2014-11-03T23:39:52.580 回答
1

我刚刚将 pdf-writer 移植到 Ruby 2.0。将请求发送到 metaskills(在之前的答案中引用)。

如果您同时需要 Ruby 2.0,请在此处找到分叉代码:

gem 'pdf-writer', :git => 'git://github.com/mwlang/pdf-writer.git'
于 2013-08-16T13:31:56.077 回答