1
0
forked from HPR/hpr_generator

WIP - working on README.md

This commit is contained in:
Paul Jewell 2025-01-30 23:01:32 +00:00
parent d617cf01d3
commit 01a1e72f6a

View File

@ -3,52 +3,35 @@
Static web page generator for the Hacker Public Radio website. Static web page generator for the Hacker Public Radio website.
## Installation ## Installation
Steps necessary to install this generator locally:
* Clone or download this repository * Clone or download this repository
* Download the database and load into SQLite or mySQL * Install the needed Perl modules using your preferred method (distribution
SQLite is the preferred database management tool for local generation. The tools available in the utils directory of this repository support ease of use with SQLite. However, you can also use mySQL locally if you wish. Instructions are provided for both: packages, CPAN, etc.)
* SQLite
- Create the sqlite3 database from the hpr.sql MySQL dump file available on hackerpublicradio.org. The default name for the database file is "hpr.db" and should be located in the root of the project directory. The name and location can be set in the site.cfg file.
- An "update-hpr.sh" helper script is available in the utils directory. This script will download the hpr.sql file, convert it to the SQLite hpr.db file, and regenerate the website using the site-generator. 1. `cd` into the root of the project directory 2. Run `./utils/update-hpr.sh`
Note: SQLite v3.8.3 or greater is recommended. CTE WITH clauses are used in some template queries. Must convert WITH clauses to sub-queries when using earlier versions of SQLite.
* mySQL
- Create database hpr_hpr in the MySQL server from HPR dump file. - `sudo mysql --host=localhost < hpr.sql`
- Create a user that will be used by the site-generator. - Suggested username: hpr-generator:
- `CREATE USER 'hpr-generator'@'localhost' IDENTIFIED BY '<password>';`
- Limit the user's privileges to EXECUTE and SELECT:
- ``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::Long
- Pod::Usage
- Config::Std
- Template
- Template::Plugin::File
- Template::Plugin::DBI
- Template::Plugin::Date
- Template::Plugin::HTML::Strip
- DBI
- Tie::DBI
- DBD::SQLite or DBD::mysql
- Date::Calc
- Text::CSV_XS
- HTML::Entities
- See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
installing the HPR generator.
## Usage ## Usage
The following utilities are provided to support the process of
generating the website:
* `utils/update-hpr-db.sh` - Download the database and transform it
into the hpr.db SQLite database.
* `utils/update-hpr.sh` - Download HPR.sql and create the SQLite database
using `update-hpr-db.sh`, then run `site-generator` to create the
website.
* `./site-generator` - Using the information in the templates
directory and the show information in the database, generate the
website. Without parameters, the whole site will be generated.
Generate two specific pages: If you need to generate specific pages (in this example, index and about):
`site-generator index about` `site-generator index about`
Generate the whole site: Having downloaded the database, you can also regenerate the whole site:
`site-generator --all` `site-generator --all`
Generate pages based on the same template: Generate pages based on the same template:
`site-generator correspondent=1,3,5..10` `site-generator correspondent=1,3,5..10`
## More Information
* See the [Getting Started](GETTING_STARTED.md) tutorial for more details on
installing and using the HPR generator.
## Support ## Support
@ -77,3 +60,6 @@ and add the label "**Feature Request**".
* Ken Fallon * Ken Fallon
* norrist * norrist
* Paul Jewell (paulj) * Paul Jewell (paulj)