Mercurial > hg > chronicle
comparison bin/chronicle @ 46:081d06e16a36
2007-10-10 20:09:24 by steve
Added '--force' argument.
author | steve |
---|---|
date | Wed, 10 Oct 2007 20:09:24 +0000 |
parents | a9f8a82045f8 |
children | 29464ede63dd |
comparison
equal
deleted
inserted
replaced
45:a9f8a82045f8 | 46:081d06e16a36 |
---|---|
27 | 27 |
28 --format Specify the format of your entries, HTML/textile/markdown. | 28 --format Specify the format of your entries, HTML/textile/markdown. |
29 | 29 |
30 Optional Features: | 30 Optional Features: |
31 | 31 |
32 --force Force the copying of static files from the blog theme. | |
32 --no-archive Don't create an archive page. | 33 --no-archive Don't create an archive page. |
33 --no-cache Don't use the optional memcached features, even if available. | 34 --no-cache Don't use the optional memcached features, even if available. |
34 --no-tags Don't produce any tag pages. | 35 --no-tags Don't produce any tag pages. |
35 --lower-case Lower-case all filenames which are output. | 36 --lower-case Lower-case all filenames which are output. |
36 | 37 |
68 | 69 |
69 Having said that it is a robust, stable, and useful system. | 70 Having said that it is a robust, stable, and useful system. |
70 | 71 |
71 =cut | 72 =cut |
72 | 73 |
74 | |
73 =head1 BLOG FORMAT | 75 =head1 BLOG FORMAT |
74 | 76 |
75 The format of the text files we process is critical to the output | 77 The format of the text files we process is critical to the output |
76 pages. Each entry should look something like this: | 78 pages. Each entry should look something like this: |
77 | 79 |
83 | 85 |
84 The text of your entry goes here. | 86 The text of your entry goes here. |
85 | 87 |
86 =for example end | 88 =for example end |
87 | 89 |
88 | |
89 In this example we can see that the entry itself has been prefaced | 90 In this example we can see that the entry itself has been prefaced |
90 with a small header. The header must contain a 'Title:' line. The | 91 with a small header. The header must contain a 'Title:' line. The |
91 'Date:' line is optional, as is the 'Tags:' line. | 92 'Date:' line is optional, as is the 'Tags:' line. |
92 | 93 |
93 The text of the entry itself is assumed to be HTML, however if you | 94 The text of the entry itself is assumed to be HTML, however if you |
99 line argument. | 100 line argument. |
100 | 101 |
101 If you're missing the required Perl module to support your chosen | 102 If you're missing the required Perl module to support your chosen |
102 input format you will be told this. | 103 input format you will be told this. |
103 | 104 |
105 =cut | |
106 | |
107 | |
108 =head1 CONFIGURATION | |
109 | |
110 The configuration of the software is minimal, and generally performed | |
111 via the command line arguments. However it is possible to save settings | |
112 either in the file /etc/chroniclerc or the per-user ~/.chroniclerc | |
113 file. | |
114 | |
115 These files contain lines of the form: | |
116 | |
117 =for example begin | |
118 | |
119 input = /home/me/blog | |
120 | |
121 output = /var/www/blog | |
122 | |
123 format = markdown | |
124 | |
125 =for example end | |
126 | |
127 Keys which are unknown are ignored. | |
104 | 128 |
105 =cut | 129 =cut |
106 | 130 |
107 | 131 |
108 =head1 OPTIONAL CACHING | 132 =head1 OPTIONAL CACHING |
129 | 153 |
130 Steve | 154 Steve |
131 -- | 155 -- |
132 http://www.steve.org.uk/ | 156 http://www.steve.org.uk/ |
133 | 157 |
134 $Id: chronicle,v 1.19 2007-10-10 20:00:57 steve Exp $ | 158 $Id: chronicle,v 1.20 2007-10-10 20:09:24 steve Exp $ |
135 | 159 |
136 =cut | 160 =cut |
137 | 161 |
138 =head1 LICENSE | 162 =head1 LICENSE |
139 | 163 |
365 # | 389 # |
366 # Entries per-page for the index. | 390 # Entries per-page for the index. |
367 # | 391 # |
368 $CONFIG{'entry-count'} = 10; | 392 $CONFIG{'entry-count'} = 10; |
369 | 393 |
394 # | |
395 # Don't overwrite files by default | |
396 # | |
397 $CONFIG{'force'} = 0; | |
398 | |
370 return( %CONFIG ); | 399 return( %CONFIG ); |
371 } | 400 } |
372 | 401 |
373 | 402 |
374 | 403 |
404 "output=s", \$CONFIG{'output'}, | 433 "output=s", \$CONFIG{'output'}, |
405 "templates=s", \$CONFIG{'template'}, | 434 "templates=s", \$CONFIG{'template'}, |
406 "pattern=s", \$CONFIG{'pattern'}, | 435 "pattern=s", \$CONFIG{'pattern'}, |
407 | 436 |
408 # optional | 437 # optional |
438 "force", \$CONFIG{'force'}, | |
409 "no-tags", \$CONFIG{'no-tags'}, | 439 "no-tags", \$CONFIG{'no-tags'}, |
410 "no-cache", \$CONFIG{'no-cache'}, | 440 "no-cache", \$CONFIG{'no-cache'}, |
411 "no-archive", \$CONFIG{'no-archive'}, | 441 "no-archive", \$CONFIG{'no-archive'}, |
412 "lower-case", \$CONFIG{'lower-case'}, | 442 "lower-case", \$CONFIG{'lower-case'}, |
413 | 443 |
426 pod2usage(1) if $HELP; | 456 pod2usage(1) if $HELP; |
427 pod2usage(-verbose => 2 ) if $MANUAL; | 457 pod2usage(-verbose => 2 ) if $MANUAL; |
428 | 458 |
429 if ( $VERSION ) | 459 if ( $VERSION ) |
430 { | 460 { |
431 my $REVISION = '$Revision: 1.19 $'; | 461 my $REVISION = '$Revision: 1.20 $'; |
432 if ( $REVISION =~ /1.([0-9.]+) / ) | 462 if ( $REVISION =~ /1.([0-9.]+) / ) |
433 { | 463 { |
434 $REVISION = $1; | 464 $REVISION = $1; |
435 } | 465 } |
436 | 466 |
1517 Copy any static files from the theme directory into the "live" location | 1547 Copy any static files from the theme directory into the "live" location |
1518 in the output. | 1548 in the output. |
1519 | 1549 |
1520 This only works for a top-level target directory. | 1550 This only works for a top-level target directory. |
1521 | 1551 |
1552 Unless --force is specified we skip copying files which already exist. | |
1553 | |
1522 =end doc | 1554 =end doc |
1523 | 1555 |
1524 =cut | 1556 =cut |
1525 | 1557 |
1526 sub copyStaticFiles | 1558 sub copyStaticFiles |
1540 # | 1572 # |
1541 if ( $file =~ /(.*)\/(.*)/ ) | 1573 if ( $file =~ /(.*)\/(.*)/ ) |
1542 { | 1574 { |
1543 $file = $2; | 1575 $file = $2; |
1544 } | 1576 } |
1545 if ( ! -e "$output/$file" ) | 1577 if ( $CONFIG{'force'} || ( ! -e "$output/$file" ) ) |
1546 { | 1578 { |
1547 $CONFIG{'verbose'} && print "Copying static file: $file\n"; | 1579 $CONFIG{'verbose'} && print "Copying static file: $file\n"; |
1548 copy( "$input/$file", "$output/$file" ); | 1580 copy( "$input/$file", "$output/$file" ); |
1549 } | 1581 } |
1550 } | 1582 } |