epubforge 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +17 -10
- data/VERSION +1 -1
- data/bin/epubforge +1 -1
- data/config/actions/epub.rb +50 -0
- data/config/actions/forge.rb +34 -13
- data/config/actions/git.rb +106 -0
- data/config/actions/help.rb +13 -13
- data/config/actions/html.rb +33 -0
- data/config/actions/mobi.rb +60 -0
- data/config/actions/new.rb +182 -0
- data/config/actions/word_count.rb +26 -24
- data/config/{actions → actions_to_ignore}/generate.rb +1 -1
- data/config/{actions → actions_to_ignore}/generate_chapter.rb +0 -0
- data/config/{actions → actions_to_ignore}/git_backup.rb +2 -2
- data/config/{actions → actions_to_ignore}/globals.rb +1 -1
- data/config/{actions → actions_to_ignore}/kindle.rb +3 -3
- data/config/{actions → actions_to_ignore}/local_action.rb +1 -1
- data/config/{actions → actions_to_ignore}/mobify.rb +3 -3
- data/config/actions_to_ignore/notes_to_epub.rb +19 -0
- data/config/actions_to_ignore/notes_to_kindle.rb +18 -0
- data/config/{actions → actions_to_ignore}/spell.rb +1 -1
- data/config/{actions → actions_to_ignore}/version.rb +3 -3
- data/config/{actions → actions_to_ignore}/wrap_scene_notes_in_hidden_div.rb +1 -1
- data/config/converters/epub_to_mobi.calibre.rb +8 -0
- data/config/converters/epub_to_mobi.kindlegen.rb +11 -0
- data/config/html_translators/default_kramdown.html_translator.rb +9 -0
- data/config/html_translators/default_markdown.html_translator.rb +10 -0
- data/config/html_translators/default_markdown_pandoc.html_translator.rb +10 -0
- data/config/html_translators/default_textile_pandoc.html_translator.rb +8 -0
- data/config/html_translators/default_xhtml.html_translator.rb +7 -0
- data/config/html_translators/fallback_html.html_translator.rb +9 -0
- data/config/html_translators/fallback_markdown.html_translator.rb +8 -0
- data/config/html_translators/fallback_textile.html_translator.rb +7 -0
- data/config/html_translators/fallback_txt.html_translator.rb +8 -0
- data/config/html_translators/fallback_unknown.html_translator.rb +7 -0
- data/lib/epubforge.rb +37 -82
- data/lib/{action/thor_action.rb → epubforge/action/action.rb} +89 -69
- data/lib/epubforge/action/action2.rb +109 -0
- data/lib/epubforge/action/action_definition.rb +62 -0
- data/lib/epubforge/action/actions_lookup.rb +45 -0
- data/lib/epubforge/action/chatterbox.rb +93 -0
- data/lib/{action → epubforge/action}/cli_command.rb +2 -2
- data/lib/{action → epubforge/action}/cli_sequence.rb +0 -0
- data/lib/{action → epubforge/action}/file_transformer.rb +0 -0
- data/lib/{action → epubforge/action}/hooks_interface.rb +2 -2
- data/lib/{action → epubforge/action}/run_description.rb +12 -9
- data/lib/{action → epubforge/action}/runner.rb +23 -24
- data/lib/{epub → epubforge/builder}/assets/asset.rb +1 -1
- data/lib/{epub → epubforge/builder}/assets/font.rb +1 -1
- data/lib/epubforge/builder/assets/html.rb +9 -0
- data/lib/{epub → epubforge/builder}/assets/image.rb +1 -1
- data/lib/epubforge/builder/assets/markdown.rb +9 -0
- data/lib/{epub → epubforge/builder}/assets/page.rb +12 -4
- data/lib/{epub → epubforge/builder}/assets/stylesheet.rb +1 -1
- data/lib/epubforge/builder/assets/textile.rb +9 -0
- data/lib/epubforge/builder/assets/xhtml.rb +9 -0
- data/lib/epubforge/builder/builder.rb +134 -0
- data/lib/{epub/builder.rb → epubforge/builder/epub.rb} +58 -161
- data/lib/epubforge/builder/html.rb +22 -0
- data/lib/epubforge/builder/packager.rb +16 -0
- data/lib/epubforge/core_extensions/array.rb +2 -0
- data/lib/{core_extensions → epubforge/core_extensions}/kernel.rb +0 -0
- data/lib/epubforge/core_extensions/nil_class.rb +2 -0
- data/lib/epubforge/core_extensions/object.rb +24 -0
- data/lib/{core_extensions → epubforge/core_extensions}/string.rb +1 -5
- data/lib/{custom_helpers.rb → epubforge/custom_helpers.rb} +0 -1
- data/lib/{errors.rb → epubforge/exceptions/errors.rb} +0 -0
- data/lib/{project → epubforge/project}/project.rb +23 -17
- data/lib/epubforge/utils/action_loader.rb +8 -0
- data/lib/epubforge/utils/class_loader.rb +102 -0
- data/lib/epubforge/utils/converter.rb +94 -0
- data/lib/{utils → epubforge/utils}/downloader.rb +0 -0
- data/lib/{utils → epubforge/utils}/file_orderer.rb +0 -0
- data/lib/epubforge/utils/file_path.rb +8 -0
- data/lib/epubforge/utils/html_translator.rb +126 -0
- data/lib/epubforge/utils/html_translator_queue.rb +113 -0
- data/lib/epubforge/utils/htmlizer.rb +61 -0
- data/lib/{utils → epubforge/utils}/misc.rb +0 -0
- data/lib/epubforge/utils/root_path.rb +8 -0
- data/lib/epubforge/utils/settings.rb +147 -0
- data/lib/epubforge/utils/template_evaluator.rb +7 -0
- data/templates/{default/book/afterword.markdown.template → project/book/afterword.markdown} +0 -0
- data/templates/project/book/chapter-%0000chapter%.markdown.template +4 -0
- data/templates/{default → project}/book/cover.xhtml.template +2 -2
- data/templates/{default/book/foreword.markdown.template → project/book/foreword.markdown} +0 -0
- data/templates/{default → project}/book/images/cover.png +0 -0
- data/templates/{default/book/stylesheets/stylesheet.css.template → project/book/stylesheets/stylesheet.css} +0 -0
- data/templates/project/book/title_page.markdown.template +5 -0
- data/templates/project/notes/character.%character.name_for_file%.markdown.template +15 -0
- data/templates/{default → project}/notes/images/cover.png +0 -0
- data/templates/{default/notes/stylesheets/stylesheet.css.template → project/notes/stylesheets/stylesheet.css} +0 -0
- data/templates/{default → project}/settings/actions/local_action.rb.example +1 -1
- data/templates/project/settings/config.rb.template +70 -0
- data/templates/project/settings/html_translators/example_translator.rb +29 -0
- data/templates/{default → project}/settings/wordcount.template +1 -1
- data/test/answers01.yml +30 -0
- data/test/helper.rb +62 -39
- data/test/misc/config.rb +5 -7
- data/test/test_epubforge.rb +18 -14
- data/test/{test_htmlizers.rb → test_html_translators.rb} +4 -8
- data/test/test_template_evaluator.rb +42 -0
- data/test/test_utils.rb +0 -11
- metadata +186 -189
- data/config/actions/gitify.rb +0 -72
- data/config/actions/init.rb +0 -138
- data/config/actions/notes_to_epub.rb +0 -18
- data/config/actions/notes_to_kindle.rb +0 -17
- data/config/htmlizers.rb +0 -70
- data/lib/action/actions_lookup.rb +0 -45
- data/lib/core_extensions/array.rb +0 -5
- data/lib/core_extensions/nil_class.rb +0 -5
- data/lib/core_extensions/object.rb +0 -5
- data/lib/epub/assets/html.rb +0 -8
- data/lib/epub/assets/markdown.rb +0 -8
- data/lib/epub/assets/textile.rb +0 -8
- data/lib/epub/assets/xhtml.rb +0 -8
- data/lib/epub/packager.rb +0 -16
- data/lib/utils/action_loader.rb +0 -7
- data/lib/utils/class_loader.rb +0 -102
- data/lib/utils/directory_builder.rb +0 -181
- data/lib/utils/file_path.rb +0 -152
- data/lib/utils/html_translator.rb +0 -100
- data/lib/utils/html_translator_queue.rb +0 -70
- data/lib/utils/htmlizer.rb +0 -92
- data/lib/utils/root_path.rb +0 -20
- data/lib/utils/settings.rb +0 -146
- data/lib/utils/template_evaluator.rb +0 -20
- data/templates/default/book/chapter-%i%.markdown.sequence +0 -4
- data/templates/default/book/title_page.markdown.template +0 -4
- data/templates/default/notes/character.named.markdown.template +0 -4
- data/templates/default/payload.rb +0 -65
- data/templates/default/settings/config.rb.form +0 -55
- data/templates/default/settings/htmlizers.rb +0 -0
- data/test/test_directory_builder.rb +0 -141
File without changes
|
@@ -1,141 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
DirBuilder = EpubForge::Utils::DirectoryBuilder
|
4
|
-
|
5
|
-
class TestDirectoryBuilder < EpubForge::TestCase
|
6
|
-
context "tearing my hair out because shoulda seems borked" do
|
7
|
-
should "stop blaming shoulda for my problems" do
|
8
|
-
assert true
|
9
|
-
end
|
10
|
-
|
11
|
-
should "realize that assert statements need to be inside should blocks" do
|
12
|
-
assert "Okay, okay. I get it. Now lay off me."
|
13
|
-
end
|
14
|
-
|
15
|
-
should "figure out why the hell [].is_a?(Array) returns false" do
|
16
|
-
assert_kind_of Array, []
|
17
|
-
assert [].is_a?(Array)
|
18
|
-
# seems fine here.
|
19
|
-
# subclassing Array for use in the EpubForge module seems
|
20
|
-
# to be the culprit. Guess I'm not doing that.
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context "In a temporary directory" do
|
25
|
-
should "create a temporary directory" do
|
26
|
-
DirBuilder.tmpdir do |b|
|
27
|
-
assert_equal DirBuilder, b.class #
|
28
|
-
assert b.current_path.exist?
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
should "write data to a new file" do
|
33
|
-
DirBuilder.tmpdir do |b|
|
34
|
-
assert_equal DirBuilder, b.class # Okay, WTF does this test fail?
|
35
|
-
assert b.current_path
|
36
|
-
assert b.current_path.exist?
|
37
|
-
b.file("widdershins.txt") do |f|
|
38
|
-
f << "Hello World"
|
39
|
-
f.flush
|
40
|
-
|
41
|
-
assert b.current_file.exist?
|
42
|
-
assert_equal 11, b.current_file.size
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
should "copy files from elsewhere into the directory" do
|
48
|
-
DirBuilder.tmpdir do |b|
|
49
|
-
assert_equal DirBuilder, b.class
|
50
|
-
src = EpubForge.root.join("Gemfile")
|
51
|
-
assert src.exist?
|
52
|
-
|
53
|
-
b.copy( EpubForge.root.join("Gemfile") )
|
54
|
-
|
55
|
-
gemfile = b.current_path.join("Gemfile")
|
56
|
-
assert gemfile.exist?
|
57
|
-
assert !gemfile.zero?
|
58
|
-
assert_equal 1, gemfile.grep( /jeweler/ ).length
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
should "copy files from elsewhere, renaming the file in the destination" do
|
63
|
-
DirBuilder.tmpdir do |b|
|
64
|
-
assert_equal DirBuilder, b.class
|
65
|
-
assert !b.current_path.join("helpers.rb").exist?
|
66
|
-
b.copy( EpubForge.root.join("lib", "custom_helpers.rb"), "helpers.rb" )
|
67
|
-
assert b.current_path.join("helpers.rb").exist?
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
should "download random crap from all over the Internet" do
|
72
|
-
DirBuilder.tmpdir do |b|
|
73
|
-
gist_url = "http://bannedsorcery.com/downloads/testfile.txt"
|
74
|
-
gist_text = "This is a file\n==============\n\n**silent**: But _bold_! [Link](http://slashdot.org)\n"
|
75
|
-
b.download( gist_url, "gist.txt" )
|
76
|
-
|
77
|
-
b.file( "gist.txt.2" ) do
|
78
|
-
b.download( gist_url )
|
79
|
-
end
|
80
|
-
|
81
|
-
assert b.current_file.nil?
|
82
|
-
assert b.current_path.join("gist.txt").exist?
|
83
|
-
assert b.current_path.join("gist.txt.2").exist?
|
84
|
-
assert_equal gist_text, b.current_path.join("gist.txt").read
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
should "exercise all manner of features to create a complex directory" do
|
89
|
-
DirBuilder.tmpdir do |b|
|
90
|
-
assert_equal DirBuilder, b.class
|
91
|
-
root = EpubForge.root
|
92
|
-
gemfile = root.join("Gemfile")
|
93
|
-
b.copy( gemfile )
|
94
|
-
assert gemfile.exist?
|
95
|
-
assert_equal gemfile.size, b.current_path.join("Gemfile").size
|
96
|
-
|
97
|
-
b.dir( "earth" ) do
|
98
|
-
b.dir( "air") do
|
99
|
-
b.dir( "fire" ) do
|
100
|
-
b.dir( "water" ) do
|
101
|
-
b.file( "hello.txt" )
|
102
|
-
b.file << "H"
|
103
|
-
b.file << "e"
|
104
|
-
b.file << "l"
|
105
|
-
b.file << "l"
|
106
|
-
b.file << "o"
|
107
|
-
end
|
108
|
-
|
109
|
-
assert b.current_file.nil?
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
assert "Hello", b.current_path.join("earth", "air", "fire", "water", "hello.txt").read
|
115
|
-
|
116
|
-
b.dir( "fire", "water", "earth", "air" ) do
|
117
|
-
assert b.current_path.exist?
|
118
|
-
b.copy( EpubForge.root.join("Gemfile"), "Gemfile.example" )
|
119
|
-
b.copy( EpubForge.root.join("Gemfile.lock"), "Gemfile.lock.example" )
|
120
|
-
b.copy( EpubForge.root.join("Rakefile"), "Rakefile" )
|
121
|
-
|
122
|
-
for file in %W(Gemfile.example Gemfile.lock.example Rakefile)
|
123
|
-
assert b.current_path.join(file).exist?, "#{file} should exist"
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
directory = ["air", "earth", "water", "fire"]
|
128
|
-
b.dir( *directory ) do
|
129
|
-
b.file( "slipstream.txt", "file contents" )
|
130
|
-
end
|
131
|
-
|
132
|
-
assert b.current_path.join(*directory).exist?
|
133
|
-
slip = b.current_path.join(*directory).join("slipstream.txt")
|
134
|
-
assert slip.exist?
|
135
|
-
assert_equal false, slip.empty?
|
136
|
-
assert_equal "file contents", b.current_path.join(*directory).join( "slipstream.txt" ).read
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|