37 Commits

Author SHA1 Message Date
85d43851d1 Fix substring initial offset value
Remove only the leading comma character.
2024-10-08 21:49:58 -04:00
8b277607cf Fix guard for unitialized variable
The original guard was preventing an id with value of
zero from being processed correctly.
2024-10-08 17:37:48 -04:00
Roan Horning
39d2ef86ad Merge pull request '[I206] Change links for hpr_generator repository' (#211) from I206_change-links-for-hpr_generator-repository into main
Reviewed-on: #211
2024-10-03 03:33:08 +00:00
Roan Horning
0f5d8650b3 Merge branch 'main' into I206_change-links-for-hpr_generator-repository 2024-10-03 03:31:44 +00:00
0e1ddf7006 Remove reference to Gitlab repository 2024-10-01 16:43:24 -04:00
7ac6a8c51f Fix repository account from rho_n to HPR 2024-10-01 16:40:52 -04:00
Roan Horning
12166b507b Merge pull request 'Change account from rho_n to HPR' (#209) from I206_change-links-for-hpr_generator-repository into main
Reviewed-on: #209
2024-09-30 20:38:57 +00:00
Roan Horning
1ec5e78482 Merge branch 'main' into I206_change-links-for-hpr_generator-repository 2024-09-30 16:27:40 +00:00
Roan Horning
24e1177c45 Merge pull request 'Use FILTER html_line_break to format comments' (#207) from I206-fix-episode-page-comment-formatting into main
Reviewed-on: #207
2024-09-30 16:24:29 +00:00
20409e9521 Change account from rho_n to HPR 2024-09-30 11:53:27 -04:00
f377f56002 Use FILTER html_line_break to format comments
For comments in an episode page, use the html_line_break filter
instead of the html_para filter. The html_line_break filter is
used in the comment viewer page.
2024-09-29 20:10:20 -04:00
Roan Horning
73dd71f2f0 Merge pull request '[I132] tags page generation issues' (#205) from I132_tags_index_issues into main
Reviewed-on: #205
2024-09-28 15:49:44 +00:00
Roan Horning
06601c5d20 Merge branch 'main' into I132_tags_index_issues 2024-09-28 15:49:25 +00:00
Roan Horning
eedd954a11 Merge pull request 'Limit correspondent page episode count to released episodes' (#204) from I188_fix-correspondent-page-episode-count into main
Reviewed-on: #204
2024-09-28 15:44:53 +00:00
Roan Horning
a3b927f802 Merge branch 'main' into I188_fix-correspondent-page-episode-count 2024-09-28 15:44:24 +00:00
Roan Horning
1853715a19 Merge pull request '[I164] check for perl module dependencies' (#203) from I164_check-for-perl-module-dependencies into main
Reviewed-on: #203
2024-09-28 15:42:42 +00:00
b17daba4ed Fix generation of tags index page
Replace white-space in ID attributes with the underscore
character. Fix generation of tags that start with the letter
k. The tag, keys, caused issues when used as a hash key.
2024-09-17 23:03:52 -04:00
70d5983ede Parse db tag field with CSV parser module
The CSV parser module is being used in another
template. Make tag field parsing consistent.
2024-09-17 22:58:54 -04:00
31a5994731 Refactor template to use tag_to_id macro 2024-09-17 22:24:16 -04:00
aaaaa29d8e Add macro tag_to_id 2024-09-15 15:42:46 -04:00
3662ebd0aa Code formatting 2024-09-09 21:36:36 -04:00
c64ad492c8 Limit correspondent page episode count to released episodes
Fix for rho_n/hpr_generator#188
2024-09-08 12:23:45 -04:00
0f57b99fbe Add instructions for the dependency check script 2024-09-08 09:30:40 -04:00
48b3c51bb3 Update instructions for installing modules via CPAN 2024-09-08 09:08:23 -04:00
4e9f1457d5 Fix typos in module names 2024-09-08 09:05:34 -04:00
4ae854f5e1 Remove unused module import
The dbi sqlite module is not directly used in the site-generator code.
The module is called by template files. Removing it allows the main
code to be database independent.
2024-09-08 09:01:17 -04:00
af810c88bc Add bash script to check Perl module dependencies 2024-09-07 16:51:55 -04:00
Ken Fallon
92dce90753 Trixter avatar 2024-08-12 13:23:12 +00:00
Ken Fallon
65e4e1af5e Trollercoaster avatar 2024-08-11 16:10:44 +00:00
Ken Fallon
b5384408db Upload files to "public_html/images/hosts" 2024-08-07 09:21:46 +00:00
Ken Fallon
1a84becd8d Upload files to "public_html/images/hosts" 2024-08-07 09:20:42 +00:00
Ken Fallon
d74c23bace gemlog avatar 2024-08-07 09:18:33 +00:00
Ken Fallon
f1817e6820 Update templates/content-episode.tpl.html
Fix for 

HPR/hpr_hub#49
rho_n/hpr_generator#202
2024-07-17 19:21:05 +00:00
Ken Fallon
493bae282b Update README.md 2024-06-21 15:43:57 +00:00
Ken Fallon
dbc557d4c5 Changed the reserve to one week
This is because the IA is slow in processing the uploads resulting from DDOS attacks.
2024-06-11 16:51:31 +00:00
Ken Fallon
2099f0e130 Clarification of the reserve queue 2024-06-11 16:21:24 +00:00
Ken Fallon
29c9c827a4 Clarified the scheduling guidelines 2024-06-11 15:51:03 +00:00
19 changed files with 175 additions and 67 deletions

View File

@@ -6,11 +6,7 @@ If git is not installed on the operating system, please install it now
To retrieve the code from the repository on anhonesthost.net (a username and
password are required), run:
`git clone https://repo.anhonesthost.net/rho_n/hpr_generator.git`
To retrieve the code from the repository on gitlab.com, run:
`git clone https://gitlab.com/roan.horning/hpr_generator.git`
`git clone https://repo.anhonesthost.net/HPR/hpr_generator.git`
On success, an "hpr_generator" directory will be created in the folder from
which the clone command was executed containing a local copy of the git repository.
@@ -41,8 +37,9 @@ apt install libconfig-std-perl \
## Using CPAN to install the modules
A cross platform method to install the needed modules is the Perl CPAN application.
Make sure both the [make](https://www.gnu.org/software/make/manual/make.html)
command and the [cpan](https://perldoc.perl.org/CPAN) command are available.
Make sure that the [gcc](https://www.gnu.org/software/gcc/),
[make](https://www.gnu.org/software/make/manual/make.html),
and [cpan](https://perldoc.perl.org/CPAN) commands are available.
Install them using the operating system's package manager, or from source.
Run commands:
@@ -51,9 +48,21 @@ Run commands:
cpan Config::Std
cpan Template
cpan Template::Plugin::DBI
cpan Template::Plugin::HTML::Strip
cpan DBD::SQLite
cpan Date::Calc
cpan Tie::DBI
cpan Text:CSV_XS
```
## Testing for Perl module dependencies
A bash script is included in the utils directory that will list the Perl modules used by the site-generator and report whether the modules are installed on the current OS.
It can be run from any directory. To run from the utils directory:
```
./check-dependencies.sh
```
# Create the HPR database
@@ -177,7 +186,7 @@ baseurl: file://</path/to>/hpr_generator/public_html
```
Replace \<path/to\> with the full path to the hpr_generator directory. For
example: `file:///home/rho_n/development/hpr_generator/public_html`
example: `file:///home/HPR/development/hpr_generator/public_html`
## Configuring the website media file links

View File

@@ -25,7 +25,7 @@ Static web page generator for the Hacker Public Radio website.
- ``GRANT SELECT ON hpr_hpr.* TO 'hpr-generator'@'localhost';``
- ``GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost';``
* Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.)
* GetOpt
* Getopt::Long
* Pod::Usage
* Config::Std
* Template
@@ -35,7 +35,7 @@ Static web page generator for the Hacker Public Radio website.
* Template::Plugin::HTML::Strip
* DBI
* Tie::DBI
* DBD::SQLite or DBD:mysql
* DBD::SQLite or DBD::mysql
* Date::Calc
* Text::CSV_XS
* HTML::Entities
@@ -54,24 +54,26 @@ Generate pages based on the same template:
`site-generator correspondent=1,3,5..10`
## Support
Please [submit an Issue](https://repo.anhonesthost.net/rho_n/hpr_generator/issues),
Please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues),
and add the label "**Help Request**" for help running or installing the site-generator.
For discussing HPR site generation in general, please [submit an Issue](https://repo.anhonesthost.net/rho_n/hpr_generator/issues) and add the label "**General Discussion**".
For discussing HPR site generation in general, please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues) and add the label "**General Discussion**".
## Contributing
Happy to take any contributions or suggestions.
To contribute code or documentation, please create a fork of the project and [submit a pull request](https://repo.anhonesthost.net/rho_n/hpr_generator/pulls) or send a patch. If an issue exists that is related to your patch, please assign the issue to yourself, or if it is already assigned to someone else, please coordinate with them to minimize duplicated efforts.
To contribute code or documentation, please create a fork of the project and [submit a pull request](https://repo.anhonesthost.net/HPR/hpr_generator/pulls) or send a patch. If an issue exists that is related to your patch, please assign the issue to yourself, or if it is already assigned to someone else, please coordinate with them to minimize duplicated efforts.
If you have found an error in the code or the generated HTML, please [submit an Issue](https://repo.anhonesthost.net/rho_n/hpr_generator/issues),
If you have found an error in the code or the generated HTML, please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues),
and add the label "**Bug Found**".
To make a suggestion, please [submit an Issue](https://repo.anhonesthost.net/rho_n/hpr_generator/issues),
To make a suggestion, please [submit an Issue](https://repo.anhonesthost.net/HPR/hpr_generator/issues),
and add the label "**Feature Request**".
## Authors and acknowledgment
* Roan "Rho`n" Horning
* Dave Morriss
* gordons
* Ken Fallon
* norrist

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -122,7 +122,6 @@ use Text::CSV_XS;
use HTML::Entities qw(encode_entities);
use Date::Calc;
use DBI;
use DBD::SQLite;
use Tie::DBI;
use Template;
use Template::Plugin::Date;
@@ -291,26 +290,23 @@ sub parse_page_arg {
# Split page name from page ids if available.
my ($page, $ids) = split(/=/, $page_arg);
my @ids;
$ids = "" unless defined $ids;
if(!$ids) {
$ids = "";
}
else {
# Parse the page ids and push them onto @ids array
my @ids_by_comma = split(/\,/, $ids);
foreach my $id_by_comma (@ids_by_comma) {
my @ids_for_range = split(/\.\./, $id_by_comma);
if ((scalar @ids_for_range) == 2) {
push @ids, $ids_for_range[0]..$ids_for_range[1];
}
elsif ((scalar @ids_for_range) == 1) {
push @ids, $ids_for_range[0];
}
else {
verbose (1, "\nWarning: Page $page id range $id_by_comma could not be parsed.");
}
# Parse the page ids and push them onto @ids array
my @ids_by_comma = split(/\,/, $ids);
foreach my $id_by_comma (@ids_by_comma) {
my @ids_for_range = split(/\.\./, $id_by_comma);
if ((scalar @ids_for_range) == 2) {
push @ids, $ids_for_range[0]..$ids_for_range[1];
}
elsif ((scalar @ids_for_range) == 1) {
push @ids, $ids_for_range[0];
}
else {
verbose (1, "\nWarning: Page $page id range $id_by_comma could not be parsed.");
}
}
return ('page' => $page, 'ids' => [@ids]);
}
@@ -327,7 +323,7 @@ sub get_ids_from_db {
|| die $tt->error(), "\n";
# Starts with a newline and comma
return split(/,/, substr($selected_ids, 2));
return split(/,/, substr($selected_ids, 1));
}
sub get_filename {

View File

@@ -582,9 +582,10 @@
<h1 id="reserve_queue">Feed the reserve queue<a href="<!--% absolute_url(baseurl,'about.html#reserve_queue') %-->">.</a></h1>
<p>
The reserve queue is intended only to be used in the cases where there is still a gap in the schedule 24 hours prior to release.
The reserve queue is intended only to be used in the cases where there is still a gap in the schedule one week prior to release.
This was known as the emergency queue, but now can also be used when the hosts don't care when the shows are scheduled.
They will be used on a first come first go basis, when there is no conflict with the scheduling guidelines.
These shows contain a message alerting listeners to the fact that we had free slots that were not filled.
</p>
<hr />
@@ -592,11 +593,12 @@
<h1 id="scheduling_guidelines">Scheduling Guidelines</h1>
<ol>
<li>You must have your audio recording ready to upload <strong>before</strong> you pick a slot.</li>
<li>New hosts, Interviews, and other time critical shows should use the first free slot.</li>
<li>Always try and fill any free slots that are available in the upcoming two weeks.</li>
<li>If the queue is filling up then please consider leaving some slots free for new contributors.</li>
<li>If you have a non urgent show then find a empty week and schedule it then.</li>
<li>If you are uploading a series of shows, consider scheduling one every two weeks.</li>
<li>Interviews may be released sooner.</li>
<li>When the queue is filling up then leave some slots free for new contributors.</li>
<li>Post non urgent shows into the first empty week.</li>
<li>If you are uploading a series of shows then post them one every two weeks.</li>
<li>If you have a non urgent show that is timeless, then add it to the <a href="<!--% absolute_url(baseurl,'about.html#reserve_queue') %-->">Reserve Queue</a>.</li>
</ol>
<hr />

View File

@@ -28,7 +28,7 @@
<article>
<header>
<h1><a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(item.eps_id) %-->/index.html#comment_<!--% item.comment_id %-->"><!--% item.comment_author_name %--> says</a>: <!--% item.comment_title %--></h1>
<h1><!--% item.comment_author_name %--> says: <!--% item.comment_title %--></h1>
<p><small>Posted at <!--% item.comment_timestamp %--> relating to the show <a href="<!--% absolute_path(baseurl) %-->eps/hpr<!--% zero_pad_left(item.eps_id) %-->/index.html">hpr<!--% item.eps_id %--></a> which was released on <!--% item.episode_date %--> by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(item.host_id) %-->.html"><!--% item.host %--></a> entitled <em><!--% item.episode_title %--></em></small>
</p>
</header>

View File

@@ -3,15 +3,10 @@
<!--% PROCESS 'shared-utils.tpl.html' %-->
<!--% PROCESS "queries-correspondent-${constants.database}.tpl.html" %-->
<!--% USE DBI(constants.driver, constants.user, constants.password) %-->
<!--% query_hpr_show_count = DBI.prepare('
SELECT id
FROM eps
WHERE eps.hostid = ?
')
%-->
<!--% results_hpr_shows = DBI.prepare(query_hpr_shows)
%-->
<!--% hpr_shows_to_count = query_hpr_show_count.execute(id); %-->
<!--% results_hpr_show_count = DBI.prepare(query_hpr_show_count) %-->
<!--% hpr_shows_to_count = results_hpr_show_count.execute(id); %-->
<!--% hpr_shows = results_hpr_shows.execute(id); %-->
<!--% hpr_show_count = 0 %-->
<!--% FOREACH show IN hpr_shows_to_count %-->

View File

@@ -56,8 +56,8 @@ Subscribe to the comments <a href="<!--% absolute_path(baseurl) %-->comments.rss
<!--% FOREACH comment IN comments_result %-->
<h5 id="comment_<!--% comment.id %-->"><a href="/eps/hpr<!--% zero_pad_left(episode.id) %-->/index.html#comment_<!--% comment.id %-->">Comment #<!--% comment_index %--></a> posted on <!--% comment.comment_timestamp %--> by <!--% comment.comment_author_name %--></h5>
<h4><!--% comment.comment_title %--></h4>
<!--% comment.comment_text FILTER html_para %-->
<!--% comment_index = comment_index + 1 %-->
<p class="comment"><!--% comment.comment_text FILTER html_line_break %--></p>
<!--% comment_index = comment_index + 1 %-->
<!--% END %-->
<h2>Leave Comment</h2>
@@ -110,9 +110,18 @@ Subscribe to the comments <a href="<!--% absolute_path(baseurl) %-->comments.rss
</tr>
<!-- . -->
<tr>
<td>What is the <strong>HOST_ID</strong> for the host of this show?</td>
<td>Who is the <strong>host</strong> of this show?</td>
<td>
<input required type="text" name="hostid" size="20" maxlength="5" placeholder="Type the host number"></td>
<select required name="hostid" id="hostid">
<option value="Spammer" selected="selected">Spammer</option>
<option value="Spammer">Linus Torvalds</option>
<option value="Spammer">Marie Curie</option>
<option value="<!--% episode.hostid %-->"><!--% episode.host %--></option>
<option value="Spammer">Alan Turing</option>
<option value="Spammer">Terry Pratchett</option>
<option value="Spammer">Yuri Gagarin</option>
</select>
<td>
<td>
<!-- . -->
<tr>

View File

@@ -4,27 +4,27 @@
<!--% PERL %-->
$Template::Stash::PRIVATE = undef; # Allow . in tag
<!--% END %-->
<!--% USE String %-->
<!--% uniq_tag_count = 0 %-->
<!--% comma_re = '(?x)(?:^|,\s*)(?:"((?>[^"]*)(?:""[^"]*)*)"|([^",]*))'; %-->
<!--# 'Moka5,interview, "computer science"' -->
<!--% FOREACH episode IN DBI.query(query_tags);
ep_id = episode.id;
ep_tags = episode.tags;
FOREACH tag_str IN ep_tags.split(comma_re);
FOREACH tag_str IN ep_tags.csv_parse;
NEXT UNLESS tag_str;
NEXT IF tag_str == '';
tag = tag_str.lower;
tag_index = String.new(tag).push('_');
first_char = tag.substr(0,1);
IF first_char == '.';
first_char = '&#x0002E;'; # Unicode .
END;
IF all_tags.${first_char}.exists(tag);
all_tags.${first_char}.${tag}.count = all_tags.${first_char}.${tag}.count + 1;
all_tags.${first_char}.${tag}.urls.push(ep_id);
IF all_tags.${first_char}.exists(tag_index);
all_tags.${first_char}.${tag_index}.count = all_tags.${first_char}.${tag_index}.count + 1;
all_tags.${first_char}.${tag_index}.urls.push(ep_id);
ELSE;
all_tags.${first_char}.${tag}.count = 1;
all_tags.${first_char}.${tag_index}.count = 1;
uniq_tag_count = uniq_tag_count + 1;
all_tags.${first_char}.${tag}.urls = [ep_id];
all_tags.${first_char}.${tag_index}.urls = [ep_id];
END;
END;
END %-->
@@ -53,7 +53,7 @@ END %-->
<ul class="columns3">
<!--% FOREACH first_char IN all_first %-->
<!--% IF all_tags.${first_char} %-->
<li><a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% all_tags.${first_char}.keys.sort.first %-->"><strong><!--% first_char %--></strong></a></li>
<li><a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag_to_id(String.new(all_tags.${first_char}.keys.sort.first).chop) %-->"><strong><!--% first_char %--></strong></a></li>
<!--% END %-->
<!--% END %-->
</ul>
@@ -63,11 +63,12 @@ END %-->
<p class="ralign"><a href="<!--% absolute_path(baseurl) %-->tags.html#TOP">&UpArrow; Go to index</a></p>
<h3>Tags beginning with '<!--% first_char %-->'</h3>
<ul>
<!--% FOREACH tag IN all_tags.${first_char}.keys.sort %-->
<!--% FOREACH tag_index IN all_tags.${first_char}.keys.sort %-->
<!--% tag = String.new(tag_index).chop; tag_id = String.new(tag_index).chop; %-->
<li>
<a id="<!--% tag %-->"><strong><!--% tag %--></strong></a>:
<a id="<!--% tag_to_id(tag_id) %-->"><strong><!--% tag %--></strong></a>:
<!--% ep_links = [] %-->
<!--% FOREACH ep_id IN all_tags.${first_char}.${tag}.urls.nsort;
<!--% FOREACH ep_id IN all_tags.${first_char}.${tag_index}.urls.nsort;
ep_links.push("<a href=\"${absolute_path(baseurl)}eps/hpr" _ zero_pad_left(ep_id) _ '/index.html"'
' target="_blank" aria-label="' _ tag _
' - show ' _ ep_id _ '">' _ ep_id _ '</a>');

View File

@@ -52,7 +52,7 @@
</h1>
<h2>Your ideas, projects, opinions - podcasted.</h2>
<h3>New episodes every weekday Monday through Friday.<br />
<em><small>This page was <a href="https://repo.anhonesthost.net/rho_n/hpr_generator">generated</a> by <a href="mailto:<!--% generator_email %-->"><!--% generator_name %--></a> at <time dateTime="<!--% format_iso8601_date(date.now) %-->"><!--% format_feed_date(date.now) %--></time></small></em></h3>
<em><small>This page was <a href="https://repo.anhonesthost.net/HPR/hpr_generator">generated</a> by <a href="mailto:<!--% generator_email %-->"><!--% generator_name %--></a> at <time dateTime="<!--% format_iso8601_date(date.now) %-->"><!--% format_feed_date(date.now) %--></time></small></em></h3>
</div>
<hr />

View File

@@ -1,5 +1,5 @@
<!--% query_hpr_shows = '
SELECT
SELECT
eps.id,
eps.explicit,
eps.date, eps.license, eps.duration,
@@ -16,3 +16,9 @@
ORDER BY eps.id DESC
'
%-->
<!--% query_hpr_show_count = '
SELECT id
FROM eps
WHERE eps.hostid = ? AND eps.date < DATE_ADD(NOW(), INTERVAL 1 DAY)
'
%-->

View File

@@ -16,3 +16,9 @@
ORDER BY eps.id + 0 DESC
'
%-->
<!--% query_hpr_show_count = '
SELECT id
FROM eps
WHERE eps.hostid = ? AND eps.date < date(\'now\', \'+1 days\')
'
%-->

View File

@@ -11,7 +11,7 @@
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback.nospam@nospam.hackerpublicradio.org (HPR Feedback)</managingEditor>
<webMaster>admin.nospam@nospam.hackerpublicradio.org (HPR Webmaster)</webMaster>
<generator>https://repo.anhonesthost.net/rho_n/hpr_generator</generator>
<generator>https://repo.anhonesthost.net/HPR/hpr_generator</generator>
<docs>https://www.rssboard.org/rss-specification</docs>
<ttl>600</ttl>
<image>

View File

@@ -14,7 +14,7 @@ from the series <em><a href="<!--% baseurl %-->series/<!--% zero_pad_left(series
<!--% MACRO display_tags(tags) BLOCK %-->
<span><label>Tags:</label> <em>
<!--% FOREACH tag IN tags.csv_parse %-->
<a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag.lower %-->"><!--% tag %--></a><!--% IF loop.count == loop.size %-->.<!--% ELSE %-->,<!--% END %-->
<a href="<!--% absolute_path(baseurl) %-->tags.html#<!--% tag_to_id(tag) %-->"><!--% tag %--></a><!--% IF loop.count == loop.size %-->.<!--% ELSE %-->,<!--% END %-->
<!--% END %--></em>
</span>
<!--% END %-->

View File

@@ -49,6 +49,15 @@
<!--% iso8601_date.format(date_to_format) %-->
<!--% END %-->
<!--% MACRO tag_to_id(tag, is_index) BLOCK %-->
<!--% tag = tag.replace('\s+','_') %-->
<!--% IF is_index %-->
<!--% tag.upper %-->
<!--% ELSE %-->
<!--% tag.lower %-->
<!--% END %-->
<!--% END %-->
<!--% MACRO absolute_url(base, path) BLOCK %-->
<!--% UNLESS base.empty %-->
<!--% UNLESS base.substr(-1) == '/' %-->

73
utils/check-dependencies.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/bash -
#===============================================================================
#
# FILE: check-dependencies.sh
#
# USAGE: ./check-dependencies.sh
#
# DESCRIPTION: Check that Perl module dependencies for the hpr_generator
# are installed.
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Roan "Rho`n" Horning (roan.horning@gmail.com)
# ORGANIZATION:
# CREATED: 09/05/2024 09:55:00 PM
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
#--- FUNCTION ----------------------------------------------------------------
# NAME: is_module_installed
# DESCRIPTION: Tests if the supplied module is found on the system
# PARAMETERS: Name of the denpendent Perl module
# RETURNS: 0 if not found, 1 if found
#-------------------------------------------------------------------------------
function is_module_installed {
HR="----------------------"
perl -e "use ${1} "
if [ $? -ne 0 ]
then
echo ${HR}
else
echo "Found module ${1}"
echo ${HR}
fi
}
MODULES=( \
"Getopt::Long" \
"Pod::Usage" \
"Config::Std" \
"Template" \
"Template::Plugin::File" \
"Template::Plugin::DBI" \
"Template::Plugin::HTML::Strip" \
"DBI" \
"Tie::DBI" \
"DBD::SQLite" \
"DBD::mysql" \
"Date::Calc" \
"Text::CSV_XS" \
)
echo "The following modules must be installed for the site-generator to function: "
for module in "${MODULES[@]}"
do
echo "* ${module}"
done
echo "When MySQL is used, the DBD:mysql module is required (otherwise it is optional)"
echo "When SQLite is used, then the DBD:SQLite module is required (otherwise it is optional)"
echo "Scanning for modules ..."
echo "----------------------"
for module in "${MODULES[@]}"
do
is_module_installed "${module}"
done
echo "Finished scanning."