dokkit 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +125 -0
  3. data/README.txt +53 -0
  4. data/Rakefile +25 -167
  5. data/bin/dokkit +4 -60
  6. data/lib/dokkit/app.rb +63 -192
  7. data/lib/dokkit/builtintask.rb +85 -0
  8. data/lib/dokkit/cachemanager.rb +61 -0
  9. data/lib/dokkit/cleantask.rb +51 -0
  10. data/lib/dokkit/consolelog.rb +42 -0
  11. data/lib/dokkit/defaults.rb +19 -0
  12. data/lib/dokkit/document.rb +221 -0
  13. data/lib/dokkit/dokkitlib.rb +68 -0
  14. data/lib/dokkit/extension/extension.rb +15 -0
  15. data/lib/dokkit/extension/filehelper.rb +25 -0
  16. data/lib/dokkit/fileselection.rb +44 -0
  17. data/lib/dokkit/filters/all.rb +18 -0
  18. data/lib/dokkit/filters/base.rb +18 -0
  19. data/lib/dokkit/filters/deplate.rb +21 -25
  20. data/lib/dokkit/filters/maruku.rb +23 -0
  21. data/lib/dokkit/filters/nil.rb +23 -0
  22. data/lib/dokkit/filters.rb +29 -21
  23. data/lib/dokkit/logger.rb +73 -0
  24. data/lib/dokkit/model.rb +34 -0
  25. data/lib/dokkit/models/{Rakefile.tpl → simpledocument/model/Rakefile} +15 -2
  26. data/lib/dokkit/models/simpledocument/model/doc/configs/simpledocument.yaml +3 -0
  27. data/lib/dokkit/models/simpledocument/model/doc/layouts/simpledocument.html +9 -0
  28. data/lib/dokkit/models/simpledocument/model/doc/layouts/simpledocument.latex +8 -0
  29. data/lib/dokkit/models/simpledocument/model/doc/layouts/simpledocument.text +1 -0
  30. data/lib/dokkit/models/simpledocument/model/doc/pages/simpledocument.deplate +102 -0
  31. data/lib/dokkit/models/simpledocument/model/tasks/all.rb +3 -0
  32. data/lib/dokkit/models/simpledocument/model/tasks/clean.rake +3 -0
  33. data/lib/dokkit/models/simpledocument/model/tasks/render.rake +8 -0
  34. data/lib/dokkit/models/simpledocument/model/tasks/setup.rb +9 -0
  35. data/lib/dokkit/modeltask.rb +83 -0
  36. data/lib/dokkit/pathhelper.rb +46 -0
  37. data/lib/dokkit/recursivemerge.rb +59 -0
  38. data/lib/dokkit/rendertask.rb +101 -0
  39. data/lib/dokkit/resourcemanager.rb +177 -0
  40. data/lib/dokkit/taskconfig.rb +39 -0
  41. data/lib/dokkit/templatetask.rb +37 -0
  42. data/lib/dokkit.rb +2 -8
  43. data/spec/app_spec.rb +55 -0
  44. data/spec/builtintask_spec.rb +114 -0
  45. data/spec/cachemanager_spec.rb +107 -0
  46. data/spec/cleantask_spec.rb +72 -0
  47. data/spec/consolelog_spec.rb +69 -0
  48. data/{tests/data/projects/simple-document → spec/data/test_build}/Rakefile +8 -8
  49. data/spec/data/test_build/doc/configs/document_1.yaml +3 -0
  50. data/spec/data/test_build/doc/configs/required.yaml +3 -0
  51. data/spec/data/test_build/doc/configs/subdir/document_4.yaml +3 -0
  52. data/spec/data/test_build/doc/layouts/document_1.html +9 -0
  53. data/spec/data/test_build/doc/layouts/document_1.latex +8 -0
  54. data/spec/data/test_build/doc/layouts/document_with_partials.html +9 -0
  55. data/spec/data/test_build/doc/layouts/layout +0 -0
  56. data/spec/data/test_build/doc/layouts/layout.html +8 -0
  57. data/spec/data/test_build/doc/layouts/layout.html.backup +8 -0
  58. data/spec/data/test_build/doc/layouts/nested.html +3 -0
  59. data/spec/data/test_build/doc/layouts/partials/partial.html +4 -0
  60. data/spec/data/test_build/doc/pages/COMMON.yaml +6 -0
  61. data/spec/data/test_build/doc/pages/document_1 +20 -0
  62. data/spec/data/test_build/doc/pages/document_1.dep +4 -0
  63. data/spec/data/test_build/doc/pages/document_1.yaml +11 -0
  64. data/spec/data/test_build/doc/pages/document_2 +9 -0
  65. data/spec/data/test_build/doc/pages/document_2.dep +0 -0
  66. data/spec/data/test_build/doc/pages/document_2.yaml +6 -0
  67. data/spec/data/test_build/doc/pages/document_3 +13 -0
  68. data/spec/data/test_build/doc/pages/document_5.exclude +0 -0
  69. data/spec/data/test_build/doc/pages/document_7 +4 -0
  70. data/spec/data/test_build/doc/pages/document_7.yaml +5 -0
  71. data/spec/data/test_build/doc/pages/document_extended +1 -0
  72. data/spec/data/test_build/doc/pages/document_nested +6 -0
  73. data/spec/data/test_build/doc/pages/document_nested.yaml +5 -0
  74. data/spec/data/test_build/doc/pages/document_nolayout.ext +3 -0
  75. data/spec/data/test_build/doc/pages/document_nolayout.yaml +2 -0
  76. data/spec/data/test_build/doc/pages/document_with_partials +3 -0
  77. data/spec/data/test_build/doc/pages/document_with_partials.yaml +2 -0
  78. data/spec/data/test_build/doc/pages/partials/COMMON.yaml +5 -0
  79. data/spec/data/test_build/doc/pages/partials/circular_partial +2 -0
  80. data/spec/data/test_build/doc/pages/partials/circular_partial.yaml +3 -0
  81. data/spec/data/test_build/doc/pages/partials/partial +2 -0
  82. data/spec/data/test_build/doc/pages/subdir/COMMON.yaml +2 -0
  83. data/spec/data/test_build/doc/pages/subdir/document_4 +11 -0
  84. data/spec/data/test_build/doc/pages/subdir/subdir/COMMON.yaml +2 -0
  85. data/spec/data/test_build/doc/pages/subdir/subdir/document_6 +3 -0
  86. data/spec/data/test_build/tasks/all.rb +3 -0
  87. data/spec/data/test_build/tasks/clean.rake +3 -0
  88. data/spec/data/test_build/tasks/render.rake +8 -0
  89. data/spec/data/test_build/tasks/setup.rb +9 -0
  90. data/spec/data/test_build/tasks/template.rake +3 -0
  91. data/spec/data/test_build/templates/layouts/layout +0 -0
  92. data/spec/data/test_build/templates/pages/template +0 -0
  93. data/spec/document_spec.rb +321 -0
  94. data/spec/dokkitlib_spec.rb +63 -0
  95. data/spec/filehelper_spec.rb +34 -0
  96. data/spec/fileselection_spec.rb +101 -0
  97. data/spec/filter_base_spec.rb +29 -0
  98. data/spec/filter_deplate_spec.rb +48 -0
  99. data/spec/filter_maruku_spec.rb +29 -0
  100. data/spec/filter_nil_spec.rb +30 -0
  101. data/spec/filters_spec.rb +37 -0
  102. data/spec/logger_spec.rb +150 -0
  103. data/spec/model_spec.rb +45 -0
  104. data/spec/pathhelper_spec.rb +62 -0
  105. data/spec/recursivemerge_spec.rb +91 -0
  106. data/spec/rendertask_spec.rb +374 -0
  107. data/spec/spec_helper.rb +61 -0
  108. data/spec/taskconfig_spec.rb +45 -0
  109. data/spec/templatetask_spec.rb +72 -0
  110. data/tasks/annotations.rake +30 -0
  111. data/tasks/doc.rake +49 -0
  112. data/tasks/gem.rake +89 -0
  113. data/tasks/manifest.rake +41 -0
  114. data/tasks/rubyforge.rake +57 -0
  115. data/tasks/setup.rb +151 -0
  116. data/tasks/spec.rake +40 -0
  117. data/tasks/svn.rake +44 -0
  118. data/tasks/test.rake +40 -0
  119. metadata +188 -161
  120. data/CHANGES +0 -26
  121. data/LICENSE +0 -674
  122. data/README +0 -32
  123. data/lib/dokkit/#render_task_factory.rb# +0 -94
  124. data/lib/dokkit/dokkittasks.rb +0 -99
  125. data/lib/dokkit/hash.rb +0 -41
  126. data/lib/dokkit/models/share/builtin.rf +0 -28
  127. data/lib/dokkit/page.rb +0 -195
  128. data/lib/dokkit/render_task_factory.rb +0 -91
  129. data/tests/data/output/simple_document/README +0 -57
  130. data/tests/data/output/simple_document/Rakefile +0 -7
  131. data/tests/data/output/simple_document/doc/config/simple_document.yaml +0 -5
  132. data/tests/data/output/simple_document/doc/pages/simple_document.dpl +0 -12
  133. data/tests/data/output/website_project/README +0 -49
  134. data/tests/data/output/website_project/Rakefile +0 -82
  135. data/tests/data/output/website_project/doc/layouts/normal.thtml +0 -38
  136. data/tests/data/output/website_project/doc/pages/COMMON.rb +0 -9
  137. data/tests/data/output/website_project/doc/pages/deplate.dplhtml +0 -9
  138. data/tests/data/output/website_project/doc/pages/index.rb +0 -10
  139. data/tests/data/output/website_project/doc/pages/index.thtml +0 -12
  140. data/tests/data/output/website_project/doc/res/images/rote-tiny.png +0 -0
  141. data/tests/data/projects/simple-document/README +0 -57
  142. data/tests/data/projects/simple-document/doc/config/author.yaml +0 -4
  143. data/tests/data/projects/simple-document/doc/config/model.yaml +0 -18
  144. data/tests/data/projects/simple-document/doc/config/simple_document.yaml +0 -6
  145. data/tests/data/projects/simple-document/doc/layouts/another_simple_document.html +0 -8
  146. data/tests/data/projects/simple-document/doc/layouts/another_simple_document.tex +0 -10
  147. data/tests/data/projects/simple-document/doc/layouts/layout_with_custom_name.html +0 -8
  148. data/tests/data/projects/simple-document/doc/layouts/semantic.cache +0 -23
  149. data/tests/data/projects/simple-document/doc/pages/COMMON.yaml +0 -23
  150. data/tests/data/projects/simple-document/doc/pages/another_simple_document.dpl +0 -12
  151. data/tests/data/projects/simple-document/doc/pages/simple_document.dpl +0 -12
  152. data/tests/data/projects/simple-document/doc/pages/simple_document_without_layout.dpl +0 -12
  153. data/tests/data/projects/simple-document/doc/pages/subdir/COMMON.yaml +0 -4
  154. data/tests/data/projects/simple-document/doc/pages/subdir/simple_document_in_subdir.dpl +0 -12
  155. data/tests/data/projects/simple-document/doc/pages/subdir/simple_document_in_subdir.yaml +0 -3
  156. data/tests/data/projects/simple-document/doc/pages/subdir/subdir/COMMON.yaml +0 -2
  157. data/tests/data/projects/simple-document/doc/pages/subdir/subdir/another_simple_document_in_subdir.dpl +0 -12
  158. data/tests/data/projects/simple-document/doc/pages/yet_another_simple_document.dpl +0 -12
  159. data/tests/data/projects/simple-document/doc/pages/yet_another_simple_document.yaml +0 -8
  160. data/tests/gem_tests.rb +0 -4
  161. data/tests/spec_page.rb +0 -25
  162. data/tests/test.rb +0 -2
  163. data/tests/test_application.rb +0 -40
  164. data/tests/test_builtin_tasks.rb +0 -37
  165. data/tests/test_config.rb +0 -108
  166. data/tests/test_core.rb +0 -12
  167. data/tests/test_dokkit_commandline.rb +0 -18
  168. data/tests/test_exception.rb +0 -7
  169. data/tests/test_filters.rb +0 -46
  170. data/tests/test_layout.rb +0 -64
  171. data/tests/test_options.rb +0 -33
  172. data/tests/test_project_tasks.rb +0 -48
  173. data/tests/test_recursive_merge.rb +0 -42
  174. data/tests/test_task_factory.rb +0 -38
  175. /data/{CONTRIBUTORS → lib/dokkit/models/simpledocument/model/doc/data/css/style.css} +0 -0
  176. /data/{DONE → spec/data/test_build/doc/data/resource} +0 -0
  177. /data/{TODO → spec/data/test_build/doc/data/resource.exclude} +0 -0
  178. /data/{tests/pages/test.dpltex → spec/data/test_build/doc/data/subdir/resource.insubdir} +0 -0
data/tests/test_config.rb DELETED
@@ -1,108 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'dokkit'
4
- require 'dokkit/app'
5
- require 'dokkit/page'
6
- require 'rake'
7
-
8
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
9
-
10
- class TestConfig < Test::Unit::TestCase
11
- PROJECT_DIR = File.join(Dokkit.tests_dir, 'data/projects/simple-document/')
12
- def setup
13
- Dir.chdir PROJECT_DIR
14
- @simple_document = Rote::Page.new(
15
- {
16
- :fn => 'simple_document.dpl',
17
- :pages_dir => 'doc/pages',
18
- :layout_dir => 'doc/layouts',
19
- :config_dir => 'doc/config',
20
- :layout_defext => '.html',
21
- :template_defext => '.dpl'
22
- }
23
- )
24
-
25
- @simple_document_in_subdir = Rote::Page.new(
26
- {
27
- :fn => 'subdir/simple_document_in_subdir.dpl',
28
- :pages_dir => 'doc/pages',
29
- :layout_dir => 'doc/layouts',
30
- :config_dir => 'doc/config',
31
- :layout_defext => '.html',
32
- :template_defext => '.dpl'
33
- }
34
- )
35
-
36
- @another_simple_document_in_subdir = Rote::Page.new(
37
- {
38
- :fn => 'subdir/subdir/another_simple_document_in_subdir.dpl',
39
- :pages_dir => 'doc/pages',
40
- :layout_dir => 'doc/layouts',
41
- :config_dir => 'doc/config',
42
- :layout_defext => '.html',
43
- :template_defext => '.dpl'
44
- }
45
- )
46
-
47
- @another_simple_document = Rote::Page.new(
48
- {
49
- :fn => 'another_simple_document.dpl',
50
- :pages_dir => 'doc/pages',
51
- :layout_dir => 'doc/layouts',
52
- :config_dir => 'doc/config',
53
- :layout_defext => '.html',
54
- :template_defext => '.dpl'
55
- }
56
- )
57
- @yet_another_simple_document = Rote::Page.new(
58
- {
59
- :fn => 'yet_another_simple_document.dpl',
60
- :pages_dir => 'doc/pages',
61
- :layout_dir => 'doc/layouts',
62
- :config_dir => 'doc/config',
63
- :layout_defext => '.html',
64
- :template_defext => '.dpl'
65
- }
66
- )
67
- end
68
- def test_model_key
69
- assert @simple_document.instance_eval { @config['model'] }
70
- end
71
- def test_model_name_key
72
- assert @simple_document.instance_eval { @config['model']['name'] }
73
- end
74
- def test_model_version_key
75
- assert @simple_document.instance_eval { @config['model']['version'] }
76
- end
77
- def test_simple_document_default_config
78
- assert_equal('A simple document', @simple_document.instance_eval { @config['document']['title'] })
79
- end
80
- def test_simple_document_common
81
- assert_nil @simple_document.instance_eval { @config['document']['author']['name'] }
82
- assert_equal('A common value for documents in pages dir', @simple_document.instance_eval { @config['document']['common_key'] })
83
- end
84
- def test_simple_document_in_subdir_config
85
- assert_equal('A simple document in a subdirectory', @simple_document_in_subdir.instance_eval { @config['document']['title'] })
86
- end
87
- def test_simple_document_in_subdir_common
88
- assert_equal('A simple document in a subdirectory', @simple_document_in_subdir.instance_eval { @config['document']['title'] })
89
- assert_equal('A common value for documents in subdir', @simple_document_in_subdir.instance_eval { @config['document']['common_key'] })
90
- assert_equal('John', @simple_document_in_subdir.instance_eval { @config['document']['author']['name'] })
91
- end
92
- def test_another_simple_document_in_subdir_common
93
- assert_equal('A simple document in a subdirectory', @another_simple_document_in_subdir.instance_eval { @config['document']['title'] })
94
- assert_equal('A common value for documents in subdir/subdir', @another_simple_document_in_subdir.instance_eval { @config['document']['common_key'] })
95
- assert_equal('John', @another_simple_document_in_subdir.instance_eval { @config['document']['author']['name'] })
96
- end
97
- def test_another_simple_document_layout
98
- assert_equal(['another_simple_document.html'], @another_simple_document.instance_eval { @layout_names })
99
- end
100
- def test_yet_another_simple_document_layout
101
- assert_equal(['yet_another_simple_document.html', 'layout_with_custom_name.html'], @yet_another_simple_document.instance_eval { @layout_names })
102
- end
103
- def test_yet_another_simple_document_common
104
- assert_equal('A simple document with layout with custom name', @yet_another_simple_document.instance_eval { @config['document']['title'] })
105
- assert_equal('John', @yet_another_simple_document.instance_eval { @config['document']['author']['name'] })
106
- assert_equal('john.doe@organization.org', @yet_another_simple_document.instance_eval { @config['document']['author']['email'] })
107
- end
108
- end
data/tests/test_core.rb DELETED
@@ -1,12 +0,0 @@
1
- begin
2
- require 'rubygems'
3
- rescue LoadError
4
- nil
5
- end
6
-
7
- # make sure we're testing this version, not an installed Gem!
8
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
9
-
10
- require 'tests/test_builtin_tasks.rb'
11
- require 'tests/test_dokkit_commandline.rb'
12
-
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'dokkit'
4
- require 'dokkit/app'
5
- require 'rake'
6
-
7
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
8
-
9
- class TestDirectoryOption < Test::Unit::TestCase
10
- def setup
11
- ARGV.clear
12
- ARGV.push('--directory','tests/data/projects/tech_report')
13
- end
14
- def test_directory_option
15
- Dokkit.application.load_rakefile
16
- assert_equal('doc', Dokkit.application['doc'].to_s)
17
- end
18
- end
@@ -1,7 +0,0 @@
1
- def test_exception
2
- raise "File doesn't exist" if !File.exists?('null')
3
- end
4
-
5
- # begin
6
- # test_exception
7
- # end
@@ -1,46 +0,0 @@
1
- begin
2
- require 'rubygems'
3
- rescue LoadError
4
- nil
5
- end
6
-
7
- # make sure we're testing this version, not an installed Gem!
8
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
9
-
10
- require 'test/unit'
11
- require 'rote/page'
12
- require 'dokkit/filters/deplate'
13
-
14
- DPLTEST = <<-EOM
15
- * Heading 1
16
- hic sunt leones
17
- - item 1
18
- - item 2
19
- EOM
20
-
21
- DPLTEXEXPECT = <<-EOM
22
-
23
- \\section{Heading 1}
24
- \\label{hd001}
25
- hic sunt leones
26
-
27
- \\begin{itemize}
28
- \\item item 1
29
- \\item item 2
30
- \\end{itemize}
31
- EOM
32
-
33
- module Dokkit
34
- class TestFilters < Test::Unit::TestCase
35
-
36
- ############## filters/deplate #################
37
- def test_render_tex
38
- t = Filters::Deplate.new.filter(DPLTEST, nil)
39
- assert_equal DPLTEXEXPECT, t
40
- end
41
-
42
- end
43
-
44
-
45
- end
46
-
data/tests/test_layout.rb DELETED
@@ -1,64 +0,0 @@
1
- #
2
- # File 'test_layout.rb' created on 15 ott 2007 at 13:24:26.
3
- # See 'dokkit.rb' or +LICENSE+ for licence information.
4
- #
5
- # (c)2006, 2007 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
6
- #
7
- # To execute this unit test run:
8
- #
9
- # ruby test/test_layout.rb
10
- #
11
-
12
- require 'rubygems'
13
- require 'test/unit'
14
- require 'dokkit'
15
- require 'dokkit/app'
16
- require 'dokkit/page'
17
-
18
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
19
-
20
- class TestLayout < Test::Unit::TestCase
21
- PROJECT_DIR = File.join(Dokkit.tests_dir, 'data/projects/simple_document/')
22
- def setup
23
- Dir.chdir PROJECT_DIR
24
- @simple_document = Rote::Page.new(
25
- {
26
- :fn => 'simple_document.dpl',
27
- :pages_dir => 'doc/pages',
28
- :layout_dir => 'doc/layouts',
29
- :config_dir => 'doc/config',
30
- :layout_defext => '.html',
31
- :template_defext => '.dpl'
32
- }
33
- )
34
- @simple_document_without_layout = Rote::Page.new(
35
- {
36
- :fn => 'simple_document_without_layout.dpl',
37
- :pages_dir => 'doc/pages',
38
- :layout_dir => 'doc/layouts',
39
- :config_dir => 'doc/config',
40
- :layout_defext => '.html',
41
- :template_defext => '.dpl'
42
- }
43
- )
44
- @another_simple_document = Rote::Page.new(
45
- {
46
- :fn => 'another_simple_document.dpl',
47
- :pages_dir => 'doc/pages',
48
- :layout_dir => 'doc/layouts',
49
- :config_dir => 'doc/config',
50
- :layout_defext => '.html',
51
- :template_defext => '.dpl'
52
- }
53
- )
54
- end
55
- def teardown
56
- end
57
- def test_default_layout
58
- assert_equal(['simple_document.html'], @simple_document.instance_eval { @layout_names })
59
- assert_equal(['simple_document.html'], @simple_document_without_layout.instance_eval { @layout_names })
60
- end
61
- def test_overrided_layout
62
- assert_equal(['another_simple_document.html'], @another_simple_document.instance_eval { @layout_names })
63
- end
64
- end
@@ -1,33 +0,0 @@
1
- begin
2
- require 'rubygems'
3
- rescue LoadError
4
- nil
5
- end
6
-
7
- # make sure we're testing this version, not an installed Gem!
8
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
9
-
10
- require 'test/unit'
11
- require 'dokkit'
12
- require 'dokkit/app'
13
- require 'rake'
14
-
15
- # set dokkit_lib path
16
- $:.each do |it|
17
- if File.exists?(File.join(it,'dokkit/builtin.rake'))
18
- DOKKIT_LIB = it
19
- break
20
- end
21
- end
22
-
23
- class TestOption < Test::Unit::TestCase
24
-
25
- def test_change_dir
26
- Dokkit::Application.new DOKKIT_LIB do |dokkit|
27
- dokkit.do_option('--directory','/home/andrea')
28
- dokkit.do_option('--tasks',nil)
29
- dokkit.run
30
- assert_equal('/home/andrea',Dir.pwd)
31
- end
32
- end
33
- end
@@ -1,48 +0,0 @@
1
- #
2
- # File 'test_project_tasks.rb' created on 09 ott 2007 at 17:04:01.
3
- # See 'dokkit.rb' or +LICENSE+ for licence information.
4
- #
5
- # (c)2006, 2007 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
6
- #
7
- # To execute this unit test run:
8
- #
9
- # ruby test/test_project_tasks.rb
10
- #
11
-
12
- require 'rubygems'
13
- require 'test/unit'
14
- require 'dokkit'
15
- require 'dokkit/app'
16
- require 'rake'
17
-
18
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
19
-
20
- class TestProjectTask < Test::Unit::TestCase
21
- PROJECT_DIR = File.join(Dokkit.tests_dir, 'data/projects')
22
- def setup
23
- end
24
- def teardown
25
- Dokkit.application.run ['--directory', File.join(PROJECT_DIR, 'simple-document'), 'clobber']
26
- end
27
- def test_default_render_task
28
- Dokkit.application.run ['--directory', File.join(PROJECT_DIR, 'simple-document')]
29
- File.open(File.join(PROJECT_DIR, 'simple-document/html/simple_document.html')) do |file|
30
- assert_equal('<html>', file.gets.chomp)
31
- end
32
- File.open(File.join(PROJECT_DIR, 'simple-document/html/another_simple_document.html')) do |file|
33
- assert_equal('<html> <!-- Custom layout for simple_document -->', file.gets.chomp)
34
- end
35
- File.open(File.join(PROJECT_DIR, 'simple-document/html/simple_document_without_layout.html')) do |file|
36
- assert_equal('<html>', file.gets.chomp)
37
- end
38
- end
39
- def test_render_tex_task
40
- Dokkit.application.run ['--directory', File.join(PROJECT_DIR, 'simple-document'), 'render_tex']
41
- File.open(File.join(PROJECT_DIR, 'simple-document/tex/simple_document.tex')) do |file|
42
- assert_match(/documentclass/, file.gets.chomp)
43
- end
44
- File.open(File.join(PROJECT_DIR, 'simple-document/tex/another_simple_document.tex')) do |file|
45
- assert_match(/documentclass.*% custom/, file.gets.chomp)
46
- end
47
- end
48
- end
@@ -1,42 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'dokkit'
4
- require 'dokkit/app'
5
- require 'dokkit/page'
6
- require 'dokkit/hash'
7
-
8
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
9
-
10
- class TestConfigMerge < Test::Unit::TestCase
11
- def setup
12
- @h1 = { :document => { :version => '0.1.0', :model => 'simple_document'} }
13
- @h2 = { :document => { :title => 'A simple document', :author => 'John Doe'} }
14
- @h3 = { :document => { :author => { :name => 'John', :surname => 'Doe'}, :layout => 'layout.html' } }
15
- @h4 = { :info => { :date => '13/09/2007'} }
16
- @h5 = { :document => 'overwritten' }
17
- @h6 = { :document => [1, 2, 3] }
18
- @h7 = { :document => [4, 5, 6] }
19
- @result_0 = { }.recursive_merge @h1
20
- @result_1 = @h1.recursive_merge @h2
21
- @result_2 = @result_1.recursive_merge @h3
22
- @result_3 = @result_2.recursive_merge @h4
23
- @result_4 = @result_3.recursive_merge( { :info => { :language => 'en' } } )
24
- @result_5 = @result_1.recursive_merge @h5
25
- @result_6 = @h6.recursive_merge @h7
26
- end
27
- def test_merge
28
- assert_equal('simple_document', @result_0[:document][:model])
29
- assert_equal('simple_document', @result_1[:document][:model])
30
- assert_equal('0.1.0', @result_1[:document][:version])
31
- assert_equal('A simple document', @result_1[:document][:title])
32
- assert_equal('John Doe', @result_1[:document][:author])
33
- assert_equal('John', @result_2[:document][:author][:name])
34
- assert_equal('Doe', @result_2[:document][:author][:surname])
35
- assert_equal('layout.html', @result_2[:document][:layout])
36
- assert_equal('13/09/2007', @result_3[:info][:date])
37
- assert_equal('Doe', @result_3[:document][:author][:surname])
38
- assert_equal('en', @result_4[:info][:language])
39
- assert_equal('overwritten', @result_5[:document])
40
- assert_equal([1, 2, 3, 4, 5, 6], @result_6[:document])
41
- end
42
- end
@@ -1,38 +0,0 @@
1
- #
2
- # File 'test_task_factory.rb' created on 18 Nov 2007 at 15:41:47.
3
- # See 'dokkit.rb' or +LICENSE+ for licence information.
4
- #
5
- # (c)2006, 2007 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
6
- #
7
- # To execute this unit test run:
8
- #
9
- # ruby test/test_task_factory.rb
10
- #
11
-
12
- require 'rubygems'
13
- require 'test/unit'
14
- require 'dokkit'
15
- require 'dokkit/app'
16
- require 'dokkit/render_task_factory'
17
-
18
- $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
19
-
20
- class TestTaskFactory < Test::Unit::TestCase
21
- def setup
22
- @render_task_factory = Dokkit::RenderTaskFactory.instance
23
- end
24
- def teardown
25
- end
26
- def test_task_create
27
- assert_not_nil(@render_task_factory.create_render_html)
28
- end
29
- def test_task_output_dir
30
- assert_not_nil(@render_task_factory.create_render_html.output_dir)
31
- end
32
- def test_task_customization
33
- render_html = @render_task_factory.create_render_html do |task|
34
- task.pages.exclude('**/*.inc')
35
- end
36
- assert(render_html.pages.excludes.include?('**/*.inc'))
37
- end
38
- end
File without changes