[Pkg-ruby-extras-maintainers] r407 - in website: . plugin src
Paul van Tilburg
paulvt at costa.debian.org
Thu Mar 23 09:54:37 UTC 2006
Author: paulvt
Date: 2006-03-23 09:54:37 +0000 (Thu, 23 Mar 2006)
New Revision: 407
Added:
website/plugin/stat.rb
Modified:
website/src/default.template
website/sync-website.sh
Log:
* Added a line in template to show when a page was last updated.
* Written a webgen plugin to provide fileatime, filectime and filemtime tags.
* Adapted the sync-website script to make rsync preserve file stat times.
Added: website/plugin/stat.rb
===================================================================
--- website/plugin/stat.rb 2006-03-23 09:27:22 UTC (rev 406)
+++ website/plugin/stat.rb 2006-03-23 09:54:37 UTC (rev 407)
@@ -0,0 +1,60 @@
+# This webgen plugin extends the available tags with tags that can retrieve
+# stat(2) information.
+#
+# Copyright (2006) Paul van Tilburg <paulvt at debian.org>
+
+# This plugin is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+
+require 'webgen/plugins/tags/tags'
+
+module Tags
+
+ class FileADateTag < DefaultTag
+
+ summary "Puts the access time and date of the file on the page"
+ add_param 'format', '%A, %B %d %H:%M:%S %Z %Y',
+ 'The format of the date (same options as Time#strftime).'
+ depends_on 'Tags'
+ tag 'fileatime'
+
+ def process_tag(tag, node, refNode)
+ atime = File.stat(node.recursive_value('src')).atime
+ return atime.strftime(get_param('format'))
+ end
+
+ end # class FileADateTag
+
+ class FileCDateTag < DefaultTag
+
+ summary "Puts the create time and date of the file on the page"
+ add_param 'format', '%A, %B %d %H:%M:%S %Z %Y',
+ 'The format of the date (same options as Time#strftime).'
+ depends_on 'Tags'
+ tag 'filcatime'
+
+ def process_tag(tag, node, refNode)
+ atime = File.stat(node.recursive_value('src')).ctime
+ return ctime.strftime(get_param('format'))
+ end
+
+ end # class FileCDateTag
+
+ class FileMDateTag < DefaultTag
+
+ summary "Puts the modification time and date of the file on the page"
+ add_param 'format', '%A, %B %d %H:%M:%S %Z %Y',
+ 'The format of the date (same options as Time#strftime).'
+ depends_on 'Tags'
+ tag 'filemtime'
+
+ def process_tag(tag, node, refNode)
+ mtime = File.stat(node.recursive_value('src')).mtime
+ return mtime.strftime(get_param('format'))
+ end
+
+ end # class FileMDateTag
+
+end
Modified: website/src/default.template
===================================================================
--- website/src/default.template 2006-03-23 09:27:22 UTC (rev 406)
+++ website/src/default.template 2006-03-23 09:54:37 UTC (rev 407)
@@ -29,7 +29,8 @@
</div>
<div id="footer" class="bar">
- generated with <a href="http://webgen.rubyforge.org">webgen</a> on <b>{date: }</b>
+ This page was last updated on <b>{filemtime: }</b><br/>
+ This site is generated with <a href="http://webgen.rubyforge.org">webgen</a> on <b>{date: }</b>
</div>
</div>
</body>
Modified: website/sync-website.sh
===================================================================
--- website/sync-website.sh 2006-03-23 09:27:22 UTC (rev 406)
+++ website/sync-website.sh 2006-03-23 09:54:37 UTC (rev 407)
@@ -2,7 +2,7 @@
# needed to create files with the correct modes
umask 022
-LC_ALL= webgen && rsync -avP output/ \
+LC_ALL= webgen && rsync -avtP output/ \
alioth.debian.org:/var/lib/gforge/chroot/home/groups/pkg-ruby-extras/htdocs/
# add an entry in ~/.ssh/config with :
More information about the pkg-ruby-extras-maintainers
mailing list