webgen 0.5.1 → 0.5.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/Rakefile +16 -5
- data/VERSION +1 -1
- data/data/webgen/webgui/controller/main.rb +129 -0
- data/data/webgen/webgui/overrides/win32console.rb +0 -0
- data/data/webgen/webgui/public/css/jquery.autocomplete.css +50 -0
- data/data/webgen/webgui/public/css/ramaze_error.css +90 -0
- data/data/webgen/webgui/public/css/style.css +55 -0
- data/data/webgen/webgui/public/img/headerbg.jpg +0 -0
- data/data/webgen/webgui/public/img/webgen_logo.png +0 -0
- data/data/webgen/webgui/public/js/jquery.autocomplete.js +15 -0
- data/data/webgen/webgui/public/js/jquery.js +32 -0
- data/data/webgen/webgui/view/create_website.xhtml +22 -0
- data/data/webgen/webgui/view/error.xhtml +64 -0
- data/data/webgen/webgui/view/index.xhtml +22 -0
- data/data/webgen/webgui/view/manage_website.xhtml +18 -0
- data/data/webgen/webgui/view/page.xhtml +40 -0
- data/doc/extensions.page +1 -2
- data/doc/getting_started.page +7 -3
- data/doc/manual.page +75 -29
- data/lib/webgen/cache.rb +17 -9
- data/lib/webgen/cli.rb +3 -1
- data/lib/webgen/cli/utils.rb +5 -1
- data/lib/webgen/cli/webgui_command.rb +48 -0
- data/lib/webgen/node.rb +15 -1
- data/lib/webgen/output.rb +8 -2
- data/lib/webgen/output/filesystem.rb +7 -1
- data/lib/webgen/path.rb +7 -4
- data/lib/webgen/source/filesystem.rb +4 -2
- data/lib/webgen/source/resource.rb +12 -3
- data/lib/webgen/sourcehandler.rb +27 -10
- data/lib/webgen/sourcehandler/fragment.rb +11 -6
- data/lib/webgen/sourcehandler/metainfo.rb +2 -1
- data/lib/webgen/sourcehandler/page.rb +21 -1
- data/lib/webgen/tag/breadcrumbtrail.rb +2 -2
- data/lib/webgen/tag/executecommand.rb +4 -1
- data/lib/webgen/tag/includefile.rb +1 -1
- data/lib/webgen/tag/langbar.rb +32 -4
- data/lib/webgen/tag/menu.rb +13 -8
- data/lib/webgen/version.rb +1 -1
- data/lib/webgen/website.rb +3 -1
- data/lib/webgen/websitemanager.rb +1 -0
- data/man/man1/webgen.1 +3 -0
- data/misc/default.template +1 -1
- data/test/test_cache.rb +5 -5
- data/test/test_node.rb +20 -1
- data/test/test_output_filesystem.rb +2 -1
- data/test/test_page.rb +12 -0
- data/test/test_path.rb +14 -0
- data/test/test_source_filesystem.rb +1 -1
- data/test/test_source_resource.rb +5 -0
- data/test/test_sourcehandler_fragment.rb +9 -4
- data/test/test_sourcehandler_page.rb +12 -13
- data/test/test_sourcehandler_template.rb +1 -2
- data/test/test_tag_breadcrumbtrail.rb +3 -2
- data/test/test_tag_executecommand.rb +0 -1
- data/test/test_tag_langbar.rb +7 -0
- data/test/test_tag_menu.rb +1 -1
- metadata +65 -2
@@ -0,0 +1,64 @@
|
|
1
|
+
<link rel="stylesheet" href="/css/ramaze_error.css" />
|
2
|
+
<script type="text/javascript" src="/js/jquery.js"></script>
|
3
|
+
|
4
|
+
<p>The backtrace gives filenames and line numbers for all parts of the call stack.<br />
|
5
|
+
Click on any of them to view the surrounding source code.</p>
|
6
|
+
|
7
|
+
<h3>#@title</h3>
|
8
|
+
|
9
|
+
<table class="main">
|
10
|
+
<tr class="head">
|
11
|
+
<td>File</td><td>Line</td><td>Method</td>
|
12
|
+
</tr>
|
13
|
+
<?r @backtrace.each do |lines, hash, file, lineno, meth| ?>
|
14
|
+
<tr class="line" id="#{hash}">
|
15
|
+
<td>#{file}</td><td class="lineno">#{lineno}</td><td><pre>#{meth}</pre></td>
|
16
|
+
</tr>
|
17
|
+
<tr id="source_#{hash}" style="display:none;">
|
18
|
+
<td colspan="3">
|
19
|
+
<div class="source">
|
20
|
+
<table style="width:100%;">
|
21
|
+
<tr>
|
22
|
+
<td class="editor" colspan="2">
|
23
|
+
#{@editor} #{file} +#{lineno}
|
24
|
+
<div style="float: right">
|
25
|
+
<a href="txmt://open?url=file://#{file}&line=#{lineno}">open in textmate</a>
|
26
|
+
</div>
|
27
|
+
</td>
|
28
|
+
</tr>
|
29
|
+
<?r lines.each do |llineno, lcode, lcurrent| ?>
|
30
|
+
<tr class="source" #{'style="background:#faa;"' if lcurrent}>
|
31
|
+
<td class="lineno">#{llineno}</td>
|
32
|
+
<td class="code"><pre>#{lcode.to_s.rstrip}</pre></td>
|
33
|
+
</tr>
|
34
|
+
<?r end ?>
|
35
|
+
</table>
|
36
|
+
</div>
|
37
|
+
</td>
|
38
|
+
</tr>
|
39
|
+
<?r end ?>
|
40
|
+
</table>
|
41
|
+
|
42
|
+
<?r
|
43
|
+
{ 'Session' => Thread.current[:session],
|
44
|
+
'Request' => Thread.current[:request],
|
45
|
+
'Response' => Thread.current[:response],
|
46
|
+
'Global' => Global,
|
47
|
+
}.each do |title, content|
|
48
|
+
hash = [title, content].object_id.abs
|
49
|
+
?>
|
50
|
+
<div class="additional">
|
51
|
+
<h3 id="#{hash}">#{title}</h3>
|
52
|
+
<pre style="display:none" id="is_#{hash}">#{CGI.escapeHTML(content.pretty_inspect)}</pre>
|
53
|
+
</div>
|
54
|
+
<?r end ?>
|
55
|
+
|
56
|
+
<script type="text/javascript">
|
57
|
+
$("tr.line").click(function(){
|
58
|
+
$("tr#source_"+this.id).toggle()
|
59
|
+
});
|
60
|
+
|
61
|
+
$("div.additional > h3").click(function(){
|
62
|
+
$("pre#is_"+this.id).toggle()
|
63
|
+
});
|
64
|
+
</script>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h2>Welcome to the webgen webgui!</h2>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
This web application lets you create and manage webgen website. Just set the directory of an
|
5
|
+
existing or a to-be-created website in the top right corner and click the button!
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<ul>
|
9
|
+
<li>
|
10
|
+
If you select an existing directory, the webgui assumes that it is a webgen website directory and
|
11
|
+
presents you with page for managing a webgen website.
|
12
|
+
</li>
|
13
|
+
<li>
|
14
|
+
If you select a non-existing directory, the webgui shows you a page for creating a webgen website.
|
15
|
+
</li>
|
16
|
+
</ul>
|
17
|
+
|
18
|
+
<p>
|
19
|
+
The text input field uses auto-completion to show you the available directories on your
|
20
|
+
computer. You can either start typing an absolute path name or relative one which will be resolved
|
21
|
+
from the directory in which you started the webgui.
|
22
|
+
</p>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<form method='post' action='#{R :manage_website}'>
|
2
|
+
<p>
|
3
|
+
<label for='verbosity'>Verbosity:
|
4
|
+
<select id='verbosity' name='verbosity'>
|
5
|
+
<option #{@verbosity == 'normal' ? selected='selected' : ''}>normal</option>
|
6
|
+
<option #{@verbosity == 'verbose' ? selected='selected' : ''}>verbose</option>
|
7
|
+
<option #{@verbosity == 'quiet' ? selected='selected' : ''}>quiet</option>
|
8
|
+
</select>
|
9
|
+
<input type='submit' id='render_site' name='render_site' value='Render website' />
|
10
|
+
<!-- <input type='submit' id='auto_render_site' name='auto_render_site' value='#{session['auto_render'] ? 'Stop auto-rendering' : 'Start auto-rendering'}' /> -->
|
11
|
+
</p>
|
12
|
+
</form>
|
13
|
+
|
14
|
+
<div id='website_log'>
|
15
|
+
<pre>#{CGI::escapeHTML(@log.to_s)}</pre>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<object id='website_preview' type='text/html' data='#{R :preview_website, "/index.html"}' width='100%' height='600px' style='border: 1px solid black' />
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
4
|
+
<head>
|
5
|
+
<title>#{@title}</title>
|
6
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
7
|
+
<meta http-equiv="Content-Style-Type" content="text/css" />
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9
|
+
|
10
|
+
<link href="#{R '/css/style.css'}" rel="stylesheet" type="text/css" />
|
11
|
+
<link href="#{R '/css/jquery.autocomplete.css'}" rel="stylesheet" type="text/css" />
|
12
|
+
|
13
|
+
<script type='text/javascript' src="#{R '/js/jquery.js'}"></script>
|
14
|
+
<script type='text/javascript' src="#{R '/js/jquery.autocomplete.js'}"></script>
|
15
|
+
<script type='text/javascript'>
|
16
|
+
$(document).ready(function() {
|
17
|
+
$("#website_dir").autocomplete('#{R MainController, :path_autocomplete}');
|
18
|
+
});
|
19
|
+
</script>
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="header">
|
23
|
+
<img src="#{R '/img/webgen_logo.png'}" alt='logo' />
|
24
|
+
<h2><a href="#{R '/'}">webgen <span>webgui</span></a></h2>
|
25
|
+
|
26
|
+
<div id='site-select-form'>
|
27
|
+
<form method='post' action='#{R MainController, :site_ops}'>
|
28
|
+
<p>
|
29
|
+
<input type='text' id='website_dir' name='website_dir' value='#{session["website_dir"]}' size="70" />
|
30
|
+
<input type='submit' id='set_site' name='set_site' value='Set website directory' />
|
31
|
+
</p>
|
32
|
+
</form>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</div>
|
36
|
+
<div id="content">
|
37
|
+
#@content
|
38
|
+
</div>
|
39
|
+
</body>
|
40
|
+
</html>
|
data/doc/extensions.page
CHANGED
data/doc/getting_started.page
CHANGED
@@ -46,9 +46,13 @@ possibilities:
|
|
46
46
|
example `webgen -d sample_site`.
|
47
47
|
|
48
48
|
Easy! webgen has used all files in the `src` directory and created the HTML output in the directory
|
49
|
-
`out`.
|
50
|
-
|
51
|
-
|
49
|
+
`out`. Now you just need to open the `out/index.html` file to view your website! However, as we did
|
50
|
+
not write any content yet, there is not much to see (only the default pages). So let's do that now!
|
51
|
+
|
52
|
+
> Since webgen automatically creates relative links, you will have a fully functional website
|
53
|
+
> without needing a web server! This also implies that you can deploy your website to any directory
|
54
|
+
> on your web server and it will just work!
|
55
|
+
{.information}
|
52
56
|
|
53
57
|
|
54
58
|
### Adding Content
|
data/doc/manual.page
CHANGED
@@ -42,9 +42,84 @@ Following is a short overview of the available commands:
|
|
42
42
|
|
43
43
|
Displays the version of webgen.
|
44
44
|
|
45
|
+
* `webgui`
|
46
|
+
|
47
|
+
Starts the webgen webgui, a browser based graphical user interface for managing webgen
|
48
|
+
websites. First the webgui web application is started and then the webgui is opened in the
|
49
|
+
default browser.
|
50
|
+
|
45
51
|
[cmdparse]: http://cmdparse.rubyforge.org
|
46
52
|
|
47
53
|
|
54
|
+
|
55
|
+
# A webgen Website {#website}
|
56
|
+
|
57
|
+
webgen needs a special directory structure so that it works out of the box. This directory structure
|
58
|
+
is automatically created by the `webgen create` command.
|
59
|
+
|
60
|
+
The root directory of webgen website is called the website directory. You can have the following
|
61
|
+
files and directories under this directory:
|
62
|
+
|
63
|
+
* `src`: The source directory in which all the source files for the website are. If this directory
|
64
|
+
is not called `src` or you want to include additional source directories, you need to change the
|
65
|
+
`sources` configuration option.
|
66
|
+
|
67
|
+
* `out`: This directory is created, if it does not exist, when webgen generates the HTML files. All
|
68
|
+
the output files are put into this directory. This directory can be changed by setting the
|
69
|
+
`output` configuration option.
|
70
|
+
|
71
|
+
* `ext`: The extension directory (optional). You can put self-written extensions into this directory
|
72
|
+
so that they are used by webgen.
|
73
|
+
|
74
|
+
* `config.yaml`: This file can be used to set configuration options for the website. See the
|
75
|
+
[Configuration File]({relocatable: '#website-configfile'}) section for more information.
|
76
|
+
|
77
|
+
* `Rakefile`: This file is provided for your convenience to execute tasks via `rake` and provides
|
78
|
+
some useful tasks out of the box. See the [Rakefile]({relocatable: '#website-rakefile'}) section
|
79
|
+
for more information.
|
80
|
+
|
81
|
+
|
82
|
+
## Configuration File {#website-configfile}
|
83
|
+
|
84
|
+
Many user will want to change some configuration options, for example, the default language of the
|
85
|
+
website since not all people will want to write websites in English. This is primarily done via the
|
86
|
+
configuration file.
|
87
|
+
|
88
|
+
The configuration file is called `config.yaml` and has to be placed directly under the website
|
89
|
+
directory. It uses [YAML](http://www.yaml.org) as file format. You can find a list of all available
|
90
|
+
configuration options that can be set in the [Configuration Options Reference]({relocatable:
|
91
|
+
reference_configuration.html}).
|
92
|
+
|
93
|
+
Each configuration option can be set in the configuration file by specifing the configuration option
|
94
|
+
name and the new value as a key/value pair. A sample configuration file looks like this:
|
95
|
+
|
96
|
+
website.lang: de
|
97
|
+
website.link_to_current_page: true
|
98
|
+
|
99
|
+
There is one special key called `default_meta_info` which behaves a little different. It does not
|
100
|
+
map to any configuration option but is used to update the meta information hashes of the
|
101
|
+
configuration option `sourcehandler.default_meta_info`. For example, the following configuration
|
102
|
+
file updates the default meta information for all source handlers by setting a new value for
|
103
|
+
`output_path_style` and setting `in_menu` to `true`:
|
104
|
+
|
105
|
+
default_meta_info:
|
106
|
+
:all:
|
107
|
+
output_path_style: [:parent, :cnbase, :ext, [., :lang]]
|
108
|
+
in_menu: true
|
109
|
+
|
110
|
+
|
111
|
+
## Rakefile {#website-rakefile}
|
112
|
+
|
113
|
+
The Rakefile that is automatically created upon website creation provides a place to specify
|
114
|
+
recurring task for your website, for example, for deploying the website to a server. It contains
|
115
|
+
some useful tasks out of the box:
|
116
|
+
|
117
|
+
* `webgen`: Renders the webgen website once.
|
118
|
+
* `auto_webgen`: Automatically renders the website when a source file has changed.
|
119
|
+
* `clobber_webgen`: Removes all webgen generated products (the output files and the cache file).
|
120
|
+
|
121
|
+
|
122
|
+
|
48
123
|
# All About Paths and Sources {#source}
|
49
124
|
|
50
125
|
A source provides paths that identity files or directories. webgen can use paths from many sources.
|
@@ -312,35 +387,6 @@ There is clearly defined order in which meta information is applied to a node fo
|
|
312
387
|
|
313
388
|
|
314
389
|
|
315
|
-
# The Configuration File
|
316
|
-
|
317
|
-
Many user will want to change some configuration options, for example, the default language of the
|
318
|
-
website since not all people will want to write websites in English. This is primarily done via the
|
319
|
-
configuration file.
|
320
|
-
|
321
|
-
The configuration file is called `config.yaml` and has to be placed directly under the website
|
322
|
-
directory. It uses [YAML](http://www.yaml.org) as file format. You can find a list of all available
|
323
|
-
configuration options that can be set in the [Configuration Options Reference]({relocatable:
|
324
|
-
reference_configuration.html}).
|
325
|
-
|
326
|
-
Each configuration option can be set in the configuration file by specifing the configuration option
|
327
|
-
name and the new value as a key/value pair. A sample configuration file looks like this:
|
328
|
-
|
329
|
-
website.lang: de
|
330
|
-
website.link_to_current_page: true
|
331
|
-
|
332
|
-
There is one special key called `default_meta_info` which behaves a little different. It does not
|
333
|
-
map to any configuration option but is used to update the meta information hashes of the
|
334
|
-
configuration option `sourcehandler.default_meta_info`. For example, the following configuration
|
335
|
-
file updates the default meta information for all source handlers by setting a new value for
|
336
|
-
`output_path_style` and setting `in_menu` to `true`:
|
337
|
-
|
338
|
-
default_meta_info:
|
339
|
-
:all:
|
340
|
-
output_path_style: [:parent, :cnbase, :ext, [., :lang]]
|
341
|
-
in_menu: true
|
342
|
-
|
343
|
-
|
344
390
|
# Extending webgen
|
345
391
|
|
346
392
|
If you know the programming language Ruby a little bit, you can easily extend webgen and add new
|
data/lib/webgen/cache.rb
CHANGED
@@ -14,11 +14,25 @@ module Webgen
|
|
14
14
|
# standard:: The standard cache saves data between webgen runs and returns the cached data (not
|
15
15
|
# the newly set data) if it is available. This is useful, for example, to store file
|
16
16
|
# modifcation times and check if a file has been changed between runs.
|
17
|
+
#
|
18
|
+
# The standard cache should be accessed through the <tt>[]</tt> method which returns the correct
|
19
|
+
# value and the <tt>[]=</tt> method should be used for setting the new value. However, if you
|
20
|
+
# really need to access a particular value of the old or new standard cache, you can use the
|
21
|
+
# accessors +old_data+ and +new_data+.
|
17
22
|
class Cache
|
18
23
|
|
19
24
|
# The permanent cache hash.
|
20
25
|
attr_reader :permanent
|
21
26
|
|
27
|
+
# The volatile cache hash.
|
28
|
+
attr_reader :volatile
|
29
|
+
|
30
|
+
# The cache data stored in the previous webgen run.
|
31
|
+
attr_reader :old_data
|
32
|
+
|
33
|
+
# The cache data stored in the current webgen run.
|
34
|
+
attr_reader :new_data
|
35
|
+
|
22
36
|
# Create a new cache object.
|
23
37
|
def initialize()
|
24
38
|
@old_data = {}
|
@@ -53,15 +67,9 @@ module Webgen
|
|
53
67
|
[@old_data.merge(@new_data), @permanent]
|
54
68
|
end
|
55
69
|
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
(@volatile[:enabled] ? @volatile : {})
|
60
|
-
end
|
61
|
-
|
62
|
-
# Enable the volatile cache.
|
63
|
-
def enable_volatile_cache
|
64
|
-
@volatile[:enabled] = true
|
70
|
+
# Reset the volatile cache.
|
71
|
+
def reset_volatile_cache
|
72
|
+
@volatile = {:classes => @volatile[:classes]}
|
65
73
|
end
|
66
74
|
|
67
75
|
# Return the unique instance of the class +name+. This method should be used when it is
|
data/lib/webgen/cli.rb
CHANGED
@@ -58,6 +58,7 @@ module Webgen
|
|
58
58
|
|
59
59
|
autoload :RunCommand, 'webgen/cli/run_command'
|
60
60
|
autoload :CreateCommand, 'webgen/cli/create_command'
|
61
|
+
autoload :WebguiCommand, 'webgen/cli/webgui_command'
|
61
62
|
|
62
63
|
autoload :Utils, 'webgen/cli/utils'
|
63
64
|
|
@@ -81,6 +82,7 @@ module Webgen
|
|
81
82
|
@directory = Dir.pwd
|
82
83
|
@verbosity = :normal
|
83
84
|
@log_level = ::Logger::WARN
|
85
|
+
@log_filter = nil
|
84
86
|
|
85
87
|
self.program_name = "webgen"
|
86
88
|
self.program_version = Webgen::VERSION
|
@@ -89,7 +91,7 @@ module Webgen
|
|
89
91
|
opts.on("--directory DIR", "-d", String, "The website directory (default: the current directory)") {|@directory|}
|
90
92
|
opts.on("--verbose", "-v", "Print more output") { @verbosity = :verbose }
|
91
93
|
opts.on("--quiet", "-q", "No output") { @verbosity = :quiet }
|
92
|
-
opts.on("--log-level", "-l",
|
94
|
+
opts.on("--log-level LEVEL", "-l", Integer, "The logging level (0..debug, 3..error)") {|@log_level|}
|
93
95
|
opts.on("--log-filter", "-f", Regexp, 'Filter for logging events') {|@log_filter|}
|
94
96
|
end
|
95
97
|
self.add_command(CmdParse::HelpCommand.new)
|
data/lib/webgen/cli/utils.rb
CHANGED
@@ -10,7 +10,11 @@ module Webgen::CLI
|
|
10
10
|
class Utils
|
11
11
|
|
12
12
|
USE_ANSI_COLORS = !Config::CONFIG['arch'].include?('mswin32')
|
13
|
-
DEFAULT_WIDTH =
|
13
|
+
DEFAULT_WIDTH = if Config::CONFIG['arch'].include?('mswin32')
|
14
|
+
72
|
15
|
+
else
|
16
|
+
((size = %x{stty size 2>/dev/null}).length > 0 ? size.split.last.to_i : 72) rescue 72
|
17
|
+
end
|
14
18
|
|
15
19
|
# Used for dynamically formatting the text (setting color, bold face, ...).
|
16
20
|
def self.method_missing(id, text = nil)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'webgen/cli'
|
2
|
+
|
3
|
+
module Webgen::CLI
|
4
|
+
|
5
|
+
# The CLI command for starting the webgen webgui.
|
6
|
+
class WebguiCommand < CmdParse::Command
|
7
|
+
|
8
|
+
def initialize # :nodoc:
|
9
|
+
super('webgui', false)
|
10
|
+
self.short_desc = 'Starts the webgen webgui'
|
11
|
+
end
|
12
|
+
|
13
|
+
# Render the website.
|
14
|
+
def execute(args)
|
15
|
+
# some fixes for ramaze-2008.06
|
16
|
+
# - fix for Windows bug when win32console is not installed
|
17
|
+
# - fix for message displayed on shutdown
|
18
|
+
$:.unshift File.join(Webgen.data_dir, 'webgui', 'overrides')
|
19
|
+
require 'win32console'
|
20
|
+
$:.shift
|
21
|
+
require 'ramaze'
|
22
|
+
Ramaze::Log.loggers = []
|
23
|
+
def Ramaze.shutdown; end
|
24
|
+
|
25
|
+
acquire Webgen.data_dir/:webgui/:controller/'*'
|
26
|
+
Ramaze::Global.setup do |g|
|
27
|
+
g.root = Webgen.data_dir/:webgui
|
28
|
+
g.public_root = Webgen.data_dir/:webgui/:public
|
29
|
+
g.view_root = Webgen.data_dir/:webgui/:view
|
30
|
+
g.adapter = :webrick
|
31
|
+
g.port = 7000
|
32
|
+
end
|
33
|
+
|
34
|
+
puts 'Starting webgui on http://localhost:7000, press Control-C to stop'
|
35
|
+
Thread.new do
|
36
|
+
sleep 2
|
37
|
+
puts 'Launching web browser'
|
38
|
+
require 'launchy'
|
39
|
+
Launchy.open('http://localhost:7000')
|
40
|
+
end
|
41
|
+
|
42
|
+
Ramaze.start
|
43
|
+
puts 'webgui finished'
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
data/lib/webgen/node.rb
CHANGED
@@ -50,6 +50,10 @@ module Webgen
|
|
50
50
|
# not be set to +false+ once it is +true+!
|
51
51
|
attr_accessor :dirty
|
52
52
|
|
53
|
+
# Set by other objects to +true+ if the meta information of the node has changed since the last
|
54
|
+
# run. Must not be set to +false+ once it is +true+!
|
55
|
+
attr_accessor :dirty_meta_info
|
56
|
+
|
53
57
|
# Has the node been created or has it been read from the cache?
|
54
58
|
attr_accessor :created
|
55
59
|
|
@@ -120,6 +124,15 @@ module Webgen
|
|
120
124
|
@dirty
|
121
125
|
end
|
122
126
|
|
127
|
+
# Return +true+ if the meta information of the node has changed.
|
128
|
+
def meta_info_changed?
|
129
|
+
@dirty_meta_info = node_info[:used_meta_info_nodes].any? do |n|
|
130
|
+
n != @absolute_lcn && (!tree[n] || tree[n].meta_info_changed?)
|
131
|
+
end unless @dirty_meta_info
|
132
|
+
website.blackboard.dispatch_msg(:node_meta_info_changed?, self) unless @dirty_meta_info
|
133
|
+
@dirty_meta_info
|
134
|
+
end
|
135
|
+
|
123
136
|
# Return an informative representation of the node.
|
124
137
|
def inspect
|
125
138
|
"<##{self.class.name}: alcn=#{@absolute_lcn}>"
|
@@ -133,7 +146,7 @@ module Webgen
|
|
133
146
|
# Sort nodes by using the meta info +sort_info+ (or +title+ if +sort_info+ is not set) of both
|
134
147
|
# involved nodes.
|
135
148
|
def <=>(other)
|
136
|
-
self_so = (
|
149
|
+
self_so = (@meta_info['sort_info'] && @meta_info['sort_info'].to_s) || @meta_info['title'] || ''
|
137
150
|
other_so = (other['sort_info'] && other['sort_info'].to_s) || other['title'] || ''
|
138
151
|
if self_so !~ /\D/ && other_so !~ /\D/
|
139
152
|
self_so = self_so.to_i
|
@@ -295,6 +308,7 @@ module Webgen
|
|
295
308
|
@parent.children << self unless @parent == @tree
|
296
309
|
|
297
310
|
self.node_info[:used_nodes] = Set.new
|
311
|
+
self.node_info[:used_meta_info_nodes] = Set.new
|
298
312
|
end
|
299
313
|
|
300
314
|
# Delegate missing methods to a processor. The current node is placed into the argument array as
|