git-scribe 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/LICENSE +1 -1
- data/README.asciidoc +18 -7
- data/TODO.txt +0 -1
- data/git-scribe.gemspec +1 -1
- data/lib/git-scribe/check.rb +10 -0
- data/lib/git-scribe/generate.rb +16 -2
- data/site/default/index.html +2 -2
- data/test/check_test.rb +1 -1
- data/test/gen_test.rb +11 -2
- metadata +3 -3
data/.gitignore
CHANGED
data/LICENSE
CHANGED
data/README.asciidoc
CHANGED
@@ -18,7 +18,7 @@ Eventually, these are the feature goals for the project:
|
|
18
18
|
* Translation workflow tools
|
19
19
|
* Selling (possibly): Kindle, iBooks, Lulu, Pledgie(?)
|
20
20
|
|
21
|
-
The idea is that you use the tool to generate a known structure, write in asciidoc and let the tool handle everything else for you. I want authors to be able to focus on writing and not have to worry about anything else.
|
21
|
+
The idea is that you use the tool to generate a known structure, write in asciidoc and let the tool handle everything else for you. I want authors to be able to focus on writing and not have to worry about anything else (website, multiple format generation, etc).
|
22
22
|
|
23
23
|
A good AsciiDoc cheat sheet: http://powerman.name/doc/asciidoc#_text
|
24
24
|
|
@@ -36,30 +36,41 @@ You can install git-scribe via RubyGems.
|
|
36
36
|
|
37
37
|
For local generation (evenutally pushing to GitHub will handle gen for you), it depends on a couple things like:
|
38
38
|
|
39
|
+
* Git
|
39
40
|
* Ruby
|
40
|
-
* asciidoc, a2x
|
41
|
-
*
|
42
|
-
*
|
41
|
+
* asciidoc, a2x (8.6.4)
|
42
|
+
* xsltproc
|
43
|
+
* source-highlight (3.1)
|
44
|
+
* FOP (1.0) - for PDF generation
|
43
45
|
|
44
46
|
Usage
|
45
47
|
=====
|
46
48
|
|
49
|
+
Check if you have everything installed properly for local generation with `check`:
|
50
|
+
|
51
|
+
$ git scribe check
|
52
|
+
asciidoc - ok
|
53
|
+
xsltproc - ok
|
54
|
+
a2x - ok
|
55
|
+
highlighting - ok
|
56
|
+
fop - ok
|
57
|
+
|
47
58
|
Initialize a new book with `init`:
|
48
59
|
|
49
60
|
$ git scribe init
|
50
61
|
|
51
|
-
This will set up the outline for your book. All the book content goes into the 'book' subdirectory with 'book.asc' as the starting point. If you want to split the writing up into multiple files you can simply include them in the book.asc file.
|
62
|
+
This will set up the outline for your book. All the book content goes into the 'book' subdirectory with 'book.asc' as the starting point. If you want to split the writing up into multiple files you can simply include them in the book.asc file. The generated files have an example of this.
|
52
63
|
|
53
64
|
Then you can generate your book content with the 'git scribe gen' command:
|
54
65
|
|
55
66
|
$ git scribe gen [site|html|pdf|epub|mobi|all]
|
56
67
|
|
57
|
-
Eventually, simply pushing to GitHub will take care of this for you.
|
68
|
+
Eventually, simply pushing to GitHub will take care of this for you. For now you can test this auto-generation from the site http://gitscribe.com. Adding that URL as a post receive hook on your github project will make it try to auto-generate content on push.
|
58
69
|
|
59
70
|
Roadmap
|
60
71
|
=======
|
61
72
|
|
62
|
-
See
|
73
|
+
See SPEC.asciidoc for what this file should look like eventually.
|
63
74
|
|
64
75
|
Contributing
|
65
76
|
============
|
data/TODO.txt
CHANGED
data/git-scribe.gemspec
CHANGED
@@ -9,7 +9,7 @@ puts files
|
|
9
9
|
# piece file back together and write...
|
10
10
|
Gem::Specification.new do |s|
|
11
11
|
s.name = "git-scribe"
|
12
|
-
s.version = "0.0.
|
12
|
+
s.version = "0.0.8"
|
13
13
|
s.date = Time.now.strftime('%Y-%m-%d')
|
14
14
|
s.summary = "git-scribe is an authors toolkit for writing and publishing books"
|
15
15
|
s.homepage = "http://github.com/schacon/git-scribe"
|
data/lib/git-scribe/check.rb
CHANGED
@@ -50,6 +50,16 @@ class GitScribe
|
|
50
50
|
status[:fop] = false
|
51
51
|
end
|
52
52
|
|
53
|
+
# check for calibre
|
54
|
+
if !check_can_run('ebook-convert --version')
|
55
|
+
info "calibre is not present, please install for mobi generation"
|
56
|
+
status[:calibre] = true
|
57
|
+
else
|
58
|
+
info "calibre - ok"
|
59
|
+
status[:calibre] = false
|
60
|
+
end
|
61
|
+
|
62
|
+
|
53
63
|
status
|
54
64
|
end
|
55
65
|
|
data/lib/git-scribe/generate.rb
CHANGED
@@ -2,6 +2,8 @@ class GitScribe
|
|
2
2
|
module Generate
|
3
3
|
# generate the new media
|
4
4
|
def gen(args = [])
|
5
|
+
@done = {} # what we've generated already
|
6
|
+
|
5
7
|
type = first_arg(args) || 'all'
|
6
8
|
prepare_output_dir
|
7
9
|
|
@@ -72,17 +74,29 @@ class GitScribe
|
|
72
74
|
end
|
73
75
|
|
74
76
|
def do_mobi
|
77
|
+
do_html
|
75
78
|
info "GENERATING MOBI"
|
79
|
+
# --cover 'cover.png'
|
80
|
+
# --authors 'Author Name'
|
81
|
+
# --comments "licensed under CC"
|
82
|
+
# --language 'en'
|
83
|
+
cmd = "ebook-convert book.html book.mobi --level1-toc '//h:h1' --level2-toc '//h:h2' --level3-toc '//h:h3'"
|
84
|
+
if ex(cmd)
|
85
|
+
'book.mobi'
|
86
|
+
end
|
76
87
|
end
|
77
88
|
|
78
89
|
def do_html
|
90
|
+
return true if @done['html']
|
79
91
|
info "GENERATING HTML"
|
80
92
|
# TODO: look for custom stylesheets
|
81
93
|
#puts `#{a2x_wss('xhtml')} -v #{BOOK_FILE}`
|
82
94
|
styledir = local('stylesheets')
|
83
95
|
cmd = "asciidoc -a stylesdir=#{styledir} -a theme=handbookish #{BOOK_FILE}"
|
84
|
-
ex(cmd)
|
85
|
-
|
96
|
+
if ex(cmd)
|
97
|
+
@done['html'] == true
|
98
|
+
'book.html'
|
99
|
+
end
|
86
100
|
end
|
87
101
|
|
88
102
|
def do_site
|
data/site/default/index.html
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
<title>{{book_title}}</title>
|
7
7
|
</head>
|
8
8
|
<body>
|
9
|
-
Mobi (Kindle) |
|
10
9
|
<a href="book.epub">Epub (iBooks)</a> |
|
10
|
+
<a href="book.mobi">Mobi (Kindle)</a> |
|
11
11
|
<a href="book.html">Single Page</a> |
|
12
12
|
<a href="book.pdf">PDF</a>
|
13
13
|
<hr/>
|
@@ -35,8 +35,8 @@
|
|
35
35
|
</div>
|
36
36
|
</div>
|
37
37
|
<hr/>
|
38
|
-
Mobi (Kindle) |
|
39
38
|
<a href="book.epub">Epub (iBooks)</a> |
|
39
|
+
<a href="book.mobi">Mobi (Kindle)</a> |
|
40
40
|
<a href="book.html">Single Page</a> |
|
41
41
|
<a href="book.pdf">PDF</a>
|
42
42
|
</body>
|
data/test/check_test.rb
CHANGED
data/test/gen_test.rb
CHANGED
@@ -64,10 +64,19 @@ context "scribe gen tests" do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
-
|
67
|
+
test "scribe can generate a mobi" do
|
68
|
+
in_temp_dir do
|
69
|
+
@scribe.init('t')
|
70
|
+
Dir.chdir('t') do
|
71
|
+
data = @scribe.gen('mobi')
|
72
|
+
assert_equal data, 'book.mobi'
|
73
|
+
out = Dir.glob('output/**/*')
|
74
|
+
assert out.include? 'output/book.mobi'
|
75
|
+
end
|
76
|
+
end
|
68
77
|
end
|
69
78
|
|
70
|
-
xtest "scribe can generate
|
79
|
+
xtest "scribe can generate docbook" do
|
71
80
|
end
|
72
81
|
|
73
82
|
xtest "scribe can generate all" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-scribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Chacon
|