dokkit 0.4.1 → 0.4.2
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/Manifest.txt +1 -59
- data/lib/dokkit.rb +1 -1
- data/lib/dokkit/environment/basic.rb +23 -8
- data/lib/dokkit/filters.rb +1 -0
- data/lib/dokkit/filters/erb.rb +3 -3
- data/lib/dokkit/filters/haml.rb +31 -0
- data/lib/dokkit/models/simple/doc/layouts/simple.html +1 -1
- data/lib/dokkit/resource/document.rb +59 -63
- metadata +3 -61
- data/spec/dokkit/application_spec.rb +0 -141
- data/spec/dokkit/cache/cache_spec.rb +0 -87
- data/spec/dokkit/dokkit_spec.rb +0 -20
- data/spec/dokkit/environment/basic_spec.rb +0 -138
- data/spec/dokkit/environment/helpers/extmap_spec.rb +0 -52
- data/spec/dokkit/environment/helpers/fileselection_spec.rb +0 -80
- data/spec/dokkit/environment/helpers/test_data/doc/pages/document_1.ext_1 +0 -0
- data/spec/dokkit/environment/helpers/test_data/doc/pages/document_2 +0 -0
- data/spec/dokkit/environment/helpers/test_data/doc/pages/document_3.ext_3 +0 -0
- data/spec/dokkit/environment/test_data/doc/data/data +0 -0
- data/spec/dokkit/environment/test_data/doc/pages/document_1 +0 -0
- data/spec/dokkit/environment/test_data/doc/pages/document_1.yaml +0 -3
- data/spec/dokkit/environment/test_data/doc/pages/document_2 +0 -0
- data/spec/dokkit/environment/test_data/doc/pages/subdir/document_1 +0 -0
- data/spec/dokkit/factory/factory_spec.rb +0 -69
- data/spec/dokkit/filters/deplate_spec.rb +0 -47
- data/spec/dokkit/filters/erb_spec.rb +0 -26
- data/spec/dokkit/filters/maruku_spec.rb +0 -28
- data/spec/dokkit/filters/nil_spec.rb +0 -29
- data/spec/dokkit/filters/tidy_spec.rb +0 -48
- data/spec/dokkit/hash_spec.rb +0 -89
- data/spec/dokkit/logging/logger_spec.rb +0 -138
- data/spec/dokkit/logging/observers/console_spec.rb +0 -68
- data/spec/dokkit/resource/data_spec.rb +0 -32
- data/spec/dokkit/resource/document_spec.rb +0 -523
- data/spec/dokkit/resource/extensions/html_spec.rb +0 -35
- data/spec/dokkit/resource/extensions/url_spec.rb +0 -29
- data/spec/dokkit/resource/filenamehelper_spec.rb +0 -33
- data/spec/dokkit/resource/test_data/doc/configs/config_1.yaml +0 -3
- data/spec/dokkit/resource/test_data/doc/configs/config_2.yaml +0 -3
- data/spec/dokkit/resource/test_data/doc/configs/required.yaml +0 -3
- data/spec/dokkit/resource/test_data/doc/configs/subdir/document.yaml +0 -3
- data/spec/dokkit/resource/test_data/doc/layouts/container.html +0 -6
- data/spec/dokkit/resource/test_data/doc/layouts/layout.html +0 -6
- data/spec/dokkit/resource/test_data/doc/layouts/layout.latex +0 -8
- data/spec/dokkit/resource/test_data/doc/layouts/nested/nested.html +0 -4
- data/spec/dokkit/resource/test_data/doc/layouts/subdir/document.html +0 -6
- data/spec/dokkit/resource/test_data/doc/layouts/subdir/document.latex +0 -8
- data/spec/dokkit/resource/test_data/doc/pages/COMMON.yaml +0 -4
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_config.ext +0 -7
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_errors.ext +0 -12
- data/spec/dokkit/resource/test_data/doc/pages/document_with_many_targets.ext +0 -19
- data/spec/dokkit/resource/test_data/doc/pages/document_with_nested_layout.ext +0 -13
- data/spec/dokkit/resource/test_data/doc/pages/document_with_nil_target.ext +0 -5
- data/spec/dokkit/resource/test_data/doc/pages/document_with_not_defined_target.ext +0 -6
- data/spec/dokkit/resource/test_data/doc/pages/document_with_one_target.ext +0 -8
- data/spec/dokkit/resource/test_data/doc/pages/document_with_postfilter.ext +0 -10
- data/spec/dokkit/resource/test_data/doc/pages/subdir/COMMON.yaml +0 -3
- data/spec/dokkit/resource/test_data/doc/pages/subdir/document.ext +0 -8
- data/spec/dokkit/resource/test_data/doc/pages/subdir/document.yaml +0 -5
- data/spec/dokkit/tasklib/clean_spec.rb +0 -75
- data/spec/dokkit/tasklib/render_spec.rb +0 -125
- data/spec/dokkit/tasklib/test_data/doc/data/data_1 +0 -0
- data/spec/dokkit/tasklib/test_data/doc/pages/document_1 +0 -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 +0 -4
- data/spec/spec_helper.rb +0 -139
@@ -1,35 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# File 'html_spec.rb' created on 21 giu 2008 at 19:57:13.
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
4
|
-
#
|
5
|
-
# (c)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'rubygems'
|
9
|
-
require 'spec'
|
10
|
-
require 'dokkit'
|
11
|
-
|
12
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../../../lib')))
|
13
|
-
require 'dokkit/resource/extensions/html'
|
14
|
-
|
15
|
-
|
16
|
-
module Dokkit
|
17
|
-
module Resource
|
18
|
-
module Extension
|
19
|
-
|
20
|
-
describe HTML, '#link_to' do
|
21
|
-
before do
|
22
|
-
@document = mock('document',
|
23
|
-
:configuration => { :document_dir => 'doc/pages' },
|
24
|
-
:source_fn => 'doc/pages/subdir/document.ext'
|
25
|
-
)
|
26
|
-
@document.extend Dokkit::Resource::Extension::HTML
|
27
|
-
end
|
28
|
-
it 'should produce a link with the given href, name and class' do
|
29
|
-
@document.link_to("Link to page", :href => '/page.html', :class => 'class').should == "<a href=\"../page.html\" class=\"class\">Link to page</a>"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# File 'url_spec.rb' created on 09 mag 2008 at 19:17:03.
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
4
|
-
#
|
5
|
-
# (c)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
6
|
-
#
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../../../../lib')))
|
9
|
-
|
10
|
-
require 'rubygems'
|
11
|
-
require 'spec'
|
12
|
-
require 'dokkit'
|
13
|
-
require 'dokkit/resource/extensions/url'
|
14
|
-
require 'spec/spec_helper.rb'
|
15
|
-
|
16
|
-
describe Dokkit::Resource::Extension::Url do
|
17
|
-
before do
|
18
|
-
@document = mock('document',
|
19
|
-
:configuration => { :document_dir => 'doc/pages' },
|
20
|
-
:source_fn => 'doc/pages/subdir/document.ext'
|
21
|
-
)
|
22
|
-
@document.extend Dokkit::Resource::Extension::Url
|
23
|
-
end
|
24
|
-
it 'should resolve the absolute path name' do
|
25
|
-
@document.relative('/images/image.img').should == '../images/image.img'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# File 'filehelper_spec.rb' created on 28 feb 2008 at 16:44:07.
|
3
|
-
# See 'dokkit.rb' or +LICENSE+ for licence information.
|
4
|
-
#
|
5
|
-
# (c) 2006, 2007, 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
6
|
-
#
|
7
|
-
# To execute this spec run:
|
8
|
-
#
|
9
|
-
# spec spec/filehelper_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/resource/filenamehelper'
|
19
|
-
require 'spec/spec_helper.rb'
|
20
|
-
|
21
|
-
describe Dokkit::Resource::FilenameHelper do
|
22
|
-
before do
|
23
|
-
@resource = mock('resource')
|
24
|
-
@resource.extend Dokkit::Resource::FilenameHelper
|
25
|
-
end
|
26
|
-
it 'should replace source path with the new path' do
|
27
|
-
@resource.filename_helper('doc/pages/resource', 'doc/pages', 'output').should == 'output/resource'
|
28
|
-
end
|
29
|
-
it 'should add new extension to the source extension' do
|
30
|
-
@resource.filename_helper('doc/pages/resource.ext', 'doc/pages', 'output', '.html').should == 'output/resource.ext.html'
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: layout
|
3
|
-
format:
|
4
|
-
- latex
|
5
|
-
- text
|
6
|
-
- custom:
|
7
|
-
filter:
|
8
|
-
- maruku-html
|
9
|
-
ext: html
|
10
|
-
---
|
11
|
-
|
12
|
-
This document can be rendered in the format below:
|
13
|
-
|
14
|
-
* html
|
15
|
-
* latex
|
16
|
-
* text
|
17
|
-
* custom
|
18
|
-
|
19
|
-
The custom format use maruku filter for html rendering.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout:
|
3
|
-
- clear
|
4
|
-
- nested/nested
|
5
|
-
- container
|
6
|
-
---
|
7
|
-
|
8
|
-
This is a document thai uses a nested layout inside a layout that acts as container.
|
9
|
-
Layouts are rendered in the same order of the array values above. That is:
|
10
|
-
|
11
|
-
result in result in
|
12
|
-
document_with_nested_layout ========> doc/layouts/nested/nested.html ========> doc/layouts/container.html
|
13
|
-
|
@@ -1,75 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# File 'clean_spec.rb' created on 14 apr 2008 at 16:00: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/clean_spec.rb
|
10
|
-
#
|
11
|
-
|
12
|
-
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__),'../../../lib')))
|
13
|
-
|
14
|
-
require 'rubygems'
|
15
|
-
require 'rake'
|
16
|
-
require 'spec'
|
17
|
-
require 'dokkit/tasklib/clean'
|
18
|
-
require 'spec/spec_helper.rb'
|
19
|
-
|
20
|
-
describe Dokkit::TaskLib::Clean do
|
21
|
-
include SpecHelper::Logger
|
22
|
-
before(:all) do
|
23
|
-
@initial_dir = Dir.pwd
|
24
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecHelper::Path::TEST_DATA))
|
25
|
-
end
|
26
|
-
after(:all) do
|
27
|
-
Dir.chdir(@initial_dir)
|
28
|
-
end
|
29
|
-
before do
|
30
|
-
@logger = logger
|
31
|
-
@rake = Rake.application
|
32
|
-
@clean = Dokkit::TaskLib::Clean.new(@logger, { :output_dir => 'output', :cache_dir => '.cache'} )
|
33
|
-
end
|
34
|
-
after do
|
35
|
-
Rake.application.clear
|
36
|
-
end
|
37
|
-
it 'should define a clean:output task' do
|
38
|
-
@rake.tasks.should include(task('clean:output'))
|
39
|
-
end
|
40
|
-
it 'should define a clean:cache task' do
|
41
|
-
@rake.tasks.should include(task('clean:cache'))
|
42
|
-
end
|
43
|
-
it 'should define a clean:all task' do
|
44
|
-
@rake.tasks.should include(task('clean:all'))
|
45
|
-
end
|
46
|
-
describe ' when clean:output is invoked' do
|
47
|
-
before do
|
48
|
-
mkdir 'output'
|
49
|
-
end
|
50
|
-
after do
|
51
|
-
rm_rf 'output'
|
52
|
-
end
|
53
|
-
it 'should remove output directory' do
|
54
|
-
@logger.stub!(:info)
|
55
|
-
@rake['clean:output'].execute({ })
|
56
|
-
File.exists?('output').should be_false
|
57
|
-
end
|
58
|
-
end
|
59
|
-
describe ' when clean:cache is invoked' do
|
60
|
-
before do
|
61
|
-
mkdir '.cache'
|
62
|
-
end
|
63
|
-
after do
|
64
|
-
rm_rf '.cache'
|
65
|
-
end
|
66
|
-
it 'should remove cache directory' do
|
67
|
-
@logger.stub!(:info)
|
68
|
-
@rake['clean:cache'].execute({ })
|
69
|
-
File.exists?('.cache').should be_false
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
|
@@ -1,125 +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)2006, 2007, 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
|
6
|
-
#
|
7
|
-
# To execute this spec run:
|
8
|
-
#
|
9
|
-
# spec spec/render_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/tasklib/render'
|
17
|
-
require 'spec/spec_helper.rb'
|
18
|
-
|
19
|
-
describe Dokkit::TaskLib::Render do
|
20
|
-
include SpecHelper::Resource, SpecHelper::Logger
|
21
|
-
before(:all) do
|
22
|
-
@initial_dir = Dir.pwd
|
23
|
-
Dir.chdir(File.join(File.dirname(__FILE__), SpecHelper::Path::TEST_DATA))
|
24
|
-
end
|
25
|
-
after(:all) do
|
26
|
-
Dir.chdir(@initial_dir)
|
27
|
-
end
|
28
|
-
before do
|
29
|
-
@rake = Rake.application
|
30
|
-
@document_1 = document_1
|
31
|
-
@document_2 = document_2
|
32
|
-
@data_1 = data_1
|
33
|
-
@resource_factory = resource_factory
|
34
|
-
@logger = logger
|
35
|
-
@render = Dokkit::TaskLib::Render.new(@logger, @resource_factory, ['doc/pages/document_1', 'doc/pages/document_2'], ['doc/data/data_1'])
|
36
|
-
end
|
37
|
-
after do
|
38
|
-
Rake.application.clear
|
39
|
-
end
|
40
|
-
it 'should define a render:doc task' do
|
41
|
-
@rake['render:doc'].should
|
42
|
-
end
|
43
|
-
it 'should define a render:data task' do
|
44
|
-
@rake['render:data'].should
|
45
|
-
end
|
46
|
-
it 'should define a render:all task' do
|
47
|
-
@rake['render:all'].prerequisites.should == ['render:doc', 'render:data']
|
48
|
-
end
|
49
|
-
describe ' when render:doc invoked' do
|
50
|
-
before do
|
51
|
-
@logger.stub!(:info)
|
52
|
-
@resource_factory.stub!(:get).and_return(@document_1, @document_2)
|
53
|
-
end
|
54
|
-
before do
|
55
|
-
@rake['render:doc'].execute({ })
|
56
|
-
end
|
57
|
-
after do
|
58
|
-
rm_rf 'output'
|
59
|
-
end
|
60
|
-
it 'should create the output directory' do
|
61
|
-
File.exists?('output').should be_true
|
62
|
-
end
|
63
|
-
it 'should create document_1.html' do
|
64
|
-
File.exists?('document_1.html')
|
65
|
-
end
|
66
|
-
it 'should create document_2.html' do
|
67
|
-
File.exists?('document_2.html')
|
68
|
-
end
|
69
|
-
it 'should create document_2.text' do
|
70
|
-
File.exists?('document_2.html')
|
71
|
-
end
|
72
|
-
end
|
73
|
-
describe ' when render:data invoked' do
|
74
|
-
before do
|
75
|
-
@logger.stub!(:info)
|
76
|
-
@resource_factory.stub!(:get).and_return(@data_1)
|
77
|
-
end
|
78
|
-
before do
|
79
|
-
@rake['render:data'].execute({ })
|
80
|
-
end
|
81
|
-
after do
|
82
|
-
rm_rf 'output'
|
83
|
-
end
|
84
|
-
it 'should create the output directory' do
|
85
|
-
File.exists?('output').should be_true
|
86
|
-
end
|
87
|
-
it 'should copy data_1' do
|
88
|
-
File.exists?('data_1')
|
89
|
-
end
|
90
|
-
end
|
91
|
-
describe ' when doc/data/data_1 has been changed' do
|
92
|
-
before do
|
93
|
-
@logger.stub!(:info)
|
94
|
-
@resource_factory.stub!(:get).and_return(@data_1)
|
95
|
-
@rake['render:data'].execute({ })
|
96
|
-
end
|
97
|
-
after do
|
98
|
-
rm_rf 'output'
|
99
|
-
end
|
100
|
-
it 'should re-render output/data_1' do
|
101
|
-
File.utime(0, Time.now, data_path('data_1'))
|
102
|
-
@logger.should_receive(:info).with(/copy/i)
|
103
|
-
@rake['render:data'].execute({ })
|
104
|
-
end
|
105
|
-
end
|
106
|
-
describe ' when doc/pages/document_1 has been changed' do
|
107
|
-
before do
|
108
|
-
@logger.stub!(:info)
|
109
|
-
@resource_factory.stub!(:get).and_return(@document_1)
|
110
|
-
@rake['render:doc'].execute({ })
|
111
|
-
end
|
112
|
-
after do
|
113
|
-
rm_rf 'output'
|
114
|
-
end
|
115
|
-
it 'should re-render output/document_1' do
|
116
|
-
File.utime(0, Time.now + 2, document_path('document_1'))
|
117
|
-
# FIXME: logger should receive *exactly* 2 times :info message
|
118
|
-
# but actually it receives four.. maybe there is some issue with
|
119
|
-
# Rake::Task#execute .. to investigate ..
|
120
|
-
@logger.should_receive(:info).at_least(2).with(/render/i)
|
121
|
-
@rake['render:doc'].execute({ })
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|