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/document_spec.rb
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'document_spec.rb' created on 13 gen 2008 at 17:46:37.
|
|
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 spec run:
|
|
8
|
-
#
|
|
9
|
-
# spec spec/document_spec.rb
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__),'../lib'))
|
|
13
|
-
|
|
14
|
-
require 'rubygems'
|
|
15
|
-
require 'spec'
|
|
16
|
-
require 'dokkit'
|
|
17
|
-
require 'dokkit/document'
|
|
18
|
-
require 'dokkit/pathhelper'
|
|
19
|
-
require 'dokkit/filters/all'
|
|
20
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
21
|
-
|
|
22
|
-
describe 'a configured Document instance', :shared => true do
|
|
23
|
-
include SpecPathHelper, CaptureStdout
|
|
24
|
-
before(:all) do
|
|
25
|
-
@initial_dir = Dir.pwd
|
|
26
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
27
|
-
end
|
|
28
|
-
before do
|
|
29
|
-
@cache = Dokkit::CacheManager.instance
|
|
30
|
-
@cache.init('deps.yaml', '.cache')
|
|
31
|
-
@config = mock('config')
|
|
32
|
-
@config.should_receive(:document_dir).at_least(1).and_return(document_path)
|
|
33
|
-
@config.should_receive(:config_dir).at_least(1).and_return(config_path)
|
|
34
|
-
@config.should_receive(:layout_dir).at_least(1).and_return(layout_path)
|
|
35
|
-
@config.should_receive(:output_dir).at_least(1).and_return(output_path)
|
|
36
|
-
end
|
|
37
|
-
after(:all) do
|
|
38
|
-
Dir.chdir(@initial_dir)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
describe Dokkit::Document, ' when initialized with document_1' do
|
|
43
|
-
|
|
44
|
-
it_should_behave_like 'a configured Document instance'
|
|
45
|
-
|
|
46
|
-
before do
|
|
47
|
-
@document = Dokkit::Document.new(document_path('document_1'), @config)
|
|
48
|
-
end
|
|
49
|
-
it 'should be initialized with the name of the source file' do
|
|
50
|
-
@document.document.should == document_path('document_1')
|
|
51
|
-
end
|
|
52
|
-
it 'should get the basename of the source file' do
|
|
53
|
-
@document.document_basename.should == 'document_1'
|
|
54
|
-
end
|
|
55
|
-
it 'should resolve its configuration files' do
|
|
56
|
-
@document.configs.should == [
|
|
57
|
-
config_path('document_1.yaml'),
|
|
58
|
-
document_path('COMMON.yaml'),
|
|
59
|
-
document_path('document_1.yaml'),
|
|
60
|
-
config_path('required.yaml')
|
|
61
|
-
]
|
|
62
|
-
end
|
|
63
|
-
it 'should read the configuration files and fill a configuration hash' do
|
|
64
|
-
@document.configuration.should_not be_empty
|
|
65
|
-
end
|
|
66
|
-
it 'should read document source file' do
|
|
67
|
-
@document.source_text.should =~ /\* Title for document_1/
|
|
68
|
-
end
|
|
69
|
-
it 'should define output targets' do
|
|
70
|
-
@document.targets['html'].should == output_path('document_1.html')
|
|
71
|
-
@document.targets['tex'].should == output_path('latex/document_1.latex')
|
|
72
|
-
end
|
|
73
|
-
it 'should define layouts grouped by output target' do
|
|
74
|
-
@document.layouts['html'].should == [layout_path('document_1.html')]
|
|
75
|
-
@document.layouts['tex'].should == [layout_path('document_1.latex')]
|
|
76
|
-
end
|
|
77
|
-
it 'should know the filters to use for rendering in the given output format' do
|
|
78
|
-
@document.filter_chain['html'].should == ['deplate-html']
|
|
79
|
-
@document.filter_chain['tex'].should == ['deplate-latex']
|
|
80
|
-
end
|
|
81
|
-
it 'should return the list of prerequisites grouped by output format' do
|
|
82
|
-
@document.prerequisites['html'].should include(
|
|
83
|
-
document_path('document_1'),
|
|
84
|
-
config_path('document_1.yaml'),
|
|
85
|
-
config_path('required.yaml'),
|
|
86
|
-
document_path('document_1.yaml'),
|
|
87
|
-
document_path('COMMON.yaml'),
|
|
88
|
-
layout_path('document_1.html')
|
|
89
|
-
)
|
|
90
|
-
end
|
|
91
|
-
describe ' and rendered in html' do
|
|
92
|
-
before do
|
|
93
|
-
@result = @document.render('html')
|
|
94
|
-
end
|
|
95
|
-
it 'should execute embedded erb code and render the document' do
|
|
96
|
-
@result.should =~ /test embedded erb/
|
|
97
|
-
end
|
|
98
|
-
it 'should render the content of the configuration hash' do
|
|
99
|
-
@result.should =~ /test configuration rendering/
|
|
100
|
-
@result.should =~ /test the correct merge/
|
|
101
|
-
end
|
|
102
|
-
it 'should return a default value if a configuration key is not found' do
|
|
103
|
-
@document.configuration['notexist'].should match(/'notexist' not defined/)
|
|
104
|
-
end
|
|
105
|
-
it 'should know which is the current format' do
|
|
106
|
-
@result.should =~ /Current rendering format is: html/
|
|
107
|
-
end
|
|
108
|
-
it 'should apply filters to render in html format' do
|
|
109
|
-
@result.should =~ /\<h1.*\>.*\<\/h1\>/
|
|
110
|
-
end
|
|
111
|
-
it 'should render partial inside it' do
|
|
112
|
-
@result.should =~ /partial should be rendered/
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
describe ' and rendered in tex' do
|
|
116
|
-
before do
|
|
117
|
-
@result = @document.render('tex')
|
|
118
|
-
end
|
|
119
|
-
it 'should apply filters to render in html format' do
|
|
120
|
-
@result.should =~ /\\section\{.*\}/
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
describe Dokkit::Document, ' when initialized with document_nolayout.ext' do
|
|
126
|
-
|
|
127
|
-
it_should_behave_like 'a configured Document instance'
|
|
128
|
-
|
|
129
|
-
before do
|
|
130
|
-
@document = Dokkit::Document.new(document_path('document_nolayout.ext'), @config)
|
|
131
|
-
end
|
|
132
|
-
it 'should define output targets' do
|
|
133
|
-
@document.targets['html'].should == output_path('document_nolayout.html')
|
|
134
|
-
end
|
|
135
|
-
it 'should set a nil layout' do
|
|
136
|
-
@document.layouts['html'].should be_empty
|
|
137
|
-
end
|
|
138
|
-
it 'should know the filters to use for rendering in the given output format' do
|
|
139
|
-
@document.filter_chain['html'].should == ['deplate-html']
|
|
140
|
-
end
|
|
141
|
-
it 'should return the list of prerequisites grouped by output format' do
|
|
142
|
-
@document.prerequisites['html'].should include(
|
|
143
|
-
document_path('document_nolayout.ext'),
|
|
144
|
-
document_path('document_nolayout.yaml'),
|
|
145
|
-
document_path('COMMON.yaml')
|
|
146
|
-
)
|
|
147
|
-
end
|
|
148
|
-
it 'should resolve its configuration files' do
|
|
149
|
-
@document = Dokkit::Document.new(document_path('document_nolayout.ext'), @config)
|
|
150
|
-
@document.configs.should == [
|
|
151
|
-
document_path('COMMON.yaml'),
|
|
152
|
-
document_path('document_nolayout.yaml'),
|
|
153
|
-
]
|
|
154
|
-
end
|
|
155
|
-
it 'should raise a -layout not found- warning' do
|
|
156
|
-
capture_stderr do
|
|
157
|
-
@document = Dokkit::Document.new(document_path('document_nolayout.ext'), @config)
|
|
158
|
-
end.should match(/Layout not found/)
|
|
159
|
-
end
|
|
160
|
-
describe ' and rendered in html' do
|
|
161
|
-
before do
|
|
162
|
-
@document = Dokkit::Document.new(document_path('document_nolayout.ext'), @config)
|
|
163
|
-
@result = @document.render('html')
|
|
164
|
-
end
|
|
165
|
-
it 'should apply filters to render in html format' do
|
|
166
|
-
@result.should =~ /\<h1.*\>.*\<\/h1\>/
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
describe Dokkit::Document, ' when initialized with subdir/document_4' do
|
|
172
|
-
|
|
173
|
-
it_should_behave_like 'a configured Document instance'
|
|
174
|
-
|
|
175
|
-
before do
|
|
176
|
-
@document = Dokkit::Document.new(document_path('subdir/document_4'), @config)
|
|
177
|
-
end
|
|
178
|
-
it 'should get the basename of the source file' do
|
|
179
|
-
@document.document_basename == 'document_4'
|
|
180
|
-
end
|
|
181
|
-
it 'should resolve its configuration files' do
|
|
182
|
-
@document.configs.should == [
|
|
183
|
-
config_path('subdir/document_4.yaml'),
|
|
184
|
-
File.expand_path(document_path('COMMON.yaml')),
|
|
185
|
-
document_path('subdir/COMMON.yaml'),
|
|
186
|
-
]
|
|
187
|
-
end
|
|
188
|
-
it 'should define output targets' do
|
|
189
|
-
@document.targets['html'].should == output_path('subdir/document_4.html')
|
|
190
|
-
end
|
|
191
|
-
it 'should define layouts grouped by output format' do
|
|
192
|
-
@document.layouts['html'].should == [layout_path('document_1.html')]
|
|
193
|
-
end
|
|
194
|
-
it 'should know the filters to use for rendering in the given output format' do
|
|
195
|
-
@document.filter_chain['html'].should == ['deplate-html']
|
|
196
|
-
end
|
|
197
|
-
it 'should resolve relative path' do
|
|
198
|
-
@document.relative('/images/image.img').should == '../images/image.img'
|
|
199
|
-
end
|
|
200
|
-
describe ' and rendered in html' do
|
|
201
|
-
before do
|
|
202
|
-
@result = @document.render('html')
|
|
203
|
-
end
|
|
204
|
-
it 'should apply filters to render in html format' do
|
|
205
|
-
@result.should =~ /\<h1.*\>.*\<\/h1\>/
|
|
206
|
-
end
|
|
207
|
-
end
|
|
208
|
-
end
|
|
209
|
-
|
|
210
|
-
describe Dokkit::Document, ' when initialized with subdir/subdir/document_6' do
|
|
211
|
-
|
|
212
|
-
it_should_behave_like 'a configured Document instance'
|
|
213
|
-
|
|
214
|
-
before do
|
|
215
|
-
@document = Dokkit::Document.new(document_path('subdir/subdir/document_6'), @config)
|
|
216
|
-
end
|
|
217
|
-
it 'should resolve its configuration files' do
|
|
218
|
-
@document.configs.should == [
|
|
219
|
-
File.expand_path(document_path('COMMON.yaml')),
|
|
220
|
-
File.expand_path(document_path('subdir/COMMON.yaml')),
|
|
221
|
-
document_path('subdir/subdir/COMMON.yaml'),
|
|
222
|
-
]
|
|
223
|
-
end
|
|
224
|
-
it 'should define output targets' do
|
|
225
|
-
@document.targets['html'].should == output_path('subdir/subdir/document_6.html')
|
|
226
|
-
end
|
|
227
|
-
it 'should define layouts grouped by output target' do
|
|
228
|
-
@document.layouts['html'].should == [layout_path('document_1.html')]
|
|
229
|
-
end
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
describe Dokkit::Document, ' when initialized with document_7' do
|
|
233
|
-
|
|
234
|
-
it_should_behave_like 'a configured Document instance'
|
|
235
|
-
|
|
236
|
-
before do
|
|
237
|
-
@document = Dokkit::Document.new(document_path('document_7'), @config)
|
|
238
|
-
end
|
|
239
|
-
it 'should resolve its configuration files' do
|
|
240
|
-
@document.configs.should == [
|
|
241
|
-
document_path('COMMON.yaml'),
|
|
242
|
-
document_path('document_7.yaml'),
|
|
243
|
-
]
|
|
244
|
-
end
|
|
245
|
-
it 'should define output targets' do
|
|
246
|
-
@document.targets['html'].should == output_path('document_7.html')
|
|
247
|
-
end
|
|
248
|
-
it 'should define layouts grouped by output target' do
|
|
249
|
-
@document.layouts['html'].should == [layout_path('document_1.html')]
|
|
250
|
-
end
|
|
251
|
-
describe ' and rendered in html using maruku filter' do
|
|
252
|
-
before do
|
|
253
|
-
@result = @document.render('html')
|
|
254
|
-
end
|
|
255
|
-
it 'should apply filters to render in html format' do
|
|
256
|
-
@result.should =~ /\<h1.*\>.*\<\/h1\>/
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
describe ' and rendered using a not defined target format' do
|
|
260
|
-
it 'should raise an error' do
|
|
261
|
-
lambda {
|
|
262
|
-
@document.render('notexistent')
|
|
263
|
-
}.should raise_error(RuntimeError, /Don't know how to render in '.*' format!/)
|
|
264
|
-
end
|
|
265
|
-
it 'should warn that a filter was not found' do
|
|
266
|
-
capture_stderr do
|
|
267
|
-
@document.render('html')
|
|
268
|
-
end.should match(/Filter '.*' not found/)
|
|
269
|
-
end
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
describe Dokkit::Document, ' when initialized with document_with_partials' do
|
|
274
|
-
|
|
275
|
-
it_should_behave_like 'a configured Document instance'
|
|
276
|
-
|
|
277
|
-
before do
|
|
278
|
-
@document = Dokkit::Document.new(document_path('document_with_partials'), @config)
|
|
279
|
-
end
|
|
280
|
-
describe ' and rendered in html' do
|
|
281
|
-
it 'should fail if a circular dependency is detected' do
|
|
282
|
-
lambda { @document.render('html') }.should raise_error(RuntimeError, /Circular dependency detected in/)
|
|
283
|
-
end
|
|
284
|
-
end
|
|
285
|
-
end
|
|
286
|
-
|
|
287
|
-
describe Dokkit::Document, ' when initialized with document_nested' do
|
|
288
|
-
|
|
289
|
-
it_should_behave_like 'a configured Document instance'
|
|
290
|
-
|
|
291
|
-
before do
|
|
292
|
-
@result = Dokkit::Document.new(document_path('document_nested'), @config).render('html')
|
|
293
|
-
end
|
|
294
|
-
describe ' and rendered in html' do
|
|
295
|
-
it 'should render nested layout' do
|
|
296
|
-
@result.should match(/<div class=\"nested\"/)
|
|
297
|
-
end
|
|
298
|
-
end
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
describe Dokkit::Document, ' when initialized with document_3' do
|
|
302
|
-
|
|
303
|
-
it_should_behave_like 'a configured Document instance'
|
|
304
|
-
|
|
305
|
-
before do
|
|
306
|
-
@document = Dokkit::Document.new(document_path('document_3'), @config)
|
|
307
|
-
end
|
|
308
|
-
it 'should read the meta configuration inside it' do
|
|
309
|
-
@document.configuration['key'].should == 'value'
|
|
310
|
-
end
|
|
311
|
-
it 'should collect config file in meta configuration' do
|
|
312
|
-
@document.configs.should == [
|
|
313
|
-
document_path('COMMON.yaml'),
|
|
314
|
-
config_path('document_1.yaml'),
|
|
315
|
-
]
|
|
316
|
-
end
|
|
317
|
-
it 'should read configuration from config file' do
|
|
318
|
-
@document.configuration['test_config_merge'].should match(/test the correct merge/)
|
|
319
|
-
end
|
|
320
|
-
end
|
|
321
|
-
|
data/spec/dokkitlib_spec.rb
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'dokkitlib_spec.rb' created on 18 feb 2008 at 17:49:23.
|
|
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/dokkitlib_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/dokkitlib'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::DokkitLib, ' when initialized' do
|
|
22
|
-
include SpecPathHelper
|
|
23
|
-
|
|
24
|
-
before do
|
|
25
|
-
class Dokkit::DokkitLib
|
|
26
|
-
private
|
|
27
|
-
def define_dokkit_task
|
|
28
|
-
dokkit_task 'test' => 'dep'
|
|
29
|
-
end
|
|
30
|
-
def pre_block_configuration
|
|
31
|
-
@config.another_test_option = 'default value'
|
|
32
|
-
end
|
|
33
|
-
def post_block_configuration
|
|
34
|
-
@config.yet_another_test_option = @config.test_option
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
model = mock('model')
|
|
38
|
-
model.should_receive(:config).and_return(OpenStruct.new)
|
|
39
|
-
@dokkittask = Dokkit::DokkitLib.new(model, 'dokkit') do |task|
|
|
40
|
-
task.config.test_dir = 'test_dir/'
|
|
41
|
-
task.config.test_option = 'test_option'
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
it 'should define a namespace for its tasks' do
|
|
45
|
-
@dokkittask.ns.should_not be_empty
|
|
46
|
-
end
|
|
47
|
-
it 'should be initialized with a configuration hash' do
|
|
48
|
-
@dokkittask.config.test_dir.should == 'test_dir/'
|
|
49
|
-
@dokkittask.config.test_option.should == 'test_option'
|
|
50
|
-
end
|
|
51
|
-
it 'should do pre configuration' do
|
|
52
|
-
@dokkittask.config.another_test_option.should == 'default value'
|
|
53
|
-
end
|
|
54
|
-
it 'should do post configuration' do
|
|
55
|
-
@dokkittask.config.yet_another_test_option.should == @dokkittask.config.test_option
|
|
56
|
-
end
|
|
57
|
-
it 'should encapsulate the tasks defined in its namespace' do
|
|
58
|
-
task('dokkit:test').prerequisites.should == ['dep']
|
|
59
|
-
end
|
|
60
|
-
it 'should define the same task only once' do
|
|
61
|
-
@dokkittask.dokkit_task('test' => 'dep').should be_nil
|
|
62
|
-
end
|
|
63
|
-
end
|
data/spec/fileselection_spec.rb
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'fileselect_spec.rb' created on 07 feb 2008 at 15:46:04.
|
|
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/fileselect_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/fileselection'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::FileSelection, ' when initialized' 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
|
-
it 'should set the current dir as default base path' do
|
|
28
|
-
fs = Dokkit::FileSelection.new
|
|
29
|
-
fs.base_dir.should == '.'
|
|
30
|
-
end
|
|
31
|
-
it 'should set the given directory as the base path for all operations' do
|
|
32
|
-
fs = Dokkit::FileSelection.new(document_path)
|
|
33
|
-
fs.base_dir.should == document_path
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
after(:all) do
|
|
37
|
-
Dir.chdir(@initial_dir)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
describe Dokkit::FileSelection, ' when extended with ExtMapping' do
|
|
42
|
-
include SpecPathHelper
|
|
43
|
-
before(:all) do
|
|
44
|
-
@initial_dir = Dir.pwd
|
|
45
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
46
|
-
@fs = Dokkit::FileSelection.new(document_path) do |fs|
|
|
47
|
-
fs.include('*')
|
|
48
|
-
end
|
|
49
|
-
@fs.extend Dokkit::ExtMapping
|
|
50
|
-
end
|
|
51
|
-
it 'should map an extension for document_1' do
|
|
52
|
-
@fs.extend(/document_1$/) { "extended" }
|
|
53
|
-
@fs.extmapping.should have(1).items
|
|
54
|
-
@fs.extmapping[document_path('document_1')].call.should == "extended"
|
|
55
|
-
end
|
|
56
|
-
it 'should map an extension for all documents' do
|
|
57
|
-
@fs.extend { "extended" }
|
|
58
|
-
@fs.extmapping.should have(18).items
|
|
59
|
-
end
|
|
60
|
-
after(:all) do
|
|
61
|
-
Dir.chdir(@initial_dir)
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
describe Dokkit::FileSelection, '#files' do
|
|
66
|
-
include SpecPathHelper
|
|
67
|
-
before(:all) do
|
|
68
|
-
@initial_dir = Dir.pwd
|
|
69
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecPathHelper::DATA_TEST_DIR))
|
|
70
|
-
end
|
|
71
|
-
it 'should return an array with the list of the included files in the given directory' do
|
|
72
|
-
Dokkit::FileSelection.new(document_path) do |fs|
|
|
73
|
-
fs.include('*')
|
|
74
|
-
end.files.should have(18).items
|
|
75
|
-
end
|
|
76
|
-
it 'should not include files that was explicity excluded' do
|
|
77
|
-
Dokkit::FileSelection.new(document_path) do |fs|
|
|
78
|
-
fs.exclude('*.exclude')
|
|
79
|
-
end.files.should_not include(document_path('document_5.exclude'))
|
|
80
|
-
end
|
|
81
|
-
it 'should include only the files that was explicity included' do
|
|
82
|
-
Dokkit::FileSelection.new(document_path) do |fs|
|
|
83
|
-
fs.include('*.yaml')
|
|
84
|
-
end.files.should include(document_path('COMMON.yaml'))
|
|
85
|
-
end
|
|
86
|
-
it 'should not include the same files' do
|
|
87
|
-
Dokkit::FileSelection.new(document_path) do |fs|
|
|
88
|
-
fs.include('*')
|
|
89
|
-
fs.include('*')
|
|
90
|
-
end.files.should have(18).items
|
|
91
|
-
end
|
|
92
|
-
it 'should not include directory' do
|
|
93
|
-
Dokkit::FileSelection.new(document_path) do |fs|
|
|
94
|
-
fs.include('**/*')
|
|
95
|
-
end.files.should_not include(document_path('subdir'))
|
|
96
|
-
end
|
|
97
|
-
after(:all) do
|
|
98
|
-
Dir.chdir(@initial_dir)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
data/spec/filter_base_spec.rb
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'filter_base_spec.rb' created on 18 feb 2008 at 14:48:04.
|
|
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/filter_base_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/filters/base'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::Filters::Base do
|
|
22
|
-
before do
|
|
23
|
-
@filter = Dokkit::Filters::Base.new
|
|
24
|
-
end
|
|
25
|
-
it 'should define an instance method to transform the given text' do
|
|
26
|
-
@result = @filter.filter('text to transform').should be_nil
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
data/spec/filters_spec.rb
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'filter_spec.rb' created on 15 feb 2008 at 22:25:12.
|
|
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/filter_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/filters'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::Filters do
|
|
22
|
-
it 'should register new filters' do
|
|
23
|
-
Filter = mock('Filter')
|
|
24
|
-
@filter = mock('filter')
|
|
25
|
-
Filter.should_receive(:new).and_return(@filter)
|
|
26
|
-
@filter.should_receive(:class).and_return('Filter')
|
|
27
|
-
Dokkit::Filters.register('filter') do
|
|
28
|
-
Filter.new
|
|
29
|
-
end
|
|
30
|
-
Dokkit::Filters['filter'].class.should == 'Filter'
|
|
31
|
-
end
|
|
32
|
-
it 'should raise an error if a non existent filter is called' do
|
|
33
|
-
lambda {
|
|
34
|
-
Dokkit::Filters['notexists']
|
|
35
|
-
}.should raise_error(RuntimeError, /Filter '.*' is not defined!/)
|
|
36
|
-
end
|
|
37
|
-
end
|
data/spec/model_spec.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'model_spec.rb' created on 10 mar 2008 at 13:36:29.
|
|
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/model_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/model'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::Model, ' when initialized' 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 = Dokkit::Model.init do |model|
|
|
29
|
-
model.config.cache_dir = cache_path
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
after(:all) do
|
|
33
|
-
Dir.chdir(@initial_dir)
|
|
34
|
-
end
|
|
35
|
-
it 'should be instantiated only once' do
|
|
36
|
-
Dokkit::Model.init.object_id.should == @model.object_id
|
|
37
|
-
end
|
|
38
|
-
it 'should be initialized with a name' do
|
|
39
|
-
Dokkit::Model.init('simpledocument').name == 'simpledocument'
|
|
40
|
-
end
|
|
41
|
-
it 'should instantiate a TaskConfig object' do
|
|
42
|
-
@model.config.class.should == Dokkit::TaskConfig
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
data/spec/pathhelper_spec.rb
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# File 'pathhelper_spec.rb' created on 15 feb 2008 at 16:36:50.
|
|
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/pathhelper_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/pathhelper'
|
|
19
|
-
require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
20
|
-
|
|
21
|
-
describe Dokkit::PathHelper do
|
|
22
|
-
include SpecPathHelper
|
|
23
|
-
before do
|
|
24
|
-
@config = mock('config')
|
|
25
|
-
end
|
|
26
|
-
it 'should define a method to transform source file path and extension' do
|
|
27
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'document')
|
|
28
|
-
filename_helper(source_fn, SpecPathHelper::DOCUMENT_PATH, 'newdir', '.newext').should == 'newdir/document.newext'
|
|
29
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'subdir/document')
|
|
30
|
-
filename_helper(source_fn, SpecPathHelper::DOCUMENT_PATH, 'newdir', '.newext').should == 'newdir/subdir/document.newext'
|
|
31
|
-
end
|
|
32
|
-
it 'should return a configuration filename given a source filename' do
|
|
33
|
-
@config.should_receive(:document_dir).and_return(SpecPathHelper::DOCUMENT_PATH)
|
|
34
|
-
@config.should_receive(:config_dir).and_return(SpecPathHelper::CONFIG_PATH)
|
|
35
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'document')
|
|
36
|
-
config_fn_helper(source_fn, @config).should == 'doc/configs/document.yaml'
|
|
37
|
-
end
|
|
38
|
-
it 'should return a layout filename given a source filename' do
|
|
39
|
-
@config.should_receive(:document_dir).twice.and_return(SpecPathHelper::DOCUMENT_PATH)
|
|
40
|
-
@config.should_receive(:layout_dir).twice.and_return(SpecPathHelper::LAYOUT_PATH)
|
|
41
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'document')
|
|
42
|
-
layout_fn_helper(source_fn, '.html', @config).should == 'doc/layouts/document.html'
|
|
43
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'subdir/document')
|
|
44
|
-
layout_fn_helper(source_fn, '.html', @config).should == 'doc/layouts/subdir/document.html'
|
|
45
|
-
end
|
|
46
|
-
it 'should return a target filename given a source filename' do
|
|
47
|
-
@config.should_receive(:document_dir).and_return(SpecPathHelper::DOCUMENT_PATH)
|
|
48
|
-
@config.should_receive(:output_dir).and_return(SpecPathHelper::OUTPUT_PATH)
|
|
49
|
-
source_fn = File.join(SpecPathHelper::DOCUMENT_PATH, 'document')
|
|
50
|
-
output_fn_helper(source_fn, '.html', @config).should == 'output/document.html'
|
|
51
|
-
end
|
|
52
|
-
it 'should return a target data filename given a source data filename' do
|
|
53
|
-
@config.should_receive(:data_dir).and_return(SpecPathHelper::DATA_PATH)
|
|
54
|
-
@config.should_receive(:output_dir).and_return(SpecPathHelper::OUTPUT_PATH)
|
|
55
|
-
source_fn = File.join(SpecPathHelper::DATA_PATH, 'resource')
|
|
56
|
-
data_fn_helper(source_fn, @config).should == 'output/resource'
|
|
57
|
-
end
|
|
58
|
-
it 'should define a method to strip extension from file' do
|
|
59
|
-
strip_ext('test.ext').should == 'test'
|
|
60
|
-
strip_ext('.test.ext.ext').should == '.test.ext'
|
|
61
|
-
end
|
|
62
|
-
end
|