webby 0.7.4 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/History.txt +19 -0
  2. data/Manifest.txt +19 -6
  3. data/README.txt +21 -5
  4. data/Rakefile +2 -3
  5. data/data/Rakefile +1 -1
  6. data/data/lib/breadcrumbs.rb +28 -0
  7. data/data/tasks/create.rake +0 -1
  8. data/data/tasks/deploy.rake +0 -1
  9. data/data/tasks/growl.rake +0 -1
  10. data/data/tasks/heel.rake +2 -3
  11. data/data/tasks/setup.rb +0 -1
  12. data/data/templates/_partial.erb +10 -0
  13. data/data/templates/atom_feed.erb +34 -0
  14. data/examples/webby/content/manual/index.txt +11 -13
  15. data/examples/webby/content/tutorial/index.txt +1 -1
  16. data/examples/webby/tasks/heel.rake +2 -2
  17. data/examples/webby/tasks/setup.rb +6 -1
  18. data/lib/webby.rb +50 -23
  19. data/lib/webby/auto_builder.rb +4 -2
  20. data/lib/webby/builder.rb +6 -5
  21. data/lib/webby/filters.rb +6 -7
  22. data/lib/webby/filters/outline.rb +4 -2
  23. data/lib/webby/filters/tidy.rb +4 -2
  24. data/lib/webby/helpers.rb +32 -0
  25. data/lib/webby/helpers/coderay_helper.rb +78 -0
  26. data/lib/webby/helpers/graphviz_helper.rb +158 -0
  27. data/lib/webby/helpers/tag_helper.rb +9 -4
  28. data/lib/webby/helpers/tex_img_helper.rb +181 -0
  29. data/lib/webby/helpers/url_helper.rb +12 -11
  30. data/lib/webby/renderer.rb +97 -18
  31. data/lib/webby/resources.rb +82 -0
  32. data/lib/webby/{pages_db.rb → resources/db.rb} +63 -33
  33. data/lib/webby/{file.rb → resources/file.rb} +27 -24
  34. data/lib/webby/resources/layout.rb +65 -0
  35. data/lib/webby/resources/page.rb +109 -0
  36. data/lib/webby/resources/partial.rb +81 -0
  37. data/lib/webby/resources/resource.rb +145 -0
  38. data/lib/webby/resources/static.rb +54 -0
  39. data/lib/webby/stelan/mktemp.rb +137 -0
  40. data/lib/webby/stelan/spawner.rb +5 -1
  41. data/lib/webby/utils.rb +3 -1
  42. data/lib/webby/webby_task.rb +43 -24
  43. data/spec/spec_helper.rb +12 -1
  44. data/spec/webby/{file_spec.rb → resources/file_spec.rb} +21 -22
  45. data/tasks/ann.rake +76 -0
  46. data/tasks/annotations.rake +6 -14
  47. data/tasks/bones.rake +40 -0
  48. data/tasks/doc.rake +1 -2
  49. data/tasks/gem.rake +29 -2
  50. data/tasks/manifest.rake +15 -21
  51. data/tasks/post_load.rake +22 -8
  52. data/tasks/setup.rb +53 -15
  53. data/tasks/spec.rake +13 -0
  54. metadata +22 -9
  55. data/lib/webby/filters/coderay.rb +0 -98
  56. data/lib/webby/filters/graphviz.rb +0 -189
  57. data/lib/webby/resource.rb +0 -293
data/History.txt CHANGED
@@ -1,3 +1,22 @@
1
+ == 0.8.0 / 2008-02-28
2
+
3
+ * 3 major enhancements
4
+ - Added support for partials
5
+ - Refactored the coderay and graphviz filters into helper methods
6
+ accessible from ERB
7
+ - Added support for embedding LaTeX mathematical equations
8
+ * 3 minor enhancements
9
+ - Added a template file for creating Atom feeds
10
+ - The SITE configuration is available in pages and layouts as
11
+ the @config variable
12
+ - Can specify the port the Heel webserver starts on using the
13
+ SITE.heel_port option in the Rakefile
14
+ * 2 bug fixes
15
+ - When creating pages in directory mode the full page path was
16
+ not being created
17
+ - Read only files were being created in the output folder
18
+ preventing them from being overwritten if changed
19
+
1
20
  == 0.7.4 / 2008-02-15
2
21
 
3
22
  * 3 minor enhancements
data/Manifest.txt CHANGED
@@ -30,11 +30,14 @@ data/content/css/coderay.css
30
30
  data/content/css/site.css
31
31
  data/content/index.txt
32
32
  data/layouts/default.rhtml
33
+ data/lib/breadcrumbs.rb
33
34
  data/tasks/create.rake
34
35
  data/tasks/deploy.rake
35
36
  data/tasks/growl.rake
36
37
  data/tasks/heel.rake
37
38
  data/tasks/setup.rb
39
+ data/templates/_partial.erb
40
+ data/templates/atom_feed.erb
38
41
  data/templates/page.erb
39
42
  examples/webby/Rakefile
40
43
  examples/webby/content/css/blueprint/print.css
@@ -59,32 +62,42 @@ examples/webby/templates/page.erb
59
62
  lib/webby.rb
60
63
  lib/webby/auto_builder.rb
61
64
  lib/webby/builder.rb
62
- lib/webby/file.rb
63
65
  lib/webby/filters.rb
64
66
  lib/webby/filters/basepath.rb
65
- lib/webby/filters/coderay.rb
66
67
  lib/webby/filters/erb.rb
67
- lib/webby/filters/graphviz.rb
68
68
  lib/webby/filters/haml.rb
69
69
  lib/webby/filters/markdown.rb
70
70
  lib/webby/filters/outline.rb
71
71
  lib/webby/filters/sass.rb
72
72
  lib/webby/filters/textile.rb
73
73
  lib/webby/filters/tidy.rb
74
+ lib/webby/helpers.rb
75
+ lib/webby/helpers/coderay_helper.rb
76
+ lib/webby/helpers/graphviz_helper.rb
74
77
  lib/webby/helpers/tag_helper.rb
78
+ lib/webby/helpers/tex_img_helper.rb
75
79
  lib/webby/helpers/url_helper.rb
76
80
  lib/webby/main.rb
77
- lib/webby/pages_db.rb
78
81
  lib/webby/renderer.rb
79
- lib/webby/resource.rb
82
+ lib/webby/resources.rb
83
+ lib/webby/resources/db.rb
84
+ lib/webby/resources/file.rb
85
+ lib/webby/resources/layout.rb
86
+ lib/webby/resources/page.rb
87
+ lib/webby/resources/partial.rb
88
+ lib/webby/resources/resource.rb
89
+ lib/webby/resources/static.rb
90
+ lib/webby/stelan/mktemp.rb
80
91
  lib/webby/stelan/paginator.rb
81
92
  lib/webby/stelan/spawner.rb
82
93
  lib/webby/utils.rb
83
94
  lib/webby/webby_task.rb
84
95
  spec/spec.opts
85
96
  spec/spec_helper.rb
86
- spec/webby/file_spec.rb
97
+ spec/webby/resources/file_spec.rb
98
+ tasks/ann.rake
87
99
  tasks/annotations.rake
100
+ tasks/bones.rake
88
101
  tasks/doc.rake
89
102
  tasks/gem.rake
90
103
  tasks/manifest.rake
data/README.txt CHANGED
@@ -6,9 +6,17 @@ Webby
6
6
 
7
7
  == DESCRIPTION:
8
8
 
9
- Webby is a super fantastic little website management system. It would be called a _content management system_ if it were a bigger kid. But, it's just a runt with a special knack for transforming text. And that's really all it does - manages the legwork of turning text into something else, an *ASCII Alchemist* if you will.
10
-
11
- Webby works by combining the contents of a *page* with a *layout* to produce HTML. The layout contains everything common to all the pages - HTML headers, navigation menu, footer, etc. - and the page contains just the information for that page. You can use your favorite markup language to write your pages; Webby supports quite a few.
9
+ Webby is a super fantastic little website management system. It would be
10
+ called a _content management system_ if it were a bigger kid. But, it's
11
+ just a runt with a special knack for transforming text. And that's really
12
+ all it does - manages the legwork of turning text into something else, an
13
+ *ASCII Alchemist* if you will.
14
+
15
+ Webby works by combining the contents of a *page* with a *layout* to
16
+ produce HTML. The layout contains everything common to all the pages -
17
+ HTML headers, navigation menu, footer, etc. - and the page contains just
18
+ the information for that page. You can use your favorite markup language
19
+ to write your pages; Webby supports quite a few.
12
20
 
13
21
  Install Webby and try it out!
14
22
 
@@ -23,7 +31,11 @@ Install Webby and try it out!
23
31
 
24
32
  But Wait! There's More!
25
33
 
26
- Webby has a great _autobuild_ feature that continuously generates HTML whenever the *pages* or *layouts* change. The HTML is served up via {heel}[http://copiousfreetime.rubyforge.org/heel/], a static file webserver based on mongrel. Whenever you change a page, you can immediately see those changes without having to run any commands.
34
+ Webby has a great _autobuild_ feature that continuously generates HTML whenever
35
+ the *pages* or *layouts* change. The HTML is served up via
36
+ {heel}[http://copiousfreetime.rubyforge.org/heel/], a static file webserver
37
+ based on mongrel. Whenever you change a page, you can immediately see those
38
+ changes without having to run any commands.
27
39
 
28
40
  $ rake autobuild
29
41
  heel --root output --daemonize
@@ -33,7 +45,11 @@ Webby has a great _autobuild_ feature that continuously generates HTML whenever
33
45
  - started at 10:22:57
34
46
  creating output/index.html
35
47
 
36
- Webby is not limited to producing HTML. By no means! Do you ever get tired of repeating the same color code <b>#D3C4A2</b> in your CSS files? Webby can help. Need some customized JavaScript for your website. Webby can help. Anytime you find yourself repeating the same bit of text over and over, then you should be using Webby.
48
+ Webby is not limited to producing HTML. By no means! Do you ever get tired of
49
+ repeating the same color code <b>#D3C4A2</b> in your CSS files? Webby can help.
50
+ Need some customized JavaScript for your website. Webby can help. Anytime you
51
+ find yourself repeating the same bit of text over and over, then you should be
52
+ using Webby.
37
53
 
38
54
  == INSTALL:
39
55
 
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # $Id: Rakefile 148 2008-02-15 05:26:56Z tim_pease $
1
+ # $Id: Rakefile 155 2008-02-17 00:48:30Z tim_pease $
2
2
 
3
3
  load 'tasks/setup.rb'
4
4
 
@@ -18,7 +18,6 @@ PROJ.rdoc_dir = 'doc/rdoc'
18
18
  PROJ.rdoc_remote_dir = 'rdoc'
19
19
  PROJ.version = Webby::VERSION
20
20
 
21
-
22
21
  PROJ.exclude << '^examples/[^/]+/output'
23
22
  PROJ.exclude << '^tasks/archive'
24
23
  PROJ.exclude << '^tags$'
@@ -32,7 +31,7 @@ PROJ.spec_opts << '--color'
32
31
  depend_on 'directory_watcher'
33
32
  depend_on 'heel'
34
33
  depend_on 'hpricot'
35
- depend_on 'logging', '0.7.0'
34
+ depend_on 'logging'
36
35
  depend_on 'rake'
37
36
  depend_on 'rspec'
38
37
 
data/data/Rakefile CHANGED
@@ -4,7 +4,7 @@ load 'tasks/setup.rb'
4
4
 
5
5
  task :default => :build
6
6
 
7
- desc 'depoloy the site to the webserver'
7
+ desc 'deploy the site to the webserver'
8
8
  task :deploy => [:build, 'deploy:rsync']
9
9
 
10
10
  # EOF
@@ -0,0 +1,28 @@
1
+ # breadcrumbs.rb
2
+
3
+ module BreadcrumbsHelper
4
+ # call-seq:
5
+ # breadcrumbs( page ) => html
6
+ #
7
+ # Create breadcrumb links for the current page. This will return an HTML
8
+ # <ul></ul> object.
9
+ #
10
+ def breadcrumbs( page )
11
+ list = ["<li>#{h(page.title)}</li>"]
12
+ loop do
13
+ page = @pages.parent_of(page)
14
+ break if page.nil?
15
+ list << "<li>#{link_to_page(page)}</li>"
16
+ end
17
+ list.reverse!
18
+
19
+ html = "<ul class=\"breadcrumbs\">\n"
20
+ html << list.join("\n")
21
+ html << "\n</ul>\n"
22
+ html
23
+ end
24
+ end # module Breadcrumbs
25
+
26
+ Webby::Helpers.register(BreadcrumbsHelper)
27
+
28
+ # EOF
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  Rake::WebbyTask.new
4
3
 
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  require 'rake/contrib/sshpublisher'
4
3
 
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  desc 'send log events to Growl (Mac OS X only)'
4
3
  task :growl do
data/data/tasks/heel.rake CHANGED
@@ -1,10 +1,9 @@
1
- # $Id$
2
1
 
3
2
  namespace :heel do
4
3
 
5
4
  desc 'start the heel server to view website (not for Windows)'
6
5
  task :start do
7
- sh "heel --root #{SITE.output_dir} --daemonize"
6
+ sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
8
7
  end
9
8
 
10
9
  desc 'stop the heel server'
@@ -14,7 +13,7 @@ namespace :heel do
14
13
 
15
14
  task :autorun do
16
15
  heel_exe = File.join(Gem.bindir, 'heel')
17
- @heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, :pause => 86_400)
16
+ @heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, '--port', SITE.heel_port.to_s, :pause => 86_400)
18
17
  @heel_spawner.start
19
18
  end
20
19
 
data/data/tasks/setup.rb CHANGED
@@ -1,4 +1,3 @@
1
- # $Id$
2
1
 
3
2
  begin
4
3
  require 'webby'
@@ -0,0 +1,10 @@
1
+ ---
2
+ filter: erb
3
+ ---
4
+ A partial has access to the page from which it was called. The title below will be the title of the page in which this partial is rendered.
5
+
6
+ <%%= h(@page.title) %>
7
+
8
+ A partial does not have access to it's own meta-data. The partial meta-data is used primarily for finding partials or for use in other pages. The filter(s) specified in the meta-data will be applied to the partial text when it is rendered.
9
+
10
+ A partial does not require meta-data at all. They can contain just text.
@@ -0,0 +1,34 @@
1
+ ---
2
+ extension: xml
3
+ layout: false
4
+ dirty: true
5
+ filter:
6
+ - erb
7
+ ---
8
+ <?xml version="1.0" encoding="utf-8"?>
9
+ <feed xmlns="http://www.w3.org/2005/Atom">
10
+
11
+ <title>A New Atom Feed</title>
12
+ <subtitle>a really swell blog</subtitle>
13
+ <link href="http://fakesite.nil/feed/" rel="self"/>
14
+ <link href="http://fakesite.nil/"/>
15
+ <updated><%%= Time.now.xmlschema %></updated>
16
+ <author>
17
+ <name>Author's Name</name>
18
+ <email>author@fakesite.nil</email>
19
+ </author>
20
+ <id>http://fakesite.nil/</id>
21
+ <%% @pages.find(:limit => 10,
22
+ :in_directory => 'articles',
23
+ :recursive => true,
24
+ :sort_by => 'created_at',
25
+ :reverse => true).each do |article| %>
26
+ <entry>
27
+ <title><%%= h(article.title) %></title>
28
+ <link href="<%%= article.url %>"/>
29
+ <id>tag:fakesite.nil,<%%= article.created_at.strftime('%Y-%m-%d') %>:<%%= article.created_at.to_i %></id>
30
+ <updated><%%= article.created_at.xmlschema %></updated>
31
+ <content type="html"><%%= h(article.render) %></content>
32
+ </entry>
33
+ <%% end %>
34
+ </feed>
@@ -3,8 +3,6 @@ title: Manual
3
3
  created_at: Wed Aug 29 08:57:00 -0600 2007
4
4
  filter:
5
5
  - erb
6
- - graphviz
7
- - coderay
8
6
  - textile
9
7
  - outline
10
8
  ---
@@ -19,7 +17,7 @@ h2{clear:none}. Introduction
19
17
 
20
18
  Webby was created out of the need for a simple way to build and manage small websites. The desire was for a system that could take files written in plain text, combine them with a layout file and produce web pages. In this system, a single page can be written quickly without the need for HTML markup; the look and feel of the entire site can be changed by modifying the site layout file.
21
19
 
22
- <graphviz path="images" alt="Webby Overview">
20
+ <% graphviz :path => "images", :alt => "Webby Overview" do %>
23
21
  digraph overview {
24
22
  rankdir = LR;
25
23
  edge [fontname="Verdana", fontsize=8];
@@ -37,7 +35,7 @@ digraph overview {
37
35
  p2 -> layout -> h2 [color=green];
38
36
  p3 -> layout -> h3 [color=blue];
39
37
  }
40
- </graphviz>
38
+ <% end %>
41
39
 
42
40
  The diagram above shows the basic concept of how Webby works. Changing the layout file will result in changes to every generated HTML file. Changes to a single page will result in changes only to the HTML file corresponding to that particular page.
43
41
 
@@ -74,7 +72,7 @@ Webby can also use a few other programs to clean up generated HTML and to create
74
72
 
75
73
  h3. Running Webby
76
74
 
77
- When the Webby gem is installed it also installs a @webby@ executable program. This program is used to create a new website and to udpate the associated rake tasks when a new version of Webby is released. Typing in @webby --help@ will show you the options this program supports. After you create a webiste, though, the webby command will not be needed.
75
+ When the Webby gem is installed it also installs a @webby@ executable program. This program is used to create a new website and to update the associated rake tasks when a new version of Webby is released. Typing in @webby --help@ will show you the options this program supports. After you create a webiste, though, the webby command will not be needed.
78
76
 
79
77
  <pre>
80
78
  $ webby --help
@@ -88,7 +86,7 @@ common options:
88
86
  --version show version
89
87
  </pre>
90
88
 
91
- The tasks of building the webiste and deploying it to the destnation server are handled by "Rake":http://docs.rubyrake.org/, a Ruby version of the more famous *make* program. Several rake tasks are provided by default. You are free to create others to make developing and deploying your webiste easier. To see the current list of rake tasks type in @rake -T@.
89
+ The tasks of building the webiste and deploying it to the destination server are handled by "Rake":http://docs.rubyrake.org/, a Ruby version of the more famous *make* program. Several rake tasks are provided by default. You are free to create others to make developing and deploying your webiste easier. To see the current list of rake tasks type in @rake -T@.
92
90
 
93
91
  <pre>
94
92
  $ rake -T
@@ -97,7 +95,7 @@ rake autobuild # continuously build the website
97
95
  rake build # build the website
98
96
  rake clobber # delete the website
99
97
  rake create:page # create a new page
100
- rake deploy # depoloy the site to the webserver
98
+ rake deploy # deploy the site to the webserver
101
99
  rake deploy:rsync # deploy to the server using rsync
102
100
  rake deploy:ssh # deploy to the server using ssh
103
101
  rake heel:start # start the heel server to view website (not for Windows)
@@ -188,7 +186,7 @@ h3. Layouts
188
186
 
189
187
  Layouts provide the basic framework for a page -- the header, the footer, the navigation. They provide a consistent look and feel across all pages in the website. Individual pages contain just the content for that particular page.
190
188
 
191
- <graphviz path="images" class="push-0" alt="layout diagram">
189
+ <% graphviz :path => "images", :class => "push-0", :alt => "layout diagram" do %>
192
190
  digraph layout_graph {
193
191
  rankdir = LR;
194
192
  edge [fontname="Verdana", fontsize=8];
@@ -197,7 +195,7 @@ digraph layout_graph {
197
195
  page -> layout [label="rendered\ninto"];
198
196
  layout -> HTML [label="results\nin"];
199
197
  }
200
- </graphviz>
198
+ <% end %>
201
199
 
202
200
  The diagram to the right shows a typical page rendering process. The content of a page is rendered by the Webby filter engine. The rendered content is inserted into the layout specified by the page; the content insertion occurs as the layout is being rendered. The result is the HTML that is stored in the _output_ folder.
203
201
 
@@ -337,14 +335,14 @@ end
337
335
  &lt;/coderay&gt;</notextile>
338
336
  </pre>
339
337
 
340
- <coderay lang="ruby" line_numbers="inline">
338
+ <% coderay :lang => "ruby", :line_numbers => "inline" do %>
341
339
  class Object
342
340
  def returning( r )
343
341
  yield r if block_given?
344
342
  r
345
343
  end
346
344
  end
347
- </coderay>
345
+ <% end %>
348
346
 
349
347
  p(column span-2). *Usage*:
350
348
 
@@ -375,12 +373,12 @@ digraph hello_world {
375
373
  &lt;/graphviz&gt;</notextile>
376
374
  </pre>
377
375
 
378
- <graphviz path="images" alt="hello world graph">
376
+ <% graphviz :path => "images", :alt => "hello world graph" do %>
379
377
  digraph hello_world {
380
378
  rankdir = LR;
381
379
  Hello -> World;
382
380
  }
383
- </graphviz>
381
+ <% end %>
384
382
 
385
383
  p(column span-2). *Usage*:
386
384
 
@@ -127,4 +127,4 @@ h2. What Now?
127
127
 
128
128
  Let your creativity run wild!
129
129
 
130
- You can read more about the features of Webby in the "manual":manual.html. There you'll discover how to reference layouts other than the default, how to create page templates for simplifying blog posts. Take a look at the "tips &amp; tricks":tips_and_tricks.html for more ideas on simplifying your web development work cycle.
130
+ You can read more about the features of Webby in the "manual":manual/index.html. There you'll discover how to reference layouts other than the default, how to create page templates for simplifying blog posts. Take a look at the "tips &amp; tricks":tips_and_tricks.html for more ideas on simplifying your web development work cycle.
@@ -3,7 +3,7 @@ namespace :heel do
3
3
 
4
4
  desc 'start the heel server to view website (not for Windows)'
5
5
  task :start do
6
- sh "heel --root #{SITE.output_dir} --daemonize"
6
+ sh "heel --root #{SITE.output_dir} --port #{SITE.heel_port} --daemonize"
7
7
  end
8
8
 
9
9
  desc 'stop the heel server'
@@ -13,7 +13,7 @@ namespace :heel do
13
13
 
14
14
  task :autorun do
15
15
  heel_exe = File.join(Gem.bindir, 'heel')
16
- @heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, :pause => 86_400)
16
+ @heel_spawner = Spawner.new(Spawner.ruby, heel_exe, '--root', SITE.output_dir, '--port', SITE.heel_port.to_s, :pause => 86_400)
17
17
  @heel_spawner.start
18
18
  end
19
19
 
@@ -1,5 +1,10 @@
1
1
 
2
- require 'webby'
2
+ begin
3
+ require 'webby'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ require 'webby'
7
+ end
3
8
 
4
9
  SITE = Webby.site
5
10
 
data/lib/webby.rb CHANGED
@@ -1,5 +1,12 @@
1
- # $Id: webby.rb 145 2008-02-13 00:39:03Z tim_pease $
1
+ # $Id: webby.rb 180 2008-02-29 05:03:21Z tim_pease $
2
2
 
3
+ # TODO: add support for inlining background gradients (in the CSS)
4
+
5
+ # Equivalent to a header guard in C/C++
6
+ # Used to prevent the spec helper from being loaded more than once
7
+ unless defined? ::Webby
8
+
9
+ require 'rubygems'
3
10
  require 'logging'
4
11
  require 'ostruct'
5
12
  require 'date'
@@ -15,29 +22,14 @@ Logging::Appender.stdout.layout = Logging::Layouts::Pattern.new(
15
22
 
16
23
  module Webby
17
24
 
18
- VERSION = '0.7.4' # :nodoc:
19
-
20
- # Path to the Webby package
21
- PATH = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..'))
25
+ # :stopdoc:
26
+ VERSION = '0.8.0' # :nodoc:
27
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
28
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
29
+ # :startdoc:
22
30
 
23
31
  class Error < StandardError; end # :nodoc:
24
32
 
25
- # call-seq:
26
- # Webby.require_all_libs_relative_to( filename, directory = nil )
27
- #
28
- # Utility method used to rquire all files ending in .rb that lie in the
29
- # directory below this file that has the same name as the filename passed
30
- # in. Optionally, a specific _directory_ name can be passed in such that
31
- # the _filename_ does not have to be equivalent to the directory.
32
- #
33
- def self.require_all_libs_relative_to( fname, dir = nil )
34
- dir ||= File.basename(fname, '.*')
35
- search_me = File.expand_path(
36
- File.join(File.dirname(fname), dir, '**', '*.rb'))
37
-
38
- Dir.glob(search_me).sort.each {|rb| require rb}
39
- end
40
-
41
33
  # call-seq:
42
34
  # Webby.site => struct
43
35
  #
@@ -60,6 +52,9 @@ module Webby
60
52
  :base => nil,
61
53
  :create_mode => 'page',
62
54
 
55
+ # Items for running the heel webserver
56
+ :heel_port => 4331,
57
+
63
58
  # Items used to deploy the webiste
64
59
  :host => 'user@hostname.tld',
65
60
  :remote_dir => '/not/a/valid/dir',
@@ -107,9 +102,40 @@ module Webby
107
102
  # modification time of the file is important.
108
103
  #
109
104
  def self.cairn
110
- @cairn ||= File.join(site.output_dir, '.cairn')
105
+ @cairn ||= ::File.join(site.output_dir, '.cairn')
111
106
  end
112
107
 
108
+ # Returns the library path for Webby. If any arguments are given,
109
+ # they will be joined to the end of the libray path using
110
+ # <tt>File.join</tt>.
111
+ #
112
+ def self.libpath( *args )
113
+ args.empty? ? LIBPATH : ::File.join(LIBPATH, *args)
114
+ end
115
+
116
+ # Returns the path for Webby. If any arguments are given,
117
+ # they will be joined to the end of the path using
118
+ # <tt>File.join</tt>.
119
+ #
120
+ def self.path( *args )
121
+ args.empty? ? PATH : ::File.join(PATH, *args)
122
+ end
123
+
124
+ # call-seq:
125
+ # Webby.require_all_libs_relative_to( filename, directory = nil )
126
+ #
127
+ # Utility method used to rquire all files ending in .rb that lie in the
128
+ # directory below this file that has the same name as the filename passed
129
+ # in. Optionally, a specific _directory_ name can be passed in such that
130
+ # the _filename_ does not have to be equivalent to the directory.
131
+ #
132
+ def self.require_all_libs_relative_to( fname, dir = nil )
133
+ dir ||= ::File.basename(fname, '.*')
134
+ search_me = ::File.expand_path(
135
+ ::File.join(::File.dirname(fname), dir, '*.rb'))
136
+
137
+ Dir.glob(search_me).sort.each {|rb| require rb}
138
+ end
113
139
  end # module Webby
114
140
 
115
141
 
@@ -127,7 +153,8 @@ rescue LoadError
127
153
  false
128
154
  end
129
155
 
156
+ Webby.require_all_libs_relative_to(__FILE__)
130
157
 
131
- Webby.require_all_libs_relative_to __FILE__
158
+ end # unless defined?
132
159
 
133
160
  # EOF