README ¶
Fetch events and convert to PDF
This app creates a bash shell that causes an application to read the
contents of events and then convert them to PDF. The application is
a NodeJS app that leverates the puppeteer
library. That's the only
thing that I've found that does a nice, neat PDF with out a lot of
empty pages at the top.
Installation
The app expects that hn.js
is in the current directory and that the current
directory is initialized properly to be both a Go and a NodeJS directory. Use
these steps to make that happen.
Go
- Latest version of [Go](https://golang.org}.
- Correct directory structure.
HOME
|
+ go
|
+ bin
+ pkg
+ src
|
+ github.com
|
+ salsalabs
- Change the directory to
salsalabs
. - Install this repository.
git clone https://github.com/salsalabs/godig
- Change the directory to
godig
. - Install all Go dependencies.
go get ./...
- Build this application
go build -o list_events cmd/list_events
NodeJS
Execute these statements in the godig
directory. This is important.
- Install Node Version Manager (NVM)
- Install the latest version of nvm in the current directory.
nvm install default
- Initialize to be a NodeJS package.
npm init #then tap the enter key a bunch of times
- Install the
puppeteer
library for NoeJS](https://github.com/GoogleChrome/puppeteer)
npm install --save puppeteer
Salsa
- Campaign manager credentials for the organization.
- Create a YAML file with the campaign manager credentials. We'll refer to this as
whatever.yaml
in this document. - click here to find the hostname.
hostname: Salsa node name
email: campaign manager's email address
password: campaign manager's password
Execution
- Run the Go app to create a bash script to retrieve events.
./list_events --login whatever.yaml
- Run the script generated by the Go command.
bash fetch_events.bash
- There may be errors. You'll have to fix those yourself.
- When the process is done, there will be a directory named
pdfs/events
. It contains all of the event PDFs.
Notes
The scripts used to process events are generated asynchronously. It's eally hard to find out where errors occur because of that.
Here is a bash scrap that sorts the list of events by event_KEY.
sort -k 2 -n -t = fetch_events.bash >xx.bash
mv xx.bash fetch_events.bash
The sort splits the line into the stuff before and after the equal sign (-t =
).
The stuff to the right of the equal sign is the second field (-k 2
),
and it starts with the event_KEY, which is numeric (-n
). Since the
first part of the second half is being sorted numerically, event_KEYs
that start in the 800's (for example) are sorted below the ones in the
20,000's. If the sort were a straight text sort, then the 800's would
appear at the bottom.
If the script fails, then you can view the contents of pdf/events
to see how far along the script was. Make adjustments to the script
and continue.
Questions?
Use the "Issues" link at the top of this repository to ask questions and report errors. Do not contact Salsalabs support. They are surly and bite-y during their nesting season. Use the "Issues" link. We'll be back in touch eventually.
Documentation ¶
There is no documentation for this package.