epuber 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +81 -10
- data/lib/epuber/compiler/file_types/abstract_file.rb +18 -4
- data/lib/epuber/compiler/file_types/image_file.rb +1 -1
- data/lib/epuber/config.rb +1 -0
- data/lib/epuber/server/auto_refresh/reloader.coffee +1 -3
- data/lib/epuber/server/basic.styl +13 -9
- data/lib/epuber/server/pages/book.bade +1 -1
- data/lib/epuber/server/pages/common.bade +6 -6
- data/lib/epuber/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fe25adb1dac4b43021c459313ae9f98e1c4ac0e
|
4
|
+
data.tar.gz: 7148acde09046a3b21e3c16fc5ad28cbc9964574
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6164ca50abb2a098b27ab32dc71b0476f2bfbf297f07a5b63a2853f6a9d40659677c950f01ed93c74cc97125147e01a1de8d36f9d509bf2083e567069b99757
|
7
|
+
data.tar.gz: 9a9d083ce64cfd677c471adf6138f3a4a9f6a784a69f981228df89ef1ac1a8fa40f63da7332bd21b43980ec49d97cf0793e6c77ff4478e1ef560ee01a7b55d98
|
data/README.md
CHANGED
@@ -1,26 +1,97 @@
|
|
1
1
|
# Epuber
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/epuber.svg)](http://badge.fury.io/rb/epuber) [![Build Status](https://travis-ci.org/epuber-io/epuber.svg?branch=master)](https://travis-ci.org/epuber-io/epuber) [![Coverage Status](https://coveralls.io/repos/epuber-io/epuber/badge.svg?branch=master&service=github)](https://coveralls.io/github/epuber-io/epuber?branch=master)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/epuber.svg)](http://badge.fury.io/rb/epuber) [![Build Status](https://travis-ci.org/epuber-io/epuber.svg?branch=master)](https://travis-ci.org/epuber-io/epuber) [![Coverage Status](https://coveralls.io/repos/epuber-io/epuber/badge.svg?branch=master&service=github)](https://coveralls.io/github/epuber-io/epuber?branch=master) [![Inline docs](http://inch-ci.org/github/epuber-io/epuber.svg?branch=master)](http://inch-ci.org/github/epuber-io/epuber)
|
4
4
|
|
5
5
|
Epuber is simple tool to compile and pack source files into EPUB format. Offers to define multiple "targets" which allows to create multiple versions of the book by running only one command. Eliminates copying code and information, eliminates needs to use _git_ branches to differ ebook content.
|
6
6
|
|
7
7
|
|
8
8
|
## Features
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
Simple example of `.bookspec` file defining all book's metadata and Table Of Contents. This file can be generated by running command `epuber init`.
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
Epuber::Book.new do |book|
|
14
|
+
book.title = 'Epuber example book'
|
15
|
+
book.author = 'Roman Kříž'
|
16
|
+
book.isbn = '123-45-67890-12-3'
|
17
|
+
book.version = '1.0.1'
|
18
|
+
book.build_version = '5'
|
19
|
+
|
20
|
+
book.cover_image = 'cover'
|
21
|
+
book.add_default_style 'default_style.styl'
|
22
|
+
|
23
|
+
# create spine and toc
|
24
|
+
book.toc do |toc|
|
25
|
+
toc.file 'cover', :landmark_cover
|
26
|
+
toc.file 'copyright', :landmark_copyright
|
27
|
+
toc.file 'toc', :landmark_toc
|
28
|
+
|
29
|
+
toc.file 'intro', 'Intro'
|
30
|
+
|
31
|
+
toc.file 'chapter_01', 'Chapter One' do
|
32
|
+
toc.file '#section_01', 'Section One, awesome'
|
33
|
+
toc.file '#section_02', 'Section Two, more awesome'
|
34
|
+
toc.file '#section_03', 'Section Three, wow, much, very'
|
35
|
+
end
|
36
|
+
|
37
|
+
toc.file 'conclusion', 'Conclusion'
|
38
|
+
|
39
|
+
toc.file 'footnotes', 'Footnotes', linear: false
|
40
|
+
end
|
41
|
+
|
42
|
+
# load basic validators folder with ruby scripts
|
43
|
+
book.use 'basic_validators/'
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Except for paths to plugins `book.use`, every path could be only name of the file, even without extension. So you can rename them, move them, the correct path will always resolved. Only exception is when the same name has more then one file.
|
48
|
+
|
49
|
+
| Epuber
|
50
|
+
-----------|------------------------------------------------------------
|
51
|
+
:book: | Creates seamless workflow for creating ebooks
|
52
|
+
:monorail: | Defines different _targets_ for several book stores (iBookstore, Google Play store, ...)
|
53
|
+
:wrench: | Extend and customise the functionality with _plugins_
|
54
|
+
:pencil2: | Defines _constants_ so you can have link to related book in proper book store
|
55
|
+
:pencil: | Defines mechanisms to deal with duplicated
|
56
|
+
:tophat: | Easy setup assistant to get started in a few minutes
|
57
|
+
:ghost: | Automatically validates generated text so you don't have to worry about typos and other mistakes
|
58
|
+
:rocket: | Saves you **hours** when developing new or updating existing book
|
59
|
+
:page_with_curl: | Supports template engines, CSS preprocessors and standard EPUB formats at the same time
|
60
|
+
:computer: | Have local development web server to iterate and experiment quickly
|
61
|
+
:loop: | Automatically refresh web browser when some source file changes
|
62
|
+
:bomb: | Quick jumping through pages with arrow keys on keyboard
|
63
|
+
:closed_book: | Supports EPUB 2 and 3
|
17
64
|
|
18
65
|
|
19
66
|
## Installation
|
20
67
|
|
21
|
-
|
68
|
+
First of all Epuber uses [RMagick](https://github.com/rmagick/rmagick) which has several external dependencies, so you have to install that first:
|
22
69
|
|
23
|
-
|
70
|
+
- ImageMagick
|
71
|
+
- pkg-config
|
72
|
+
|
73
|
+
On OS X make sure you Xcode Command Line Tools installed:
|
74
|
+
|
75
|
+
xcode-select --install
|
76
|
+
|
77
|
+
And the easiest way to install prerequisites on OS X is to use [brew](http://brew.sh):
|
78
|
+
|
79
|
+
brew install imagemagick pkg-config
|
80
|
+
|
81
|
+
On Ubuntu, you can run:
|
82
|
+
|
83
|
+
sudo apt-get install libmagickwand-dev
|
84
|
+
|
85
|
+
|
86
|
+
### Finish
|
87
|
+
|
88
|
+
Then just type following line to terminal:
|
89
|
+
|
90
|
+
sudo gem install epuber
|
91
|
+
|
92
|
+
If everything goes well, try running following line in terminal:
|
93
|
+
|
94
|
+
epuber --help
|
24
95
|
|
25
96
|
|
26
97
|
## Development
|
@@ -45,16 +45,30 @@ module Epuber
|
|
45
45
|
|
46
46
|
################################################################################################################
|
47
47
|
|
48
|
+
# @param [String] source_path path to source file
|
49
|
+
# @param [String] dest_path path to destination file
|
50
|
+
# @param [Bool] identical whether the content of existing files should be compared or not (expensive operation)
|
51
|
+
#
|
52
|
+
# @return [Bool]
|
53
|
+
#
|
54
|
+
def self.file_uptodate?(source_path, dest_path, identical: true)
|
55
|
+
return false unless File.exist?(dest_path)
|
56
|
+
return false unless FileUtils.uptodate?(dest_path, [source_path])
|
57
|
+
|
58
|
+
if identical
|
59
|
+
return false unless FileUtils.identical?(dest_path, source_path)
|
60
|
+
end
|
61
|
+
|
62
|
+
true
|
63
|
+
end
|
64
|
+
|
48
65
|
# @param [String] source_path
|
49
66
|
# @param [String] dest_path
|
50
67
|
#
|
51
68
|
# @return [Bool]
|
52
69
|
#
|
53
70
|
def self.file_copy?(source_path, dest_path)
|
54
|
-
|
55
|
-
return false if File.exists?(dest_path) && FileUtils.compare_file(dest_path, source_path)
|
56
|
-
|
57
|
-
true
|
71
|
+
!file_uptodate?(source_path, dest_path)
|
58
72
|
end
|
59
73
|
|
60
74
|
# @param [String] source_path
|
data/lib/epuber/config.rb
CHANGED
@@ -247,9 +247,7 @@ class @ReloaderContext
|
|
247
247
|
@console.log('AutoRefresh: reloading page')
|
248
248
|
@_saveScrollPosition()
|
249
249
|
|
250
|
-
|
251
|
-
uri.setQuery('cache_control', Math.round(+new Date / 1e3))
|
252
|
-
@window.location.assign(uri.toString())
|
250
|
+
window.location.reload(true)
|
253
251
|
|
254
252
|
when ReloadType.compilation_begin
|
255
253
|
@_displayCompilingOverlay()
|
@@ -31,18 +31,22 @@ selected_color = #6D3102
|
|
31
31
|
left_align = 40px
|
32
32
|
header_underline_height = 6px
|
33
33
|
|
34
|
-
|
35
|
-
height 70px
|
36
|
-
width 100%
|
37
|
-
background-color #C5946C
|
38
|
-
float left
|
34
|
+
header_height = 60px
|
39
35
|
|
40
36
|
#header
|
41
|
-
height
|
37
|
+
height header_height
|
42
38
|
width 100%
|
39
|
+
position fixed
|
40
|
+
top 0px
|
41
|
+
z-index 10000
|
42
|
+
|
43
|
+
background-color #C5946C
|
44
|
+
box-shadow 1px 1px 10px rgba(0, 0, 0, 0.4)
|
45
|
+
|
46
|
+
#header_content
|
47
|
+
height 100%
|
43
48
|
max-width 1200px
|
44
49
|
margin 0 auto
|
45
|
-
background-color #C5946C
|
46
50
|
position relative
|
47
51
|
|
48
52
|
ul
|
@@ -56,7 +60,7 @@ header_underline_height = 6px
|
|
56
60
|
list-style none
|
57
61
|
padding 0
|
58
62
|
margin 0 10px
|
59
|
-
font-size
|
63
|
+
font-size (header_height / 1.8px)
|
60
64
|
color normal_color
|
61
65
|
border-bottom solid header_underline_height transparent
|
62
66
|
|
@@ -85,7 +89,7 @@ header_underline_height = 6px
|
|
85
89
|
max-width 1200px
|
86
90
|
|
87
91
|
margin 0 auto
|
88
|
-
margin-top 20px
|
92
|
+
margin-top header_height + 20px
|
89
93
|
|
90
94
|
#content
|
91
95
|
flex 5
|
@@ -48,7 +48,7 @@ mixin iterate_spine(toc_item)
|
|
48
48
|
+page(header_id: 'home')
|
49
49
|
.cover_image
|
50
50
|
div
|
51
|
-
-
|
51
|
+
- if !book.cover_image.nil? && !(file = file_resolver.file_from_request(book.cover_image)).nil?
|
52
52
|
img(src: "/raw/#{file.pkg_destination_path}")
|
53
53
|
- else
|
54
54
|
img(src: '/server/raw/default_cover.png')
|
@@ -16,12 +16,12 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
mixin body_header(current)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
#header
|
20
|
+
#header_content
|
21
|
+
ul
|
22
|
+
li(class: 'selected' if current == 'home' || current.nil?): a(href: '/')= book.title
|
23
|
+
li(class: 'selected' if current == 'toc'): a(href: '/toc/') Toc
|
24
|
+
li(class: 'selected' if current == 'files'): a(href: '/files/') Files
|
25
25
|
|
26
26
|
mixin body_footer
|
27
27
|
#footer
|
data/lib/epuber/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epuber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Kříž
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -549,7 +549,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
549
549
|
version: '0'
|
550
550
|
requirements: []
|
551
551
|
rubyforge_project:
|
552
|
-
rubygems_version: 2.4.
|
552
|
+
rubygems_version: 2.4.8
|
553
553
|
signing_key:
|
554
554
|
specification_version: 4
|
555
555
|
summary: Epuber is simple tool to compile and pack source files into EPUB format.
|