epubforge 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +17 -10
  3. data/VERSION +1 -1
  4. data/bin/epubforge +1 -1
  5. data/config/actions/epub.rb +50 -0
  6. data/config/actions/forge.rb +34 -13
  7. data/config/actions/git.rb +106 -0
  8. data/config/actions/help.rb +13 -13
  9. data/config/actions/html.rb +33 -0
  10. data/config/actions/mobi.rb +60 -0
  11. data/config/actions/new.rb +182 -0
  12. data/config/actions/word_count.rb +26 -24
  13. data/config/{actions → actions_to_ignore}/generate.rb +1 -1
  14. data/config/{actions → actions_to_ignore}/generate_chapter.rb +0 -0
  15. data/config/{actions → actions_to_ignore}/git_backup.rb +2 -2
  16. data/config/{actions → actions_to_ignore}/globals.rb +1 -1
  17. data/config/{actions → actions_to_ignore}/kindle.rb +3 -3
  18. data/config/{actions → actions_to_ignore}/local_action.rb +1 -1
  19. data/config/{actions → actions_to_ignore}/mobify.rb +3 -3
  20. data/config/actions_to_ignore/notes_to_epub.rb +19 -0
  21. data/config/actions_to_ignore/notes_to_kindle.rb +18 -0
  22. data/config/{actions → actions_to_ignore}/spell.rb +1 -1
  23. data/config/{actions → actions_to_ignore}/version.rb +3 -3
  24. data/config/{actions → actions_to_ignore}/wrap_scene_notes_in_hidden_div.rb +1 -1
  25. data/config/converters/epub_to_mobi.calibre.rb +8 -0
  26. data/config/converters/epub_to_mobi.kindlegen.rb +11 -0
  27. data/config/html_translators/default_kramdown.html_translator.rb +9 -0
  28. data/config/html_translators/default_markdown.html_translator.rb +10 -0
  29. data/config/html_translators/default_markdown_pandoc.html_translator.rb +10 -0
  30. data/config/html_translators/default_textile_pandoc.html_translator.rb +8 -0
  31. data/config/html_translators/default_xhtml.html_translator.rb +7 -0
  32. data/config/html_translators/fallback_html.html_translator.rb +9 -0
  33. data/config/html_translators/fallback_markdown.html_translator.rb +8 -0
  34. data/config/html_translators/fallback_textile.html_translator.rb +7 -0
  35. data/config/html_translators/fallback_txt.html_translator.rb +8 -0
  36. data/config/html_translators/fallback_unknown.html_translator.rb +7 -0
  37. data/lib/epubforge.rb +37 -82
  38. data/lib/{action/thor_action.rb → epubforge/action/action.rb} +89 -69
  39. data/lib/epubforge/action/action2.rb +109 -0
  40. data/lib/epubforge/action/action_definition.rb +62 -0
  41. data/lib/epubforge/action/actions_lookup.rb +45 -0
  42. data/lib/epubforge/action/chatterbox.rb +93 -0
  43. data/lib/{action → epubforge/action}/cli_command.rb +2 -2
  44. data/lib/{action → epubforge/action}/cli_sequence.rb +0 -0
  45. data/lib/{action → epubforge/action}/file_transformer.rb +0 -0
  46. data/lib/{action → epubforge/action}/hooks_interface.rb +2 -2
  47. data/lib/{action → epubforge/action}/run_description.rb +12 -9
  48. data/lib/{action → epubforge/action}/runner.rb +23 -24
  49. data/lib/{epub → epubforge/builder}/assets/asset.rb +1 -1
  50. data/lib/{epub → epubforge/builder}/assets/font.rb +1 -1
  51. data/lib/epubforge/builder/assets/html.rb +9 -0
  52. data/lib/{epub → epubforge/builder}/assets/image.rb +1 -1
  53. data/lib/epubforge/builder/assets/markdown.rb +9 -0
  54. data/lib/{epub → epubforge/builder}/assets/page.rb +12 -4
  55. data/lib/{epub → epubforge/builder}/assets/stylesheet.rb +1 -1
  56. data/lib/epubforge/builder/assets/textile.rb +9 -0
  57. data/lib/epubforge/builder/assets/xhtml.rb +9 -0
  58. data/lib/epubforge/builder/builder.rb +134 -0
  59. data/lib/{epub/builder.rb → epubforge/builder/epub.rb} +58 -161
  60. data/lib/epubforge/builder/html.rb +22 -0
  61. data/lib/epubforge/builder/packager.rb +16 -0
  62. data/lib/epubforge/core_extensions/array.rb +2 -0
  63. data/lib/{core_extensions → epubforge/core_extensions}/kernel.rb +0 -0
  64. data/lib/epubforge/core_extensions/nil_class.rb +2 -0
  65. data/lib/epubforge/core_extensions/object.rb +24 -0
  66. data/lib/{core_extensions → epubforge/core_extensions}/string.rb +1 -5
  67. data/lib/{custom_helpers.rb → epubforge/custom_helpers.rb} +0 -1
  68. data/lib/{errors.rb → epubforge/exceptions/errors.rb} +0 -0
  69. data/lib/{project → epubforge/project}/project.rb +23 -17
  70. data/lib/epubforge/utils/action_loader.rb +8 -0
  71. data/lib/epubforge/utils/class_loader.rb +102 -0
  72. data/lib/epubforge/utils/converter.rb +94 -0
  73. data/lib/{utils → epubforge/utils}/downloader.rb +0 -0
  74. data/lib/{utils → epubforge/utils}/file_orderer.rb +0 -0
  75. data/lib/epubforge/utils/file_path.rb +8 -0
  76. data/lib/epubforge/utils/html_translator.rb +126 -0
  77. data/lib/epubforge/utils/html_translator_queue.rb +113 -0
  78. data/lib/epubforge/utils/htmlizer.rb +61 -0
  79. data/lib/{utils → epubforge/utils}/misc.rb +0 -0
  80. data/lib/epubforge/utils/root_path.rb +8 -0
  81. data/lib/epubforge/utils/settings.rb +147 -0
  82. data/lib/epubforge/utils/template_evaluator.rb +7 -0
  83. data/templates/{default/book/afterword.markdown.template → project/book/afterword.markdown} +0 -0
  84. data/templates/project/book/chapter-%0000chapter%.markdown.template +4 -0
  85. data/templates/{default → project}/book/cover.xhtml.template +2 -2
  86. data/templates/{default/book/foreword.markdown.template → project/book/foreword.markdown} +0 -0
  87. data/templates/{default → project}/book/images/cover.png +0 -0
  88. data/templates/{default/book/stylesheets/stylesheet.css.template → project/book/stylesheets/stylesheet.css} +0 -0
  89. data/templates/project/book/title_page.markdown.template +5 -0
  90. data/templates/project/notes/character.%character.name_for_file%.markdown.template +15 -0
  91. data/templates/{default → project}/notes/images/cover.png +0 -0
  92. data/templates/{default/notes/stylesheets/stylesheet.css.template → project/notes/stylesheets/stylesheet.css} +0 -0
  93. data/templates/{default → project}/settings/actions/local_action.rb.example +1 -1
  94. data/templates/project/settings/config.rb.template +70 -0
  95. data/templates/project/settings/html_translators/example_translator.rb +29 -0
  96. data/templates/{default → project}/settings/wordcount.template +1 -1
  97. data/test/answers01.yml +30 -0
  98. data/test/helper.rb +62 -39
  99. data/test/misc/config.rb +5 -7
  100. data/test/test_epubforge.rb +18 -14
  101. data/test/{test_htmlizers.rb → test_html_translators.rb} +4 -8
  102. data/test/test_template_evaluator.rb +42 -0
  103. data/test/test_utils.rb +0 -11
  104. metadata +186 -189
  105. data/config/actions/gitify.rb +0 -72
  106. data/config/actions/init.rb +0 -138
  107. data/config/actions/notes_to_epub.rb +0 -18
  108. data/config/actions/notes_to_kindle.rb +0 -17
  109. data/config/htmlizers.rb +0 -70
  110. data/lib/action/actions_lookup.rb +0 -45
  111. data/lib/core_extensions/array.rb +0 -5
  112. data/lib/core_extensions/nil_class.rb +0 -5
  113. data/lib/core_extensions/object.rb +0 -5
  114. data/lib/epub/assets/html.rb +0 -8
  115. data/lib/epub/assets/markdown.rb +0 -8
  116. data/lib/epub/assets/textile.rb +0 -8
  117. data/lib/epub/assets/xhtml.rb +0 -8
  118. data/lib/epub/packager.rb +0 -16
  119. data/lib/utils/action_loader.rb +0 -7
  120. data/lib/utils/class_loader.rb +0 -102
  121. data/lib/utils/directory_builder.rb +0 -181
  122. data/lib/utils/file_path.rb +0 -152
  123. data/lib/utils/html_translator.rb +0 -100
  124. data/lib/utils/html_translator_queue.rb +0 -70
  125. data/lib/utils/htmlizer.rb +0 -92
  126. data/lib/utils/root_path.rb +0 -20
  127. data/lib/utils/settings.rb +0 -146
  128. data/lib/utils/template_evaluator.rb +0 -20
  129. data/templates/default/book/chapter-%i%.markdown.sequence +0 -4
  130. data/templates/default/book/title_page.markdown.template +0 -4
  131. data/templates/default/notes/character.named.markdown.template +0 -4
  132. data/templates/default/payload.rb +0 -65
  133. data/templates/default/settings/config.rb.form +0 -55
  134. data/templates/default/settings/htmlizers.rb +0 -0
  135. data/test/test_directory_builder.rb +0 -141
@@ -0,0 +1,29 @@
1
+ # # Define only one translator per file.
2
+ # #
3
+ # # This htmlizer leaves the input file unaltered
4
+ # # Uncomment the line below, and the matching 'end' statement at the end
5
+ # EpubForge::Utils::HtmlTranslator.new do
6
+ # # format() describes the file extension that this translator will accept. It's a symbol, so do
7
+ # # :txt rather than .txt, for example.
8
+ # format :xhtml
9
+ # # group() describes which group it belongs in, and therefore the priority of this translator.
10
+ # # From most to least important, valid groups are :preferred, :user, :default, and :fallback
11
+ # group :default
12
+ #
13
+ # # executable(): The executable that will be substituted into the {{x}} portion of the command
14
+ # # that will be executed. If you don't give it the name of
15
+ # # a program in your path, or an absolute filepath, the translator will respond to translation
16
+ # # requests with "not installed", and a lower-priority translator will be sought.
17
+ # executable "false"
18
+ #
19
+ # # cmd() What to run.
20
+ # # {{f}} will be replaced with the filename
21
+ # # {{o}} will be replaced with options
22
+ # # {{x}} will be replaced with the name of the executable
23
+ # cmd "cat {{f}}"
24
+ #
25
+ # # Putting it all together: This translator just says "if you come across an XHTML file, just
26
+ # # include it unaltered."
27
+ # #
28
+ # # Uncomment the 'end' line, cuz Ruby.
29
+ # end
@@ -1,5 +1,5 @@
1
1
  # Do not edit this file... I mean, unless you really know what you're doing.
2
- # Then, please carry on.
2
+ # If you do, then, please carry on.
3
3
  - <%= Time.parse( Time.now.strftime("%Y-%m-%d") ) %>:
4
4
  Notes: 0
5
5
  Book: 0
@@ -0,0 +1,30 @@
1
+ ---
2
+ :answers:
3
+ :chapter: !ruby/range
4
+ begin: 1
5
+ end: 3
6
+ excl: false
7
+ :book:
8
+ :author: Wilberforce Poncer
9
+ :title: The Courtesan of Fate
10
+ :cover:
11
+ :license: You Owe Me All the Money Limited License, v. 2.1
12
+ :use_git: true
13
+ :git:
14
+ :repo_id: abcdef0123456789
15
+ :backup_type: Back up to a remote host.
16
+ :host: myhost.somewhere.com
17
+ :user: andersbr
18
+ :repo: /home/andersbr/git
19
+ :character:
20
+ - :age: '27'
21
+ :name: Winifred Burkle
22
+ :summary: Adorkable whiz kid.
23
+ :description: Pylea sucks. Never going back.
24
+ :name_for_file: winifred_burkle
25
+
26
+ - :age: '324'
27
+ :name: Angel
28
+ :summary: Bitey vampire
29
+ :description: Broody as hell.
30
+ :name_for_file: angel
data/test/helper.rb CHANGED
@@ -1,39 +1,46 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- require 'shoulda'
1
+ # require 'bundler'
2
+ # require 'shoulda'
4
3
  require 'stringio'
5
- require 'thor'
4
+ require 'fun_with_testing'
6
5
 
7
- begin
8
- Bundler.setup(:default, :development)
9
- rescue Bundler::BundlerError => e
10
- $stderr.puts e.message
11
- $stderr.puts "Run `bundle install` to install missing gems"
12
- exit e.status_code
13
- end
14
-
15
- require 'test/unit'
16
-
17
- $LOAD_PATH.unshift(File.dirname(__FILE__))
18
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ # begin
7
+ # Bundler.setup(:default, :development)
8
+ # rescue Bundler::BundlerError => e
9
+ # $stderr.puts e.message
10
+ # $stderr.puts "Run `bundle install` to install missing gems"
11
+ # exit e.status_code
12
+ # end
13
+ #
14
+ # require 'test/unit'
19
15
  require 'epubforge'
20
16
 
17
+ EpubForge.gem_test_mode = true
18
+
21
19
  module EpubForge
22
- class TestCase < Test::Unit::TestCase
20
+ class TestCase < FunWith::Testing::TestCase
21
+ self.gem_to_test = EpubForge
22
+
23
+ include EpubForge::Utils
24
+ include FunWith::Testing::Assertions::Basics
25
+ include FunWith::Testing::Assertions::FunWithFiles
26
+
23
27
  protected
24
28
  def create_project( verbose = false, &block )
25
- EpubForge::Utils::DirectoryBuilder.tmpdir do |d|
29
+ verbose = true
30
+ FunWith::Files::DirectoryBuilder.tmpdir do |d|
26
31
  pipe_output_to = (verbose ? $stdout : StringIO.new)
27
32
  @project_dir = d.current_path.join("project")
28
33
 
29
34
  @printout = EpubForge.collect_stdout( pipe_output_to ) do # collect_stdout(STDOUT) to see what's being outputted.
30
- EpubForge::Action::Runner.new.exec( "init", @project_dir, fill_in_project_options )
35
+ @returned = EpubForge::Action::Runner.new.exec( "new", @project_dir, fill_in_project_options )
31
36
  end
37
+
38
+ assert_directory( @project_dir, "Project directory doesn't exist. Cannot proceed." )
32
39
 
33
- assert @project_dir.directory?, "Project directory doesn't exist. Cannot proceed."
40
+ @default_opts = fill_in_project_options[:answers]
41
+ @book_title = @default_opts[:book][:title]
34
42
 
35
- @book_title = fill_in_project_options[:answers][:title]
36
- @chapter_count = fill_in_project_options[:answers][:chapter_count].to_i
43
+ @chapter_count = @default_opts[:chapter].last
37
44
  @ebook_file = @project_dir.join( @book_title.epf_underscorize + ".epub" )
38
45
  @notes_file = @project_dir.join( @book_title.epf_underscorize + ".notes.epub" )
39
46
 
@@ -42,26 +49,42 @@ module EpubForge
42
49
  end
43
50
 
44
51
  def fill_in_project_options( opts = {} )
45
- template_options = {
46
- :answers => {
47
- :chapter_count => 3,
48
- :title => "The Courtesan of Fate",
49
- :author => "Wilberforce Poncer",
50
- :license => "You Owe Me All the Money Limited License, v. 2.1",
51
- :use_git => true,
52
- :git => {
53
- :repo_id => "abcdef0123456789",
54
- :backup_type => "Back up to a remote host.",
55
- :host => "myhost.somewhere.com",
56
- :user => "andersbr",
57
- :repo => "/home/andersbr/git"
58
- }
59
- }
60
- }
61
-
52
+ template_options = YAML.load( EpubForge.root("test", "answers01.yml").read )
62
53
  template_options[:answers].merge(opts)
63
54
 
64
55
  template_options
65
56
  end
57
+
58
+ def tempdir( &block )
59
+ FunWith::Files::FilePath.tmpdir do |d|
60
+ @tmpdir = d
61
+ yield
62
+ end
63
+ end
64
+
65
+ def runner_exec( *args )
66
+ if @runner_exec_quiet
67
+ @runner_exec_printout = EpubForge.collect_stdout do
68
+ @run_description = EpubForge::Action::Runner.new.exec( *args )
69
+ end
70
+ else
71
+ @run_description = EpubForge::Action::Runner.new.exec( *args )
72
+ end
73
+
74
+ if @run_description.errors? # , "running forge caused errors (#{run_desc.errors.length})"
75
+ error = @run_description.errors.first
76
+ case @runner_exec_errors_action
77
+ when :raise
78
+ raise error
79
+ when :print
80
+ puts "Runner.new.exec() args = #{args.inspect}"
81
+ puts error.message
82
+ puts "\t" + error.backtrace.map{ |line| "\t#{line}"}.join("\n")
83
+ puts "\n"
84
+ when :ignore
85
+ # do nothing
86
+ end
87
+ end
88
+ end
66
89
  end
67
90
  end
data/test/misc/config.rb CHANGED
@@ -1,7 +1,5 @@
1
- FunWith::Configurations::Config.new do
2
- wastrel :lance
3
- obsequious do
4
- french :raisin
5
- italian :motorcycle
6
- end
7
- end
1
+ wastrel :lance
2
+ obsequious do
3
+ french :raisin
4
+ italian :motorcycle
5
+ end
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'thor'
3
2
 
4
3
  class TestEpubforge < EpubForge::TestCase #
5
4
  context "Testing a few basic commands" do
@@ -15,7 +14,7 @@ class TestEpubforge < EpubForge::TestCase #
15
14
 
16
15
  should "initialize a new project" do
17
16
  create_project do
18
- assert @project_dir.join( EpubForge::Project::SETTINGS_FOLDER, EpubForge::Project::CONFIG_FILE_NAME ).file?
17
+ assert_file @project_dir.join( EpubForge::Project::SETTINGS_FOLDER, EpubForge::Project::CONFIG_FILE_NAME )
19
18
  assert @project_dir.join( "settings", "actions" ).directory?
20
19
  assert @project_dir.join( "notes" ).directory?
21
20
  assert @project_dir.join( "book", "title_page.markdown" ).file?
@@ -30,8 +29,8 @@ class TestEpubforge < EpubForge::TestCase #
30
29
  EpubForge.collect_stdout do
31
30
  report = EpubForge::Action::Runner.new.exec( "wc", @project_dir ).execution_returned
32
31
  assert_kind_of Hash, report
33
- assert_equal 119, report["Book"]
34
- assert_equal 126, report["Today"]
32
+ assert_equal 122, report["Book"]
33
+ assert_equal 157, report["Today"]
35
34
  assert @project_dir.join( EpubForge::Project::SETTINGS_FOLDER, EpubForge::Action::WordCount::WORD_COUNT_FILE ).exist?
36
35
  end
37
36
  end
@@ -46,18 +45,23 @@ class TestEpubforge < EpubForge::TestCase #
46
45
  end
47
46
 
48
47
  assert_match /Error\(s\) trying to complete the requested action/, printout
49
- assert_match /Current directory is not an epubforge project/, printout
48
+ puts printout.paint(:red, :invert, :white)
49
+ assert_match /Could not find a project directory/, printout
50
50
  end
51
51
  end
52
52
 
53
53
  should "create an .epub file" do
54
54
  create_project do
55
- printout = EpubForge.collect_stdout() do # .collect_stdout(STDOUT) to see what's going on
56
- EpubForge::Action::Runner.new.exec( "forge", @project_dir )
57
- end
55
+ # printout = EpubForge.collect_stdout() do # .collect_stdout(STDOUT) to see what's going on
56
+ # EpubForge::Action::Runner.new.exec( "forge", @project_dir )
57
+ # end
58
+ @runner_exec_errors_action = :raise
59
+
60
+ runner_exec( "epub", @project_dir )
61
+ raise @run_description.errors.first if @run_description.errors? # , "running forge caused errors (#{run_desc.errors.length})"
58
62
 
59
- assert @ebook_file.file?
60
- assert_match /Done building epub/, printout
63
+ assert_file @ebook_file, "Ebook was not created"
64
+ assert_match /Done building epub/, @runner_exec_printout if @runner_exec_printout
61
65
 
62
66
  Dir.mktmpdir do |unzip_dir|
63
67
  unzip_dir = unzip_dir.fwf_filepath
@@ -100,9 +104,9 @@ class TestEpubforge < EpubForge::TestCase #
100
104
  assert_equal 1, toc.grep( /DOCTYPE/ ).length
101
105
  assert_equal 4, toc.grep( /meta name=/ ).length
102
106
 
103
- section_count = EpubForge.root( "templates", "default", "book" ).glob( :ext => ["template", "sequence"] ).length + @chapter_count - 1
107
+ section_count = EpubForge.root( "templates", "project", "book" ).glob( :ext => ["markdown", "template"] ).length + @chapter_count - 1
104
108
  assert_equal section_count, toc.grep( /xhtml/ ).length
105
- assert_equal 1, toc.grep( /#{@book_title}/ ).length
109
+ assert_equal 2, toc.grep( /#{@book_title}/ ).length
106
110
 
107
111
  assert_equal section_count, toc.grep( /<content src=/ ).length
108
112
  end
@@ -110,10 +114,11 @@ class TestEpubforge < EpubForge::TestCase #
110
114
  end
111
115
  end
112
116
  end
117
+
113
118
 
114
119
  should "create an .epub of the notes directory" do
115
120
  create_project do
116
- EpubForge::Action::Runner.new.exec( "forge:notes", @project_dir )
121
+ EpubForge::Action::Runner.new.exec( "epub:notes", @project_dir )
117
122
  assert @notes_file.file?
118
123
  assert ! @notes_file.empty?
119
124
  end
@@ -122,7 +127,6 @@ class TestEpubforge < EpubForge::TestCase #
122
127
  should "print friggin' something when no args" do
123
128
  EpubForge::Action::Runner.new.exec()
124
129
  end
125
-
126
130
  end
127
131
  end
128
132
  end
@@ -1,24 +1,20 @@
1
1
  require 'helper'
2
- Htmlizer = EpubForge::Utils::Htmlizer
3
2
 
4
- class TestHtmlizers < EpubForge::TestCase
3
+ class TestHtmlTranslators < EpubForge::TestCase
5
4
  context "testing htmlizers" do
6
5
  setup do
6
+ @translator_class = EpubForge::Utils::HtmlTranslator
7
7
  @samples = EpubForge.root("test", "sample_text")
8
8
  end
9
9
 
10
10
  should "test markdown" do
11
- result = Htmlizer.instance.translate( @samples.join("sample.markdown") )
11
+ result = @translator_class.translate( @samples.join("sample.markdown") )
12
12
  assert_match /<h1.*This is a header</, result
13
13
  end
14
14
 
15
15
  should "test textile" do
16
- result = Htmlizer.instance.translate( @samples.join("sample.textile") )
16
+ result = @translator_class.translate( @samples.join("sample.textile") )
17
17
  assert_match /<h1.*This is a header</, result
18
18
  end
19
-
20
- should "test everything else" do
21
- skip "not written"
22
- end
23
19
  end
24
20
  end
@@ -0,0 +1,42 @@
1
+ require 'helper'
2
+
3
+ class TestBookTemplates < EpubForge::TestCase
4
+ context "testing default templates" do
5
+ setup do
6
+ @template_dir = EpubForge.root( "templates", "project" )
7
+ end
8
+
9
+ should "properly create files from default templates" do
10
+ tempdir do
11
+ assert @template_dir.directory?
12
+ assert @tmpdir.directory?
13
+
14
+ src = @template_dir.join( "book", "afterword.markdown" )
15
+ dest = @tmpdir.join( "afterword.markdown" )
16
+ FunWith::Templates::TemplateEvaluator.write( src, dest )
17
+
18
+ assert_file_has_content dest
19
+ assert_file_contents dest, /all the way/
20
+ assert_file_contents dest, /go find something else to do/
21
+
22
+ src = @template_dir.join( "book", "cover.xhtml.template" )
23
+ dest = @tmpdir.join( "cover.xhtml" )
24
+ FunWith::Templates::TemplateEvaluator.write( src, dest, fill_in_project_options[:answers] )
25
+
26
+ assert dest.file?
27
+ src = @template_dir.join( "notes", "character.%character.name_for_file%.markdown.template" )
28
+
29
+ # specifying only the directory to write the file into should nonetheless yield the proper behavior
30
+ dest = @tmpdir
31
+ vars = { :character => {:name => "Wilber Pontiff", :name_for_file => "wilber_pontiff"}}
32
+
33
+ FunWith::Templates::TemplateEvaluator.write( src, @tmpdir, vars )
34
+
35
+ dest = dest.join("character.wilber_pontiff.markdown")
36
+ assert_file_has_content dest
37
+ assert_file_contents( dest, /Wilber Pontiff/ )
38
+ assert_file_contents( dest, /^==============$/ )
39
+ end
40
+ end
41
+ end
42
+ end
data/test/test_utils.rb CHANGED
@@ -25,15 +25,4 @@ class TestUtils < EpubForge::TestCase
25
25
  assert_equal files_in_expected_order, reordered_files
26
26
  end
27
27
  end
28
-
29
- context "testing template_handler" do
30
- should "evaluate erb in a string" do
31
- sample = "(<%= Time.now %>): <%= @var_is_set %>"
32
- result = TemplateEvaluator.new( sample, var_is_set: "true" ).result
33
-
34
- assert_match /true/, result
35
- time_string = /\((.*)\)/.match(result)[1]
36
- assert_kind_of Time, Time.parse( time_string )
37
- end
38
- end
39
28
  end
metadata CHANGED
@@ -1,210 +1,192 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epubforge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
5
- prerelease:
4
+ version: 0.0.11
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bryce Anderson
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: xdg
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: '2'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: '2'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: builder
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: '3'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: '3'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.5'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.5'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: thor
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- name: fun_with_files
70
+ name: kramdown
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
- version: '0'
75
+ version: '1.3'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
- version: '0'
82
+ version: '1.3'
94
83
  - !ruby/object:Gem::Dependency
95
- name: fun_with_configurations
84
+ name: fun_with_gems
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: '0.0'
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
- version: '0'
96
+ version: '0.0'
110
97
  - !ruby/object:Gem::Dependency
111
- name: rdoc
98
+ name: fun_with_configurations
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ~>
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: '3.12'
118
- type: :development
103
+ version: '0.0'
104
+ type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ~>
108
+ - - "~>"
124
109
  - !ruby/object:Gem::Version
125
- version: '3.12'
110
+ version: '0.0'
126
111
  - !ruby/object:Gem::Dependency
127
- name: bundler
112
+ name: fun_with_templates
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ~>
115
+ - - "~>"
132
116
  - !ruby/object:Gem::Version
133
- version: 1.3.0
134
- type: :development
117
+ version: '0.0'
118
+ type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ~>
122
+ - - "~>"
140
123
  - !ruby/object:Gem::Version
141
- version: 1.3.0
124
+ version: '0.0'
142
125
  - !ruby/object:Gem::Dependency
143
- name: jeweler
126
+ name: fun_with_string_colors
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ~>
129
+ - - "~>"
148
130
  - !ruby/object:Gem::Version
149
- version: 1.8.4
150
- type: :development
131
+ version: '0.0'
132
+ type: :runtime
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ~>
136
+ - - "~>"
156
137
  - !ruby/object:Gem::Version
157
- version: 1.8.4
138
+ version: '0.0'
158
139
  - !ruby/object:Gem::Dependency
159
- name: shoulda
140
+ name: fun_with_patterns
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ~>
143
+ - - "~>"
164
144
  - !ruby/object:Gem::Version
165
- version: '3.3'
166
- type: :development
145
+ version: '0.0'
146
+ type: :runtime
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ~>
150
+ - - "~>"
172
151
  - !ruby/object:Gem::Version
173
- version: '3.3'
152
+ version: '0.0'
174
153
  - !ruby/object:Gem::Dependency
175
- name: debugger
154
+ name: fun_with_testing
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - ">="
180
158
  - !ruby/object:Gem::Version
181
- version: '0'
159
+ version: 0.0.2
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: '0.0'
182
163
  type: :development
183
164
  prerelease: false
184
165
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
166
  requirements:
187
- - - ! '>='
167
+ - - ">="
188
168
  - !ruby/object:Gem::Version
189
- version: '0'
190
- description: ! "= epubforge =\n\nWrite your book in markdown, then do all sorts of
191
- increasingly nifty things with it using this command-line utility.\n\n== Project
192
- description ==\n\nepubforge is a command-line utility for creating, tracking and
193
- managing longer (novella and book-length) writing projects. Write your text in
194
- markdown (http://whatismarkdown.com/), use the built in actions to convert your
195
- project to various ebook formats, track wordcount over the life of the project,
196
- manage a story bible, and back your project up using git.\n\nOr go further and define
197
- your own formatters/converters and actions in Ruby. Have fun!\n\n\n== Contributing
198
- to epubforge ==\n \n* Check out the latest master to make sure the feature hasn't
199
- been implemented or the bug hasn't been fixed yet.\n* Check out the issue tracker
200
- to make sure someone already hasn't requested it and/or contributed it.\n* Fork
201
- the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are
202
- happy with your contribution.\n* Make sure to add tests for it. This is important
203
- so I don't break it in a future version unintentionally.\n* Please try not to mess
204
- with the Rakefile, version, or history. If you want to have your own version, or
205
- is otherwise necessary, that is fine, but please isolate to its own commit so I
206
- can cherry-pick around it.\n\n== Copyright ==\n\nCopyright (c) 2013 Bryce Anderson.
207
- See LICENSE.txt for\nfurther details.\n\n"
169
+ version: 0.0.2
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '0.0'
173
+ description: "= epubforge =\n\nWrite your book in markdown, then do all sorts of increasingly
174
+ nifty things with it using this command-line utility.\n\n== Project description
175
+ ==\n\nepubforge is a command-line utility for creating, tracking and managing longer
176
+ (novella and book-length) writing projects. Write your text in markdown (http://whatismarkdown.com/),
177
+ use the built in actions to convert your project to various ebook formats, track
178
+ wordcount over the life of the project, manage a story bible, and back your project
179
+ up using git.\n\nOr go further and define your own formatters/converters and actions
180
+ in Ruby. Have fun!\n\n\n== Contributing to epubforge ==\n \n* Check out the latest
181
+ master to make sure the feature hasn't been implemented or the bug hasn't been fixed
182
+ yet.\n* Check out the issue tracker to make sure someone already hasn't requested
183
+ it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n*
184
+ Commit and push until you are happy with your contribution.\n* Make sure to add
185
+ tests for it. This is important so I don't break it in a future version unintentionally.\n*
186
+ Please try not to mess with the Rakefile, version, or history. If you want to have
187
+ your own version, or is otherwise necessary, that is fine, but please isolate to
188
+ its own commit so I can cherry-pick around it.\n\n== Copyright ==\n\nCopyright (c)
189
+ 2013 Bryce Anderson. See LICENSE.txt for\nfurther details.\n\n"
208
190
  email: keeputahweird@gmail.com
209
191
  executables:
210
192
  - epubforge
@@ -213,92 +195,111 @@ extra_rdoc_files:
213
195
  - LICENSE.txt
214
196
  - README.rdoc
215
197
  files:
216
- - ./bin/epubforge
217
- - ./config/actions/forge.rb
218
- - ./config/actions/generate.rb
219
- - ./config/actions/generate_chapter.rb
220
- - ./config/actions/git_backup.rb
221
- - ./config/actions/gitify.rb
222
- - ./config/actions/globals.rb
223
- - ./config/actions/help.rb
224
- - ./config/actions/init.rb
225
- - ./config/actions/kindle.rb
226
- - ./config/actions/local_action.rb
227
- - ./config/actions/mobify.rb
228
- - ./config/actions/notes_to_epub.rb
229
- - ./config/actions/notes_to_kindle.rb
230
- - ./config/actions/spell.rb
231
- - ./config/actions/version.rb
232
- - ./config/actions/word_count.rb
233
- - ./config/actions/wrap_scene_notes_in_hidden_div.rb
234
- - ./config/htmlizers.rb
235
- - ./lib/action/actions_lookup.rb
236
- - ./lib/action/cli_command.rb
237
- - ./lib/action/cli_sequence.rb
238
- - ./lib/action/file_transformer.rb
239
- - ./lib/action/hooks_interface.rb
240
- - ./lib/action/run_description.rb
241
- - ./lib/action/runner.rb
242
- - ./lib/action/thor_action.rb
243
- - ./lib/core_extensions/array.rb
244
- - ./lib/core_extensions/kernel.rb
245
- - ./lib/core_extensions/nil_class.rb
246
- - ./lib/core_extensions/object.rb
247
- - ./lib/core_extensions/string.rb
248
- - ./lib/custom_helpers.rb
249
- - ./lib/epub/assets/asset.rb
250
- - ./lib/epub/assets/font.rb
251
- - ./lib/epub/assets/html.rb
252
- - ./lib/epub/assets/image.rb
253
- - ./lib/epub/assets/markdown.rb
254
- - ./lib/epub/assets/page.rb
255
- - ./lib/epub/assets/stylesheet.rb
256
- - ./lib/epub/assets/textile.rb
257
- - ./lib/epub/assets/xhtml.rb
258
- - ./lib/epub/builder.rb
259
- - ./lib/epub/packager.rb
260
- - ./lib/epubforge.rb
261
- - ./lib/errors.rb
262
- - ./lib/project/project.rb
263
- - ./lib/utils/action_loader.rb
264
- - ./lib/utils/class_loader.rb
265
- - ./lib/utils/directory_builder.rb
266
- - ./lib/utils/downloader.rb
267
- - ./lib/utils/file_orderer.rb
268
- - ./lib/utils/file_path.rb
269
- - ./lib/utils/html_translator.rb
270
- - ./lib/utils/html_translator_queue.rb
271
- - ./lib/utils/htmlizer.rb
272
- - ./lib/utils/misc.rb
273
- - ./lib/utils/root_path.rb
274
- - ./lib/utils/settings.rb
275
- - ./lib/utils/template_evaluator.rb
276
- - ./templates/default/book/afterword.markdown.template
277
- - ./templates/default/book/chapter-%i%.markdown.sequence
278
- - ./templates/default/book/cover.xhtml.template
279
- - ./templates/default/book/foreword.markdown.template
280
- - ./templates/default/book/images/cover.png
281
- - ./templates/default/book/stylesheets/stylesheet.css.template
282
- - ./templates/default/book/title_page.markdown.template
283
- - ./templates/default/notes/character.named.markdown.template
284
- - ./templates/default/notes/images/cover.png
285
- - ./templates/default/notes/stylesheets/stylesheet.css.template
286
- - ./templates/default/payload.rb
287
- - ./templates/default/settings/actions/local_action.rb.example
288
- - ./templates/default/settings/config.rb.form
289
- - ./templates/default/settings/htmlizers.rb
290
- - ./templates/default/settings/wordcount.template
291
- - ./test/helper.rb
292
- - ./test/misc/config.rb
293
- - ./test/sample_text/sample.markdown
294
- - ./test/sample_text/sample.textile
295
- - ./test/test_custom_helpers.rb
296
- - ./test/test_directory_builder.rb
297
- - ./test/test_epf_root.rb
298
- - ./test/test_epubforge.rb
299
- - ./test/test_htmlizers.rb
300
- - ./test/test_runner.rb
301
- - ./test/test_utils.rb
198
+ - "./bin/epubforge"
199
+ - "./config/actions/epub.rb"
200
+ - "./config/actions/forge.rb"
201
+ - "./config/actions/git.rb"
202
+ - "./config/actions/help.rb"
203
+ - "./config/actions/html.rb"
204
+ - "./config/actions/mobi.rb"
205
+ - "./config/actions/new.rb"
206
+ - "./config/actions/word_count.rb"
207
+ - "./config/actions_to_ignore/generate.rb"
208
+ - "./config/actions_to_ignore/generate_chapter.rb"
209
+ - "./config/actions_to_ignore/git_backup.rb"
210
+ - "./config/actions_to_ignore/globals.rb"
211
+ - "./config/actions_to_ignore/kindle.rb"
212
+ - "./config/actions_to_ignore/local_action.rb"
213
+ - "./config/actions_to_ignore/mobify.rb"
214
+ - "./config/actions_to_ignore/notes_to_epub.rb"
215
+ - "./config/actions_to_ignore/notes_to_kindle.rb"
216
+ - "./config/actions_to_ignore/spell.rb"
217
+ - "./config/actions_to_ignore/version.rb"
218
+ - "./config/actions_to_ignore/wrap_scene_notes_in_hidden_div.rb"
219
+ - "./config/converters/epub_to_mobi.calibre.rb"
220
+ - "./config/converters/epub_to_mobi.kindlegen.rb"
221
+ - "./config/html_translators/default_kramdown.html_translator.rb"
222
+ - "./config/html_translators/default_markdown.html_translator.rb"
223
+ - "./config/html_translators/default_markdown_pandoc.html_translator.rb"
224
+ - "./config/html_translators/default_textile_pandoc.html_translator.rb"
225
+ - "./config/html_translators/default_xhtml.html_translator.rb"
226
+ - "./config/html_translators/fallback_html.html_translator.rb"
227
+ - "./config/html_translators/fallback_markdown.html_translator.rb"
228
+ - "./config/html_translators/fallback_textile.html_translator.rb"
229
+ - "./config/html_translators/fallback_txt.html_translator.rb"
230
+ - "./config/html_translators/fallback_unknown.html_translator.rb"
231
+ - "./lib/epubforge.rb"
232
+ - "./lib/epubforge/action/action.rb"
233
+ - "./lib/epubforge/action/action2.rb"
234
+ - "./lib/epubforge/action/action_definition.rb"
235
+ - "./lib/epubforge/action/actions_lookup.rb"
236
+ - "./lib/epubforge/action/chatterbox.rb"
237
+ - "./lib/epubforge/action/cli_command.rb"
238
+ - "./lib/epubforge/action/cli_sequence.rb"
239
+ - "./lib/epubforge/action/file_transformer.rb"
240
+ - "./lib/epubforge/action/hooks_interface.rb"
241
+ - "./lib/epubforge/action/run_description.rb"
242
+ - "./lib/epubforge/action/runner.rb"
243
+ - "./lib/epubforge/builder/assets/asset.rb"
244
+ - "./lib/epubforge/builder/assets/font.rb"
245
+ - "./lib/epubforge/builder/assets/html.rb"
246
+ - "./lib/epubforge/builder/assets/image.rb"
247
+ - "./lib/epubforge/builder/assets/markdown.rb"
248
+ - "./lib/epubforge/builder/assets/page.rb"
249
+ - "./lib/epubforge/builder/assets/stylesheet.rb"
250
+ - "./lib/epubforge/builder/assets/textile.rb"
251
+ - "./lib/epubforge/builder/assets/xhtml.rb"
252
+ - "./lib/epubforge/builder/builder.rb"
253
+ - "./lib/epubforge/builder/epub.rb"
254
+ - "./lib/epubforge/builder/html.rb"
255
+ - "./lib/epubforge/builder/packager.rb"
256
+ - "./lib/epubforge/core_extensions/array.rb"
257
+ - "./lib/epubforge/core_extensions/kernel.rb"
258
+ - "./lib/epubforge/core_extensions/nil_class.rb"
259
+ - "./lib/epubforge/core_extensions/object.rb"
260
+ - "./lib/epubforge/core_extensions/string.rb"
261
+ - "./lib/epubforge/custom_helpers.rb"
262
+ - "./lib/epubforge/exceptions/errors.rb"
263
+ - "./lib/epubforge/project/project.rb"
264
+ - "./lib/epubforge/utils/action_loader.rb"
265
+ - "./lib/epubforge/utils/class_loader.rb"
266
+ - "./lib/epubforge/utils/converter.rb"
267
+ - "./lib/epubforge/utils/downloader.rb"
268
+ - "./lib/epubforge/utils/file_orderer.rb"
269
+ - "./lib/epubforge/utils/file_path.rb"
270
+ - "./lib/epubforge/utils/html_translator.rb"
271
+ - "./lib/epubforge/utils/html_translator_queue.rb"
272
+ - "./lib/epubforge/utils/htmlizer.rb"
273
+ - "./lib/epubforge/utils/misc.rb"
274
+ - "./lib/epubforge/utils/root_path.rb"
275
+ - "./lib/epubforge/utils/settings.rb"
276
+ - "./lib/epubforge/utils/template_evaluator.rb"
277
+ - "./templates/project/book/afterword.markdown"
278
+ - "./templates/project/book/chapter-%0000chapter%.markdown.template"
279
+ - "./templates/project/book/cover.xhtml.template"
280
+ - "./templates/project/book/foreword.markdown"
281
+ - "./templates/project/book/images/cover.png"
282
+ - "./templates/project/book/stylesheets/stylesheet.css"
283
+ - "./templates/project/book/title_page.markdown.template"
284
+ - "./templates/project/notes/character.%character.name_for_file%.markdown.template"
285
+ - "./templates/project/notes/images/cover.png"
286
+ - "./templates/project/notes/stylesheets/stylesheet.css"
287
+ - "./templates/project/settings/actions/local_action.rb.example"
288
+ - "./templates/project/settings/config.rb.template"
289
+ - "./templates/project/settings/html_translators/example_translator.rb"
290
+ - "./templates/project/settings/wordcount.template"
291
+ - "./test/answers01.yml"
292
+ - "./test/helper.rb"
293
+ - "./test/misc/config.rb"
294
+ - "./test/sample_text/sample.markdown"
295
+ - "./test/sample_text/sample.textile"
296
+ - "./test/test_custom_helpers.rb"
297
+ - "./test/test_epf_root.rb"
298
+ - "./test/test_epubforge.rb"
299
+ - "./test/test_html_translators.rb"
300
+ - "./test/test_runner.rb"
301
+ - "./test/test_template_evaluator.rb"
302
+ - "./test/test_utils.rb"
302
303
  - Gemfile
303
304
  - LICENSE.txt
304
305
  - README.rdoc
@@ -308,30 +309,26 @@ files:
308
309
  homepage: http://github.com/darth_schmoo/epubforge
309
310
  licenses:
310
311
  - MIT
312
+ metadata: {}
311
313
  post_install_message:
312
314
  rdoc_options: []
313
315
  require_paths:
314
316
  - lib
315
317
  required_ruby_version: !ruby/object:Gem::Requirement
316
- none: false
317
318
  requirements:
318
- - - ! '>='
319
+ - - ">="
319
320
  - !ruby/object:Gem::Version
320
321
  version: '0'
321
- segments:
322
- - 0
323
- hash: -427571737354431550
324
322
  required_rubygems_version: !ruby/object:Gem::Requirement
325
- none: false
326
323
  requirements:
327
- - - ! '>='
324
+ - - ">="
328
325
  - !ruby/object:Gem::Version
329
326
  version: '0'
330
327
  requirements: []
331
328
  rubyforge_project:
332
- rubygems_version: 1.8.25
329
+ rubygems_version: 2.2.2
333
330
  signing_key:
334
- specification_version: 3
331
+ specification_version: 4
335
332
  summary: Write your book in markdown, then do all sorts of increasingly nifty things
336
333
  with it.
337
334
  test_files: []