sitebuilder 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +2 -0
- data/README.rdoc +1 -1
- data/doc/demo.rdoc +53 -60
- data/doc/demo.script +1 -4
- data/lib/sitebuilder/array.rb +1 -1
- data/lib/sitebuilder/sitegenerator.rb +1 -1
- data/test/array_test.rb +1 -1
- metadata +51 -17
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
data/doc/demo.rdoc
CHANGED
@@ -2,69 +2,62 @@
|
|
2
2
|
|
3
3
|
If using sitebuilder from a gem, remember to "require 'rubygems'"...
|
4
4
|
|
5
|
-
|
5
|
+
>> require 'sitebuilder'
|
6
6
|
=> true
|
7
|
-
|
7
|
+
>> require 'rubygems'
|
8
|
+
=> false
|
9
|
+
>> require 'erb'
|
8
10
|
=> true
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
demo.script(main):009:2> end
|
17
|
-
demo.script(main):010:1> end
|
11
|
+
>>
|
12
|
+
?> class Document
|
13
|
+
>> attr_reader :content
|
14
|
+
>> def initialize(c)
|
15
|
+
>> @content=c
|
16
|
+
>> end
|
17
|
+
>> end
|
18
18
|
=> nil
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
=> "/Users/
|
23
|
-
|
24
|
-
=> "/Users/
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
19
|
+
>>
|
20
|
+
?> @templatepath =
|
21
|
+
?> swapout = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','source')
|
22
|
+
=> "/Users/dev/sitebuilder/examples/homepage/source"
|
23
|
+
>> replace = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','dest')
|
24
|
+
=> "/Users/dev/sitebuilder/examples/homepage/dest"
|
25
|
+
>>
|
26
|
+
?> #This is just a templating action - for real use, you'd need to process markup from "content" as well...
|
27
|
+
?> class TemplateAction < SiteBuilder::Action
|
28
|
+
>> def mapit(src, tmpl, dst)
|
29
|
+
>> template = ''
|
30
|
+
>> File.open(tmpl) do |f|
|
31
|
+
?> f.readlines.each {|l| template += l }
|
32
|
+
>> end
|
33
|
+
>> content = ''
|
34
|
+
>> File.open(src) do |c|
|
35
|
+
?> c.readlines.each {|l| content += l }
|
36
|
+
>> end
|
37
|
+
>> e = ERB.new template
|
38
|
+
>> document = Document.new(content)
|
39
|
+
>> File.open(dst,'w') do |f|
|
40
|
+
?> f.puts e.result(binding)
|
41
|
+
>> end
|
42
|
+
>> end
|
43
|
+
>>
|
44
|
+
?> def convert(s, r)
|
45
|
+
>> templatepath = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','template.rhtml')
|
46
|
+
>> mapit(s.path, templatepath, File.join(r,s.extnless+'.html'))
|
47
|
+
>> end
|
48
|
+
>> end
|
49
49
|
=> nil
|
50
|
-
|
51
|
-
|
52
|
-
=> #<SiteBuilder::SiteGenerator:
|
53
|
-
|
54
|
-
=> #<TemplateAction:
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
=> #<SiteBuilder::CopyAction:0x618384>
|
62
|
-
demo.script(main):046:0> s.generate
|
63
|
-
cp /Users/daf/macbook/workspace/sitebuilder/examples/homepage/source/homepage.css /Users/daf/macbook/workspace/sitebuilder/examples/homepage/dest
|
64
|
-
=> #<Dir:0x615a94>
|
65
|
-
demo.script(main):047:0>
|
66
|
-
demo.script(main):048:0* demo.script(main):048:0>
|
67
|
-
|
50
|
+
>>
|
51
|
+
?> s = SiteBuilder::SiteGenerator.new(swapout,replace)
|
52
|
+
=> #<SiteBuilder::SiteGenerator:0x1015af760 @actions={}, @replace="/Users/dev/sitebuilder/examples/homepage/dest", @swapout="/Users/dev/sitebuilder/examples/homepage/source">
|
53
|
+
>> s.add_action('.art', TemplateAction.new)
|
54
|
+
=> #<TemplateAction:0x1015ab048>
|
55
|
+
>> # CopyAction.new is the default value for unrecognised file extensions
|
56
|
+
?> s.generate
|
57
|
+
cp /Users/dev/sitebuilder/examples/homepage/source/homepage.css /Users/dev/sitebuilder/examples/homepage/dest
|
58
|
+
=> #<Dir:/Users/dev/sitebuilder/examples/homepage/source>
|
59
|
+
>>
|
60
|
+
?> >>
|
68
61
|
|
69
|
-
Sitebuilder 0.0.4
|
70
62
|
|
63
|
+
Sitebuilder 0.0.6
|
data/doc/demo.script
CHANGED
@@ -39,9 +39,6 @@ end
|
|
39
39
|
|
40
40
|
s = SiteBuilder::SiteGenerator.new(swapout,replace)
|
41
41
|
s.add_action('.art', TemplateAction.new)
|
42
|
-
|
43
|
-
s.add_action('.idx', SiteBuilder::CopyAction.new)
|
44
|
-
s.add_action('.png', SiteBuilder::CopyAction.new)
|
45
|
-
s.add_action('.css', SiteBuilder::CopyAction.new)
|
42
|
+
# CopyAction.new is the default value for unrecognised file extensions
|
46
43
|
s.generate
|
47
44
|
|
data/lib/sitebuilder/array.rb
CHANGED
@@ -11,7 +11,7 @@ module SiteBuilder
|
|
11
11
|
class SiteGenerator < Traverser
|
12
12
|
|
13
13
|
# I set up the source website directory and the destination website directory.
|
14
|
-
def initialize(source, destination, default_action=
|
14
|
+
def initialize(source, destination, default_action=CopyAction.new)
|
15
15
|
@swapout = source
|
16
16
|
@replace = destination
|
17
17
|
@actions = {}
|
data/test/array_test.rb
CHANGED
@@ -29,7 +29,7 @@ def test_each_until_not_found
|
|
29
29
|
pass_count = 0
|
30
30
|
result = unit.each_until {|i| pass_count=pass_count+1; true if i==3}
|
31
31
|
assert_equal(false, result, 'should return false')
|
32
|
-
assert_equal(unit.length
|
32
|
+
assert_equal(unit.length, pass_count,'should have traversed all elements')
|
33
33
|
end
|
34
34
|
|
35
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitebuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Dafydd Rees
|
@@ -9,39 +15,57 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2011-02-09 00:00:00 +00:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: semantictext
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 19
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 2
|
33
|
+
- 2
|
23
34
|
version: 0.2.2
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: mocha
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 43
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 9
|
49
|
+
- 8
|
33
50
|
version: 0.9.8
|
34
|
-
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
35
53
|
- !ruby/object:Gem::Dependency
|
36
54
|
name: rcov
|
37
|
-
|
38
|
-
|
39
|
-
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
40
58
|
requirements:
|
41
59
|
- - ">="
|
42
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 55
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
- 9
|
65
|
+
- 6
|
43
66
|
version: 0.9.6
|
44
|
-
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
45
69
|
description: Static website generator using rule-based translation.
|
46
70
|
email: os@greenbarsoft.co.uk
|
47
71
|
executables: []
|
@@ -67,6 +91,10 @@ files:
|
|
67
91
|
- test/filesystem_test.rb
|
68
92
|
- test/sitegenerator_test.rb
|
69
93
|
- test/string_test.rb
|
94
|
+
- ./test/array_test.rb
|
95
|
+
- ./test/filesystem_test.rb
|
96
|
+
- ./test/sitegenerator_test.rb
|
97
|
+
- ./test/string_test.rb
|
70
98
|
- CHANGELOG.rdoc
|
71
99
|
- COPYING
|
72
100
|
- README.rdoc
|
@@ -82,21 +110,27 @@ rdoc_options: []
|
|
82
110
|
require_paths:
|
83
111
|
- lib
|
84
112
|
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
85
114
|
requirements:
|
86
115
|
- - ">="
|
87
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
118
|
+
segments:
|
119
|
+
- 0
|
88
120
|
version: "0"
|
89
|
-
version:
|
90
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
91
123
|
requirements:
|
92
124
|
- - ">="
|
93
125
|
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
94
129
|
version: "0"
|
95
|
-
version:
|
96
130
|
requirements: []
|
97
131
|
|
98
132
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.3.
|
133
|
+
rubygems_version: 1.3.7
|
100
134
|
signing_key:
|
101
135
|
specification_version: 3
|
102
136
|
summary: Static site generator
|