ruby-hacking-guide / ruby-hacking-guide.github.com

Ruby Hacking Guide Translation
http://ruby-hacking-guide.github.io/
318 stars 52 forks source link

fix epub generate problem #28

Closed zhufenggood closed 10 years ago

zhufenggood commented 10 years ago
➜  ruby-hacking-guide.github.com-master  ruby script/publish
Configuration file: /Users/zhufenggood/Downloads/ruby-hacking-guide.github.com-master/_config.yml
            Source: /Users/zhufenggood/Downloads/ruby-hacking-guide.github.com-master
       Destination: /Users/zhufenggood/Downloads/ruby-hacking-guide.github.com-master/_site
      Generating... done.
fatal: Not a git repository (or any of the parent directories): .git
/Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/zip-2.0.2/lib/zip/zip.rb:959:in `put_next_entry': wrong number of arguments (5 for 2) (ArgumentError)
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:96:in `block (2 levels) in save'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/zip-2.0.2/lib/zip/zip.rb:942:in `open'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:95:in `block in save'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:126:in `block in create_epub'
    from /Users/zhufenggood/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/fileutils.rb:125:in `chdir'
    from /Users/zhufenggood/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/fileutils.rb:125:in `cd'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:121:in `create_epub'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/ocf.rb:94:in `save'
    from /Users/zhufenggood/.rvm/gems/ruby-1.9.3-p362@jekll/gems/eeepub-0.8.1/lib/eeepub/maker.rb:84:in `save'
    from script/publish:109:in `<main>'

rubyzip version problem,unable to generate epub file.

markburns commented 10 years ago

Actually, I think this would be better solved with better instructions on the README.

ruby script/publish

will just default to whichever ruby you have installed. And it won't use the gem in the bundle.

e.g. (untested)

cd script
bundle install
./publish
ocha- commented 10 years ago

It seems you failed because you try to run the command in not a cloned repository, but in a downloaded one. The current script uses git-rev-parse to generate a file name.

So If I write one possible full procedure,

$ git clone https://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com
$ cd ruby-hacing-guide.github.com
$ bundle install
$ gem install eeepub
$ ruby script/publish or ./script/publish # I guess both way would work.

And the utf-8 comments would become unnecessary if you use Ruby 2.0.

zhufenggood commented 10 years ago

@markburns You are right. Changing README is better and simple solution.

markburns commented 10 years ago

Will accept a pull request updating it :)

On Wednesday, 2 October 2013, zhufenggood wrote:

@markburns https://github.com/markburns you are right. Change README is better and simple solution.

— Reply to this email directly or view it on GitHubhttps://github.com/ruby-hacking-guide/ruby-hacking-guide.github.com/pull/28#issuecomment-25580558 .

ocha- commented 10 years ago

My apologize. There's a warning about "Not a git repository" but it seems not the cause of this failure.

ocha- commented 10 years ago

I guess we can solve this by updating script/Gemfile to use rubyzip < 1.0.0 and add the instruction on README the following line

$ cd script
ocha- commented 10 years ago

@zhufenggood Are you willing to create a pull request to fix this? If you are not, I'll just update README and script/Gemfile.

ocha- commented 10 years ago

Or If we don't mind the dependency to rubyzip is written Gemfile, not script/Gemfile, probably just merging this request is sufficient. I personally don't have much opinion about it.

ocha- commented 10 years ago
cd script
./publish

It seems this way does not work properly, changing directory before jekyll build is necessary in this case.

If you let me take care of it, I'll just add this line before $ gem install eeepub on README

$ gem install rubyzip -v 0.9.9
zhufenggood commented 10 years ago

@ocha You could update README or Gemfile to solve this, I will not pull a request.

avsej commented 10 years ago

btw, recent publish script also depends on calibre to make output more sane and also it generates more formats.

In the ticket #31 I left links to the outputs on current master, if you want to check it quickly

ocha- commented 10 years ago

@zhufenggood I updated README. Probably this is a workaround which is temporarily necessary, it will eventually be fixed by either eeepub or rubyzip. Thank you for reporting this problem :)

@avsej Thank you very much for great works!! I also added your links to outputs to README because I think most people would like to download the generated files rather than generating by themselves. But of course you can remove them from README if you mind it.