dokkit 0.3.0 → 0.4.0
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.
- data/History.txt +5 -0
- data/Manifest.txt +90 -105
- data/README.txt +27 -7
- data/Rakefile +2 -3
- data/bin/dokkit +3 -2
- data/lib/dokkit/application.rb +159 -0
- data/lib/dokkit/cache/cache.rb +53 -0
- data/lib/dokkit/{models/simpledocument/model/Rakefile → cache.rb} +3 -15
- data/lib/dokkit/environment/basic.rb +156 -0
- data/lib/dokkit/environment/helpers/extmap.rb +29 -0
- data/lib/dokkit/environment/helpers/fileselection.rb +53 -0
- data/lib/dokkit/environment/helpers.rb +20 -0
- data/{spec/data/test_build/Rakefile → lib/dokkit/environment.rb} +4 -15
- data/lib/dokkit/factory/factory.rb +56 -0
- data/lib/dokkit/factory.rb +9 -0
- data/lib/dokkit/filters/deplate.rb +25 -20
- data/lib/dokkit/filters/maruku.rb +6 -5
- data/lib/dokkit/filters/nil.rb +7 -6
- data/lib/dokkit/filters.rb +5 -27
- data/lib/dokkit/hash.rb +82 -0
- data/lib/dokkit/{logger.rb → logging/logger.rb} +30 -24
- data/lib/dokkit/logging/observers/console.rb +52 -0
- data/lib/dokkit/{extension/extension.rb → logging/observers.rb} +7 -5
- data/lib/dokkit/logging.rb +11 -0
- data/lib/dokkit/models/simple/Rakefile +6 -0
- data/lib/dokkit/models/simple/doc/data/html/css/style.css +3 -0
- data/lib/dokkit/models/simple/doc/data/latex/deplate.sty +46 -0
- data/lib/dokkit/models/simple/doc/layouts/simple.html +9 -0
- data/lib/dokkit/models/simple/doc/layouts/simple.latex +11 -0
- data/lib/dokkit/models/simple/doc/pages/simple.deplate +80 -0
- data/lib/dokkit/models/simple/setup/setup.rb +10 -0
- data/lib/dokkit/resource/data.rb +36 -0
- data/lib/dokkit/resource/document.rb +385 -0
- data/lib/dokkit/resource/extensions/builtin.rb +19 -0
- data/lib/dokkit/resource/extensions/html.rb +22 -0
- data/lib/dokkit/resource/extensions/url.rb +25 -0
- data/lib/dokkit/{filters/base.rb → resource/extensions.rb} +7 -8
- data/lib/dokkit/resource/filenamehelper.rb +28 -0
- data/lib/dokkit/resource.rb +11 -0
- data/lib/dokkit/tasklib/clean.rb +73 -0
- data/lib/dokkit/tasklib/render.rb +137 -0
- data/lib/dokkit/tasklib.rb +11 -0
- data/lib/dokkit.rb +26 -29
- data/spec/dokkit/application_spec.rb +141 -0
- data/spec/dokkit/cache/cache_spec.rb +87 -0
- data/spec/dokkit/dokkit_spec.rb +20 -0
- data/spec/dokkit/environment/basic_spec.rb +135 -0
- data/spec/dokkit/environment/helpers/extmap_spec.rb +52 -0
- data/spec/dokkit/environment/helpers/fileselection_spec.rb +80 -0
- data/spec/dokkit/environment/test_data/doc/pages/document_1.yaml +3 -0
- data/spec/dokkit/factory/factory_spec.rb +69 -0
- data/spec/{filter_deplate_spec.rb → dokkit/filters/deplate_spec.rb} +7 -8
- data/spec/{filter_maruku_spec.rb → dokkit/filters/maruku_spec.rb} +3 -4
- data/spec/{filter_nil_spec.rb → dokkit/filters/nil_spec.rb} +3 -4
- data/spec/{recursivemerge_spec.rb → dokkit/hash_spec.rb} +25 -27
- data/spec/{logger_spec.rb → dokkit/logging/logger_spec.rb} +35 -47
- data/spec/{consolelog_spec.rb → dokkit/logging/observers/console_spec.rb} +14 -15
- data/spec/dokkit/resource/data_spec.rb +32 -0
- data/spec/dokkit/resource/document_spec.rb +485 -0
- data/spec/dokkit/resource/extensions/html_spec.rb +35 -0
- data/spec/dokkit/resource/extensions/url_spec.rb +29 -0
- data/spec/{filehelper_spec.rb → dokkit/resource/filenamehelper_spec.rb} +12 -13
- data/spec/dokkit/resource/test_data/doc/configs/config_1.yaml +3 -0
- data/spec/dokkit/resource/test_data/doc/configs/config_2.yaml +3 -0
- data/spec/dokkit/resource/test_data/doc/configs/required.yaml +3 -0
- data/spec/dokkit/resource/test_data/doc/configs/subdir/document.yaml +3 -0
- data/spec/dokkit/resource/test_data/doc/layouts/container.html +6 -0
- data/spec/dokkit/resource/test_data/doc/layouts/layout.html +6 -0
- data/spec/{data/test_build/doc/layouts → dokkit/resource/test_data/doc/layouts/nested}/nested.html +2 -1
- data/spec/dokkit/resource/test_data/doc/layouts/subdir/document.html +6 -0
- data/spec/dokkit/resource/test_data/doc/pages/COMMON.yaml +4 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_config.ext +7 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_errors.ext +12 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_targets.ext +19 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_nested_layout.ext +13 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_nil_target.ext +5 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_not_defined_target.ext +6 -0
- data/spec/dokkit/resource/test_data/doc/pages/document_with_one_target.ext +8 -0
- data/spec/dokkit/resource/test_data/doc/pages/subdir/COMMON.yaml +3 -0
- data/spec/dokkit/resource/test_data/doc/pages/subdir/document.ext +8 -0
- data/spec/dokkit/resource/test_data/doc/pages/subdir/document.yaml +5 -0
- data/spec/dokkit/tasklib/clean_spec.rb +75 -0
- data/spec/dokkit/tasklib/render_spec.rb +125 -0
- data/spec/dokkit/tasklib/test_data/doc/pages/document_2 +0 -0
- data/spec/dokkit/test_data/dokkit/models/model1/doc/pages/model1 +0 -0
- data/spec/dokkit/test_data/dokkit/models/model2/doc/pages/model2 +0 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +120 -47
- metadata +94 -117
- data/lib/dokkit/app.rb +0 -131
- data/lib/dokkit/builtintask.rb +0 -85
- data/lib/dokkit/cachemanager.rb +0 -61
- data/lib/dokkit/cleantask.rb +0 -51
- data/lib/dokkit/consolelog.rb +0 -42
- data/lib/dokkit/defaults.rb +0 -19
- data/lib/dokkit/deplate/fmt/html-notemplate.rb +0 -21
- data/lib/dokkit/deplate/fmt/latex-notemplate.rb +0 -24
- data/lib/dokkit/document.rb +0 -221
- data/lib/dokkit/dokkitlib.rb +0 -68
- data/lib/dokkit/extension/filehelper.rb +0 -25
- data/lib/dokkit/fileselection.rb +0 -44
- data/lib/dokkit/filters/all.rb +0 -18
- data/lib/dokkit/model.rb +0 -34
- data/lib/dokkit/models/simpledocument/model/doc/layouts/simpledocument.html +0 -9
- data/lib/dokkit/models/simpledocument/model/doc/pages/simpledocument.deplate +0 -102
- data/lib/dokkit/models/simpledocument/model/tasks/all.rb +0 -3
- data/lib/dokkit/models/simpledocument/model/tasks/clean.rake +0 -3
- data/lib/dokkit/models/simpledocument/model/tasks/render.rake +0 -8
- data/lib/dokkit/models/simpledocument/model/tasks/setup.rb +0 -9
- data/lib/dokkit/modeltask.rb +0 -83
- data/lib/dokkit/pathhelper.rb +0 -46
- data/lib/dokkit/recursivemerge.rb +0 -59
- data/lib/dokkit/rendertask.rb +0 -101
- data/lib/dokkit/resourcemanager.rb +0 -177
- data/lib/dokkit/taskconfig.rb +0 -39
- data/lib/dokkit/templatetask.rb +0 -37
- data/spec/app_spec.rb +0 -55
- data/spec/builtintask_spec.rb +0 -114
- data/spec/cachemanager_spec.rb +0 -107
- data/spec/cleantask_spec.rb +0 -72
- data/spec/data/test_build/doc/configs/document_1.yaml +0 -3
- data/spec/data/test_build/doc/configs/required.yaml +0 -3
- data/spec/data/test_build/doc/configs/subdir/document_4.yaml +0 -3
- data/spec/data/test_build/doc/layouts/document_1.html +0 -9
- data/spec/data/test_build/doc/layouts/document_with_partials.html +0 -9
- data/spec/data/test_build/doc/layouts/layout.html +0 -8
- data/spec/data/test_build/doc/layouts/layout.html.backup +0 -8
- data/spec/data/test_build/doc/layouts/partials/partial.html +0 -4
- data/spec/data/test_build/doc/pages/COMMON.yaml +0 -6
- data/spec/data/test_build/doc/pages/document_1 +0 -20
- data/spec/data/test_build/doc/pages/document_1.dep +0 -4
- data/spec/data/test_build/doc/pages/document_1.yaml +0 -11
- data/spec/data/test_build/doc/pages/document_2 +0 -9
- data/spec/data/test_build/doc/pages/document_2.yaml +0 -6
- data/spec/data/test_build/doc/pages/document_3 +0 -13
- data/spec/data/test_build/doc/pages/document_7 +0 -4
- data/spec/data/test_build/doc/pages/document_7.yaml +0 -5
- data/spec/data/test_build/doc/pages/document_extended +0 -1
- data/spec/data/test_build/doc/pages/document_nested +0 -6
- data/spec/data/test_build/doc/pages/document_nested.yaml +0 -5
- data/spec/data/test_build/doc/pages/document_nolayout.ext +0 -3
- data/spec/data/test_build/doc/pages/document_nolayout.yaml +0 -2
- data/spec/data/test_build/doc/pages/document_with_partials +0 -3
- data/spec/data/test_build/doc/pages/document_with_partials.yaml +0 -2
- data/spec/data/test_build/doc/pages/partials/COMMON.yaml +0 -5
- data/spec/data/test_build/doc/pages/partials/circular_partial +0 -2
- data/spec/data/test_build/doc/pages/partials/circular_partial.yaml +0 -3
- data/spec/data/test_build/doc/pages/partials/partial +0 -2
- data/spec/data/test_build/doc/pages/subdir/COMMON.yaml +0 -2
- data/spec/data/test_build/doc/pages/subdir/document_4 +0 -11
- data/spec/data/test_build/doc/pages/subdir/subdir/COMMON.yaml +0 -2
- data/spec/data/test_build/doc/pages/subdir/subdir/document_6 +0 -3
- data/spec/data/test_build/tasks/all.rb +0 -3
- data/spec/data/test_build/tasks/clean.rake +0 -3
- data/spec/data/test_build/tasks/render.rake +0 -8
- data/spec/data/test_build/tasks/setup.rb +0 -9
- data/spec/data/test_build/tasks/template.rake +0 -3
- data/spec/document_spec.rb +0 -321
- data/spec/dokkitlib_spec.rb +0 -63
- data/spec/fileselection_spec.rb +0 -101
- data/spec/filter_base_spec.rb +0 -29
- data/spec/filters_spec.rb +0 -37
- data/spec/model_spec.rb +0 -45
- data/spec/pathhelper_spec.rb +0 -62
- data/spec/rendertask_spec.rb +0 -374
- data/spec/taskconfig_spec.rb +0 -45
- data/spec/templatetask_spec.rb +0 -72
- /data/lib/dokkit/models/{simpledocument/model/doc/configs/simpledocument.yaml → simple/doc/configs/simple.yaml} +0 -0
- /data/lib/dokkit/models/{simpledocument/model/doc/layouts/simpledocument.text → simple/doc/layouts/simple.text} +0 -0
- /data/{lib/dokkit/models/simpledocument/model/doc/data/css/style.css → spec/dokkit/environment/helpers/test_data/doc/pages/document_1.ext_1} +0 -0
- /data/spec/{data/test_build/doc/data/resource → dokkit/environment/helpers/test_data/doc/pages/document_2} +0 -0
- /data/spec/{data/test_build/doc/data/resource.exclude → dokkit/environment/helpers/test_data/doc/pages/document_3.ext_3} +0 -0
- /data/spec/{data/test_build/doc/data/subdir/resource.insubdir → dokkit/environment/test_data/doc/data/data} +0 -0
- /data/spec/{data/test_build/doc/layouts/layout → dokkit/environment/test_data/doc/pages/document_1} +0 -0
- /data/spec/{data/test_build/doc/pages/document_2.dep → dokkit/environment/test_data/doc/pages/document_2} +0 -0
- /data/spec/{data/test_build/doc/pages/document_5.exclude → dokkit/environment/test_data/doc/pages/subdir/document_1} +0 -0
- /data/{lib/dokkit/models/simpledocument/model/doc/layouts/simpledocument.latex → spec/dokkit/resource/test_data/doc/layouts/layout.latex} +0 -0
- /data/spec/{data/test_build/doc/layouts/document_1.latex → dokkit/resource/test_data/doc/layouts/subdir/document.latex} +0 -0
- /data/spec/{data/test_build/templates/layouts/layout → dokkit/tasklib/test_data/doc/data/data_1} +0 -0
- /data/spec/{data/test_build/templates/pages/template → dokkit/tasklib/test_data/doc/pages/document_1} +0 -0
data/spec/rendertask_spec.rb
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'rendertask_spec.rb' created on 18 feb 2008 at 19:55:16.
|
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
|
4
|
-
#
|
|
5
|
-
# (c)2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
|
6
|
-
#
|
|
7
|
-
# To execute this spec run:
|
|
8
|
-
#
|
|
9
|
-
# spec spec/rendertask_spec.rb
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'../lib')))
|
|
14
|
-
|
|
15
|
-
require 'rubygems'
|
|
16
|
-
require 'spec'
|
|
17
|
-
require 'dokkit/cachemanager'
|
|
18
|
-
require 'dokkit/rendertask'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe 'a non configured RenderTask instance', :shared => true do
|
|
22
|
-
include SpecPathHelper
|
|
23
|
-
before(:all) do
|
|
24
|
-
@initial_dir = Dir.pwd
|
|
25
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
26
|
-
end
|
|
27
|
-
before do
|
|
28
|
-
model = mock('model')
|
|
29
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
30
|
-
@rendertask = Dokkit::RenderTask.new(model)
|
|
31
|
-
end
|
|
32
|
-
after do
|
|
33
|
-
rm_rf output_path
|
|
34
|
-
rm_rf cache_path
|
|
35
|
-
Rake.application = nil
|
|
36
|
-
end
|
|
37
|
-
after(:all) do
|
|
38
|
-
Dir.chdir(@initial_dir)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe 'a configured RenderTask instance', :shared => true do
|
|
43
|
-
include SpecPathHelper
|
|
44
|
-
before(:all) do
|
|
45
|
-
@initial_dir = Dir.pwd
|
|
46
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
47
|
-
end
|
|
48
|
-
before do
|
|
49
|
-
model = mock('model')
|
|
50
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
51
|
-
@cache = Dokkit::CacheManager.instance
|
|
52
|
-
@cache.init('deps.yaml', cache_path)
|
|
53
|
-
@rendertask = Dokkit::RenderTask.new(model, 'render') do |task|
|
|
54
|
-
task.config.output_dir = output_path
|
|
55
|
-
task.config.config_dir = config_path
|
|
56
|
-
task.config.layout_dir = layout_path
|
|
57
|
-
task.documents.dir = document_path
|
|
58
|
-
task.documents.include('**/*')
|
|
59
|
-
task.documents.exclude('*_extended', '**/*.exclude', '**/*.yaml', '**/*.dep', '**/*partial*')
|
|
60
|
-
task.data.dir = data_path
|
|
61
|
-
task.data.include('**/*')
|
|
62
|
-
task.data.exclude('**/*.exclude')
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
after do
|
|
66
|
-
rm_rf output_path
|
|
67
|
-
@cache.clean
|
|
68
|
-
Rake.application = nil
|
|
69
|
-
end
|
|
70
|
-
after(:all) do
|
|
71
|
-
Dir.chdir(@initial_dir)
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
describe 'a RenderTask instance initialized with a configuration hash and a block', :shared => true do
|
|
76
|
-
include SpecPathHelper
|
|
77
|
-
before(:all) do
|
|
78
|
-
@initial_dir = Dir.pwd
|
|
79
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
80
|
-
end
|
|
81
|
-
before do
|
|
82
|
-
@config = mock('config')
|
|
83
|
-
@config.should_receive(:document_dir).at_least(1).and_return(document_path + '/subdir')
|
|
84
|
-
@config.should_receive(:config_dir).at_least(1).and_return(config_path)
|
|
85
|
-
@config.should_receive(:layout_dir).at_least(1).and_return(layout_path)
|
|
86
|
-
@config.should_receive(:data_dir).at_least(1).and_return(data_path + '/subdir')
|
|
87
|
-
@config.should_receive(:output_dir).at_least(1).and_return(output_path)
|
|
88
|
-
@config.should_receive(:cache_dir).at_least(1).and_return(cache_path)
|
|
89
|
-
@config.should_receive(:directories).twice.and_return({
|
|
90
|
-
:document_dir => @config.document_dir,
|
|
91
|
-
:config_dir => @config.config_dir,
|
|
92
|
-
:layout_dir => @config.layout_dir,
|
|
93
|
-
:data_dir => @config.data_dir,
|
|
94
|
-
:output_dir => @config.output_dir,
|
|
95
|
-
:cache_dir => @config.cache_dir
|
|
96
|
-
})
|
|
97
|
-
model = mock('model')
|
|
98
|
-
model.should_receive(:config).and_return(@config)
|
|
99
|
-
@rendertask = Dokkit::RenderTask.new(model, 'render') do |task|
|
|
100
|
-
task.documents.include('*')
|
|
101
|
-
task.data.include('*')
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
after do
|
|
105
|
-
rm_rf output_path
|
|
106
|
-
rm_rf cache_path
|
|
107
|
-
Rake.application = nil
|
|
108
|
-
end
|
|
109
|
-
after(:all) do
|
|
110
|
-
Dir.chdir(@initial_dir)
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
describe 'a configured RenderTask instance with an extension block', :shared => true do
|
|
115
|
-
include SpecPathHelper
|
|
116
|
-
before(:all) do
|
|
117
|
-
@initial_dir = Dir.pwd
|
|
118
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
119
|
-
end
|
|
120
|
-
before do
|
|
121
|
-
module Extension
|
|
122
|
-
def extension
|
|
123
|
-
"Extension"
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
model = mock('model')
|
|
127
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
128
|
-
@rendertask = Dokkit::RenderTask.new(model, 'render') do |task|
|
|
129
|
-
task.config.output_dir = output_path
|
|
130
|
-
task.config.config_dir = config_path
|
|
131
|
-
task.config.layout_dir = layout_path
|
|
132
|
-
task.config.document_dir = document_path
|
|
133
|
-
task.config.data_dir = data_path
|
|
134
|
-
task.documents.include('**/*')
|
|
135
|
-
task.documents.exclude('**/*.exclude', '**/*.yaml', '**/*.dep')
|
|
136
|
-
task.data.include('**/*')
|
|
137
|
-
task.data.exclude('**/*.exclude')
|
|
138
|
-
task.documents.extend(/document_extended$/) { |document| document.extend Extension }
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
after do
|
|
142
|
-
rm_rf output_path
|
|
143
|
-
rm_rf cache_path
|
|
144
|
-
Rake.application = nil
|
|
145
|
-
end
|
|
146
|
-
after(:all) do
|
|
147
|
-
Dir.chdir(@initial_dir)
|
|
148
|
-
end
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
describe Dokkit::RenderTask, ' when initialized with an empty document dir' do
|
|
152
|
-
it_should_behave_like 'a non configured RenderTask instance'
|
|
153
|
-
before do
|
|
154
|
-
Rake.application.clear
|
|
155
|
-
end
|
|
156
|
-
it 'should raise an empty dir error' do
|
|
157
|
-
lambda {
|
|
158
|
-
model = mock('model')
|
|
159
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
160
|
-
@empty = Dokkit::RenderTask.new(model, 'render') do |task|
|
|
161
|
-
task.documents.exclude('**/*')
|
|
162
|
-
end
|
|
163
|
-
puts @empty.documents.files
|
|
164
|
-
}.should raise_error(RuntimeError, /No documents found in \'.*\'/)
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
describe Dokkit::RenderTask, ' when initialized without a block' do
|
|
169
|
-
it_should_behave_like 'a non configured RenderTask instance'
|
|
170
|
-
|
|
171
|
-
it 'should be initialized with a default document_dir' do
|
|
172
|
-
@rendertask.config.document_dir.should == document_path
|
|
173
|
-
@rendertask.documents.dir == document_path
|
|
174
|
-
end
|
|
175
|
-
it 'should be initialized with a default layout_dir' do
|
|
176
|
-
@rendertask.config.layout_dir.should == layout_path
|
|
177
|
-
end
|
|
178
|
-
it 'should be initialized with a default config_dir' do
|
|
179
|
-
@rendertask.config.config_dir.should == config_path
|
|
180
|
-
end
|
|
181
|
-
it 'should be initialized with a default data_dir' do
|
|
182
|
-
@rendertask.config.data_dir.should == data_path
|
|
183
|
-
@rendertask.data.dir.should == data_path
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
|
|
187
|
-
describe Dokkit::RenderTask, ' when initialized with a configuration hash and a block' do
|
|
188
|
-
it_should_behave_like 'a RenderTask instance initialized with a configuration hash and a block'
|
|
189
|
-
|
|
190
|
-
it 'should be initialized with a default document_dir' do
|
|
191
|
-
@rendertask.config.document_dir.should == File.join(document_path, 'subdir')
|
|
192
|
-
@rendertask.documents.dir.should == File.join(document_path, 'subdir')
|
|
193
|
-
end
|
|
194
|
-
it 'should be initialized with the list of documents to render' do
|
|
195
|
-
@rendertask.documents.files.should have(1).items
|
|
196
|
-
@rendertask.documents.files.should == [document_path('subdir/document_4')]
|
|
197
|
-
end
|
|
198
|
-
it 'should be initialized with a default layout_dir' do
|
|
199
|
-
@rendertask.config.layout_dir.should == layout_path
|
|
200
|
-
end
|
|
201
|
-
it 'should be initialized with a default config_dir' do
|
|
202
|
-
@rendertask.config.config_dir.should == config_path
|
|
203
|
-
end
|
|
204
|
-
it 'should be initialized with a default data_dir' do
|
|
205
|
-
@rendertask.config.data_dir.should == File.join(data_path, 'subdir')
|
|
206
|
-
@rendertask.data.dir.should == File.join(data_path, 'subdir')
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
describe Dokkit::RenderTask, ' when initialized with a configuration block' do
|
|
211
|
-
it_should_behave_like 'a configured RenderTask instance'
|
|
212
|
-
|
|
213
|
-
it 'should be initialized with the config dir' do
|
|
214
|
-
@rendertask.config.config_dir.should == config_path
|
|
215
|
-
end
|
|
216
|
-
it 'should be initialized with the layout dir' do
|
|
217
|
-
@rendertask.config.layout_dir.should == layout_path
|
|
218
|
-
end
|
|
219
|
-
it 'should be initialized with the data dir' do
|
|
220
|
-
@rendertask.config.data_dir == data_path
|
|
221
|
-
end
|
|
222
|
-
it 'should be initialized with the output dir' do
|
|
223
|
-
@rendertask.config.output_dir == output_path
|
|
224
|
-
end
|
|
225
|
-
it 'should be initialized with the list of documents to render' do
|
|
226
|
-
@rendertask.documents.files.should have(8).items
|
|
227
|
-
@rendertask.documents.files.should include(
|
|
228
|
-
document_path('document_1'),
|
|
229
|
-
document_path('document_2'),
|
|
230
|
-
document_path('document_3'),
|
|
231
|
-
document_path('subdir/document_4'),
|
|
232
|
-
document_path('subdir/subdir/document_6')
|
|
233
|
-
)
|
|
234
|
-
end
|
|
235
|
-
it 'should be initialized with the list of data to copy' do
|
|
236
|
-
@rendertask.data.files.should have(2).items
|
|
237
|
-
@rendertask.data.files.should include(
|
|
238
|
-
data_path('resource'),
|
|
239
|
-
data_path('subdir/resource.insubdir')
|
|
240
|
-
)
|
|
241
|
-
end
|
|
242
|
-
it 'should define single document task and prerequisites' do
|
|
243
|
-
task(output_path('document_1.html')).prerequisites.should have(6).items
|
|
244
|
-
task(output_path('document_1.html')).prerequisites.should include(
|
|
245
|
-
document_path('document_1'),
|
|
246
|
-
config_path('document_1.yaml'),
|
|
247
|
-
document_path('COMMON.yaml'),
|
|
248
|
-
document_path('document_1.yaml'),
|
|
249
|
-
config_path('required.yaml'),
|
|
250
|
-
layout_path('document_1.html')
|
|
251
|
-
)
|
|
252
|
-
task(output_path('latex/document_1.latex')).prerequisites.should have(6).items
|
|
253
|
-
task(output_path('latex/document_1.latex')).prerequisites.should include(
|
|
254
|
-
document_path('document_1'),
|
|
255
|
-
config_path('document_1.yaml'),
|
|
256
|
-
document_path('COMMON.yaml'),
|
|
257
|
-
document_path('document_1.yaml'),
|
|
258
|
-
config_path('required.yaml'),
|
|
259
|
-
layout_path('document_1.latex')
|
|
260
|
-
)
|
|
261
|
-
end
|
|
262
|
-
it 'should define a render all documents task and prerequisites' do
|
|
263
|
-
task('render:doc').prerequisites.should have(9).items
|
|
264
|
-
task('render:doc').prerequisites.should include(
|
|
265
|
-
output_path('document_7.html'),
|
|
266
|
-
output_path('document_1.html'),
|
|
267
|
-
output_path('latex/document_1.latex'),
|
|
268
|
-
output_path('document_nolayout.html'),
|
|
269
|
-
output_path('document_2.html'),
|
|
270
|
-
output_path('document_3.html'),
|
|
271
|
-
output_path('subdir/subdir/document_6.html'),
|
|
272
|
-
output_path('subdir/document_4.html')
|
|
273
|
-
)
|
|
274
|
-
end
|
|
275
|
-
it 'should define a data task to copy single data file from data_dir to output_dir' do
|
|
276
|
-
task(output_path('resource')).prerequisites.should == [data_path('resource')]
|
|
277
|
-
task(output_path('subdir/resource.insubdir')).prerequisites.should == [data_path('subdir/resource.insubdir')]
|
|
278
|
-
end
|
|
279
|
-
it 'should define a copy_all_data task to copy all data from data_dir to output_dir' do
|
|
280
|
-
task('render:data').prerequisites.should == [
|
|
281
|
-
output_path('resource'),
|
|
282
|
-
output_path('subdir/resource.insubdir')
|
|
283
|
-
]
|
|
284
|
-
end
|
|
285
|
-
it 'should define a render task to render the documents and copy the data' do
|
|
286
|
-
task('render:all').prerequisites.should == ['render:doc', 'render:data']
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
describe Dokkit::RenderTask, ' when configured with not existent directories' do
|
|
291
|
-
include SpecPathHelper
|
|
292
|
-
before(:all) do
|
|
293
|
-
@initial_dir = Dir.pwd
|
|
294
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
295
|
-
end
|
|
296
|
-
it 'should raise an error if document_dir does not exist' do
|
|
297
|
-
lambda {
|
|
298
|
-
model = mock('model')
|
|
299
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
300
|
-
@rendertask = Dokkit::RenderTask.new(model, 'render') do |task|
|
|
301
|
-
task.config.output_dir = output_path
|
|
302
|
-
task.config.config_dir = 'notexist'
|
|
303
|
-
task.config.layout_dir = 'notexist'
|
|
304
|
-
task.config.document_dir = 'notexist'
|
|
305
|
-
task.config.data_dir = 'notexist'
|
|
306
|
-
task.documents.include('**/*')
|
|
307
|
-
task.documents.exclude('**/*.exclude', '**/*.yaml', '**/*.dep')
|
|
308
|
-
task.data.include('**/*')
|
|
309
|
-
task.data.exclude('**/*.exclude')
|
|
310
|
-
end
|
|
311
|
-
}.should raise_error(RuntimeError, /Directory '.*' does not exist/)
|
|
312
|
-
end
|
|
313
|
-
after do
|
|
314
|
-
rm_rf output_path
|
|
315
|
-
rm_rf cache_path
|
|
316
|
-
Rake.application = nil
|
|
317
|
-
end
|
|
318
|
-
after(:all) do
|
|
319
|
-
Dir.chdir(@initial_dir)
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
|
-
|
|
323
|
-
describe Dokkit::RenderTask, ' when data task is invoked' do
|
|
324
|
-
it_should_behave_like 'a configured RenderTask instance'
|
|
325
|
-
|
|
326
|
-
it 'should copy resources from data_dir to output_dir' do
|
|
327
|
-
task('render:data').invoke
|
|
328
|
-
File.exists?(File.join(output_path('resource'))).should be_true
|
|
329
|
-
end
|
|
330
|
-
it 'should copy resources from data_dir/subdir to output_dir/subdir' do
|
|
331
|
-
task('render:data').invoke
|
|
332
|
-
File.exists?(File.join(data_path, 'subdir', 'resource.insubdir')).should be_true
|
|
333
|
-
end
|
|
334
|
-
it 'should not copy resources that were explicity excluded' do
|
|
335
|
-
task('render:data').invoke
|
|
336
|
-
File.exists?(File.join(output_path('resource.exclude'))).should be_false
|
|
337
|
-
end
|
|
338
|
-
end
|
|
339
|
-
|
|
340
|
-
describe Dokkit::RenderTask, ' when a single file task is invoked' do
|
|
341
|
-
it_should_behave_like 'a configured RenderTask instance'
|
|
342
|
-
|
|
343
|
-
it 'should render document_1.html' do
|
|
344
|
-
task(output_path('document_1.html')).invoke
|
|
345
|
-
File.exists?(output_path('document_1.html')).should be_true
|
|
346
|
-
end
|
|
347
|
-
it 'should render document_1.latex' do
|
|
348
|
-
task(output_path('latex/document_1.latex')).invoke
|
|
349
|
-
File.exists?(output_path('latex/document_1.latex')).should be_true
|
|
350
|
-
end
|
|
351
|
-
end
|
|
352
|
-
|
|
353
|
-
describe Dokkit::RenderTask, ' when the render task is invoked' do
|
|
354
|
-
it_should_behave_like 'a configured RenderTask instance'
|
|
355
|
-
|
|
356
|
-
it 'should create document_1.html, document_2.html, latex/document_1.latex, document_3.html, subdir/document_4, subdir/subdir/document_6' do
|
|
357
|
-
task('render:all').invoke
|
|
358
|
-
File.exists?(output_path('document_1.html')).should be_true
|
|
359
|
-
File.exists?(output_path('latex/document_1.latex')).should be_true
|
|
360
|
-
File.exists?(output_path('document_2.html')).should be_true
|
|
361
|
-
File.exists?(output_path('document_3.html')).should be_true
|
|
362
|
-
File.exists?(output_path('subdir/document_4.html')).should be_true
|
|
363
|
-
File.exists?(output_path('subdir/subdir/document_6.html')).should be_true
|
|
364
|
-
end
|
|
365
|
-
end
|
|
366
|
-
|
|
367
|
-
describe Dokkit::RenderTask, ' when the render task is invoked for document_extended' do
|
|
368
|
-
it_should_behave_like 'a configured RenderTask instance with an extension block'
|
|
369
|
-
|
|
370
|
-
it 'should render extended variable' do
|
|
371
|
-
task(output_path('document_extended.html')).invoke
|
|
372
|
-
File.read(output_path('document_extended.html')).should match(/Extension/)
|
|
373
|
-
end
|
|
374
|
-
end
|
data/spec/taskconfig_spec.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'taskconfig_spec.rb' created on 29 feb 2008 at 07:45:54.
|
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
|
4
|
-
#
|
|
5
|
-
# (c)2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
|
6
|
-
#
|
|
7
|
-
# To execute this spec run:
|
|
8
|
-
#
|
|
9
|
-
# spec spec/taskconfig_spec.rb
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'../lib')))
|
|
14
|
-
|
|
15
|
-
require 'rubygems'
|
|
16
|
-
require 'spec'
|
|
17
|
-
require 'dokkit'
|
|
18
|
-
require 'dokkit/taskconfig'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::TaskConfig, ' when initialized' do
|
|
22
|
-
before do
|
|
23
|
-
@taskconfig = Dokkit::TaskConfig.new do |config|
|
|
24
|
-
config.a_dir = 'a_dir/'
|
|
25
|
-
config.a_sub_dir = 'a_dir/subdir/'
|
|
26
|
-
config.another_dir = 'another_dir///'
|
|
27
|
-
config.right_dir = 'right_dir'
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
it 'should strip extra slashes from keys with _dir suffix' do
|
|
31
|
-
@taskconfig.a_dir.should == 'a_dir'
|
|
32
|
-
@taskconfig.a_sub_dir.should == 'a_dir/subdir'
|
|
33
|
-
@taskconfig.another_dir.should == 'another_dir'
|
|
34
|
-
@taskconfig.right_dir.should == 'right_dir'
|
|
35
|
-
end
|
|
36
|
-
it 'should return directory hash' do
|
|
37
|
-
@taskconfig.directories.should == {
|
|
38
|
-
:a_dir => 'a_dir',
|
|
39
|
-
:a_sub_dir => 'a_dir/subdir',
|
|
40
|
-
:another_dir => 'another_dir',
|
|
41
|
-
:right_dir => 'right_dir'
|
|
42
|
-
}
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
data/spec/templatetask_spec.rb
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'templatetask_spec.rb' created on 03 mar 2008 at 13:11:41.
|
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
|
4
|
-
#
|
|
5
|
-
# (c)2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
|
6
|
-
#
|
|
7
|
-
# To execute this spec run:
|
|
8
|
-
#
|
|
9
|
-
# spec spec/templatetask_spec.rb
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'../lib')))
|
|
14
|
-
|
|
15
|
-
require 'rubygems'
|
|
16
|
-
require 'spec'
|
|
17
|
-
require 'dokkit'
|
|
18
|
-
require 'dokkit/templatetask'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::TemplateTask do
|
|
22
|
-
include SpecPathHelper, CaptureStdout
|
|
23
|
-
before(:all) do
|
|
24
|
-
@initial_dir = Dir.pwd
|
|
25
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
26
|
-
end
|
|
27
|
-
before do
|
|
28
|
-
ARGV.clear
|
|
29
|
-
Rake.application.clear
|
|
30
|
-
model = mock('model')
|
|
31
|
-
model.should_receive(:config).and_return(Dokkit::TaskConfig.new)
|
|
32
|
-
@templatetask = Dokkit::TemplateTask.new(model)
|
|
33
|
-
end
|
|
34
|
-
after do
|
|
35
|
-
rm document_path('template') if File.exists?(document_path('template'))
|
|
36
|
-
rm layout_path('newlayout') if File.exists?(layout_path('newlayout'))
|
|
37
|
-
end
|
|
38
|
-
after(:all) do
|
|
39
|
-
Dir.chdir(@initial_dir)
|
|
40
|
-
end
|
|
41
|
-
it 'should be initialized with the template dir' do
|
|
42
|
-
@templatetask.config.template_dir.should == SpecPathHelper::TEMPLATE_PATH
|
|
43
|
-
end
|
|
44
|
-
describe ' when create task is invoked' do
|
|
45
|
-
it 'should copy the given template from template dir to document dir' do
|
|
46
|
-
task('template:create').invoke('pages/template')
|
|
47
|
-
File.exists?(document_path('template')).should be_true
|
|
48
|
-
end
|
|
49
|
-
it 'should copy the given template from template dir to the given dir' do
|
|
50
|
-
ARGV.push('template:create[layouts/layout]')
|
|
51
|
-
ARGV.push('doc/layouts/newlayout')
|
|
52
|
-
Rake.application.collect_tasks
|
|
53
|
-
task('template:create').invoke('layouts/layout')
|
|
54
|
-
File.exists?(layout_path('newlayout')).should be_true
|
|
55
|
-
end
|
|
56
|
-
it 'should raise an error if the template file does not exist' do
|
|
57
|
-
lambda {
|
|
58
|
-
task('template:create').invoke('pages/notexist')
|
|
59
|
-
}.should raise_error(RuntimeError, /Template \'.*\' doesn't exist/)
|
|
60
|
-
end
|
|
61
|
-
it 'should inform that the template was copied successfully' do
|
|
62
|
-
ARGV.push('template:create[layouts/layout]')
|
|
63
|
-
ARGV.push('doc/layouts/newlayout')
|
|
64
|
-
Rake.application.collect_tasks
|
|
65
|
-
capture_stdout {
|
|
66
|
-
task('template:create').invoke('layouts/layout')
|
|
67
|
-
}.should match(/Copy template \'.*\' to/)
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/spec/{data/test_build/doc/layouts/layout → dokkit/environment/test_data/doc/pages/document_1}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/data/spec/{data/test_build/templates/layouts/layout → dokkit/tasklib/test_data/doc/data/data_1}
RENAMED
|
File without changes
|
|
File without changes
|