jawspeak / ruby-docx-templater

A Ruby library to template Microsoft Word .docx files. Generates new Word .docx files based on a template file. Does templating entirely in memory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uninitialized constant DocxTemplater::DocxCreator::Zip

aurels opened this issue · comments

Hello,

This project looks really interesting !

I'm trying to test it independently to determine if it does what I need :
https://github.com/aurels/ruby-docx-templater-example

When running with file :
https://github.com/aurels/ruby-docx-templater-example/blob/master/run.rb

I get this NameError :

bundle exec ruby run.rb 
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in `read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError)
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:in `generate_docx_bytes'
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in `generate_docx_file'
  from run.rb:14:in `<main>'
aurels@ruby-docs-templater-test[]: bundle exec ruby run.rb 
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in `read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError)
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:in `generate_docx_bytes'
  from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in `generate_docx_file'
  from run.rb:13:in `<main>'    

Is something missing in the Gemfile ?
https://github.com/aurels/ruby-docx-templater-example/blob/master/Gemfile

Thanks,

Aurélien

Looks like something broke after we recently removed the dependency on our
own zip library fork. You can check out an older version to verify it used
to work. There aren't many commits, so going backwards should be easy to
find it. Otherwise, maybe you are missing a gem dependency - did you bundle?

On Wed, Oct 23, 2013 at 5:35 AM, Aurélien Malisart <notifications@github.com

wrote:

Hello,

This project looks really interesting !

I'm trying to test it independently to determine if it does what I need :
https://github.com/aurels/ruby-docx-templater-example

When running with file :
https://github.com/aurels/ruby-docx-templater-example/blob/master/run.rb

I get this NameError :

bundle exec ruby run.rb
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError) from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:ingenerate_docx_bytes'
from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in generate_docx_file' from run.rb:14:in

'
aurels@ruby-docs-templater-test[]: bundle exec ruby run.rb
/Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:34:in read_existing_template_docx': uninitialized constant DocxTemplater::DocxCreator::Zip (NameError) from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:19:ingenerate_docx_bytes'
from /Users/aurels/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/ruby-docx-templater-f9c7f2bca74e/lib/docx_templater/docx_creator.rb:13:in generate_docx_file' from run.rb:13:in'

Is something missing in the Gemfile ?
https://github.com/aurels/ruby-docx-templater-example/blob/master/Gemfile

Thanks,

Aurélien


Reply to this email directly or view it on GitHubhttps://github.com//issues/3
.

-Jonathan

Thanks for the reply, you are right : it works on 632454b.

@aurels it looks like you're using the fork of zipruby, even when you should not need it with the current version of ruby-docx-templater. can you try removing that from your gemfile?

I've updated the readme to prevent this issue from plaguing future users.

@tamird : I confirm that it works, the README plagued me ;-)