Project

epubber

0.0
No commit activity in last 3 years
No release in over 3 years
Generate EPUB files programatically
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

~> 3.0
~> 1.6
>= 1.0.0
 Project Readme

Epubber

Gem Version

This gem allows you to easily build EPUB files programatically.

Installation

Add this line to your application's Gemfile:

gem 'epubber'

And then execute:

$ bundle

Or install it yourself as:

$ gem install epubber

Usage

Epubber's DSL is rather simple:

path = Epubber.generate do |b|
  b.title 'My First EPUB book'
  b.author 'Ramirez, Federico'
  b.description 'This is an example EPUB'
  b.url 'http://my-url.com'

  b.cover do |c|
    c.file File.new('my-image.jpg')
  end

  b.introduction do |i|
    i.content '<p>This is an introduction.</p>'
  end

  b.chapter do |c|
    c.title 'Chapter 1'
    c.content '<p>This is some content!</p>'
  end

  b.chapter do |c|
    c.title 'Chapter 2'
    c.content '<p>Some more content this is.</p>'
  end
end

# Now the `path` variable contains the full path of the generated EPUB file.
# Defaults to `#{title}.epub`

You can configure the generator

path = Epubber.generate filename: 'some-file.epub', workspace: '/tmp' do |b|
  # Ebook code here...
end

Contributing

  1. Fork it ( https://github.com/gosukiwi/epubber/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Running tests

Running tests is as easy as running rake.