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 CHANGED
@@ -1,3 +1,5 @@
1
+ == 0.0.6
2
+ 2011-02-09: fixed fence-post error in Array#each_until
1
3
  == 0.0.5
2
4
  2010-01-28: refactored use of procs into explicit actions
3
5
  2009-12-19:simplified initiation of sitebuilder - just call "generate" method on a sitebuilder object
data/README.rdoc CHANGED
@@ -27,4 +27,4 @@ This is open source software and comes with no warranty. See COPYING for details
27
27
 
28
28
  http://www.greenbarsoft.co.uk
29
29
 
30
- Copyright 2009 Green Bar Software Limited, UK
30
+ Copyright 2009-2011 Green Bar Software Limited, UK
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
- demo.script(main):001:0> require 'sitebuilder'
5
+ >> require 'sitebuilder'
6
6
  => true
7
- demo.script(main):002:0> require 'rubygems'
7
+ >> require 'rubygems'
8
+ => false
9
+ >> require 'erb'
8
10
  => true
9
- demo.script(main):003:0> require 'erb'
10
- => true
11
- demo.script(main):004:0>
12
- demo.script(main):005:0* class Document
13
- demo.script(main):006:1> attr_reader :content
14
- demo.script(main):007:1> def initialize(c)
15
- demo.script(main):008:2> @content=c
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
- demo.script(main):011:0>
20
- demo.script(main):012:0* @templatepath =
21
- demo.script(main):013:0* swapout = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','source')
22
- => "/Users/daf/macbook/workspace/sitebuilder/examples/homepage/source"
23
- demo.script(main):014:0> replace = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','dest')
24
- => "/Users/daf/macbook/workspace/sitebuilder/examples/homepage/dest"
25
- demo.script(main):015:0>
26
- demo.script(main):016:0* #This is just a templating action - for real use, you'd need to process markup from "content" as well...
27
- demo.script(main):017:0* class TemplateAction < SiteBuilder::Action
28
- demo.script(main):018:1> def mapit(src, tmpl, dst)
29
- demo.script(main):019:2> template = ''
30
- demo.script(main):020:2> File.open(tmpl) do |f|
31
- demo.script(main):021:3* f.readlines.each {|l| template += l }
32
- demo.script(main):022:3> end
33
- demo.script(main):023:2> content = ''
34
- demo.script(main):024:2> File.open(src) do |c|
35
- demo.script(main):025:3* c.readlines.each {|l| content += l }
36
- demo.script(main):026:3> end
37
- demo.script(main):027:2> e = ERB.new template
38
- demo.script(main):028:2> document = Document.new(content)
39
- demo.script(main):029:2> File.open(dst,'w') do |f|
40
- demo.script(main):030:3* f.puts e.result(binding)
41
- demo.script(main):031:3> end
42
- demo.script(main):032:2> end
43
- demo.script(main):033:1>
44
- demo.script(main):034:1* def convert(s, r)
45
- demo.script(main):035:2> templatepath = File.join(ENV['SANDBOX'],'sitebuilder','examples','homepage','template.rhtml')
46
- demo.script(main):036:2> mapit(s.path, templatepath, File.join(r,s.extnless+'.html'))
47
- demo.script(main):037:2> end
48
- demo.script(main):038:1> end
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
- demo.script(main):039:0>
51
- demo.script(main):040:0* s = SiteBuilder::SiteGenerator.new(swapout,replace)
52
- => #<SiteBuilder::SiteGenerator:0x63c61c @swapout="/Users/daf/macbook/workspace/sitebuilder/examples/homepage/source", @actions={}, @replace="/Users/daf/macbook/workspace/sitebuilder/examples/homepage/dest">
53
- demo.script(main):041:0> s.add_action('.art', TemplateAction.new)
54
- => #<TemplateAction:0x6336e8>
55
- demo.script(main):042:0>
56
- demo.script(main):043:0* s.add_action('.idx', SiteBuilder::CopyAction.new)
57
- => #<SiteBuilder::CopyAction:0x627938>
58
- demo.script(main):044:0> s.add_action('.png', SiteBuilder::CopyAction.new)
59
- => #<SiteBuilder::CopyAction:0x620994>
60
- demo.script(main):045:0> s.add_action('.css', SiteBuilder::CopyAction.new)
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
 
@@ -4,7 +4,7 @@ class Array
4
4
  # parameter until the block returns true
5
5
  def each_until(&block)
6
6
  return false if empty?
7
- for i in 0..size
7
+ for i in 0..size-1
8
8
  result_true = block.call(self[i])
9
9
  break if result_true
10
10
  end
@@ -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=NullAction.new)
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+1, pass_count,'should have traversed elements 1, 2 and 33')
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
- version: 0.0.5
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: 2010-01-28 00:00:00 +00:00
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
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
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
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
25
37
  - !ruby/object:Gem::Dependency
26
38
  name: mocha
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
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
- version:
51
+ type: :development
52
+ version_requirements: *id002
35
53
  - !ruby/object:Gem::Dependency
36
54
  name: rcov
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
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
- version:
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.5
133
+ rubygems_version: 1.3.7
100
134
  signing_key:
101
135
  specification_version: 3
102
136
  summary: Static site generator