- Ruby 87%
- Jsonnet 9%
- Dockerfile 4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
ip2location_ruby calls Kernel#abort when it cannot open the database, which raises SystemExit -- not a StandardError -- so the rescue in detect_timezone never fired and every request from a non-localhost visitor 500'd while the database was absent. Rescue it explicitly, and skip the lookup when the file is not there so a missing database does not pay a C-ext open and an abort on every request. Resolving the path through one method also stops File.absolute_path(nil) blowing up at boot when IP2LOCATION_DB_PATH is unset. test_helper touches an empty placeholder so the lookup tests, which stub Geocoder outright, still look like a host that has the database installed. |
||
| .crow | ||
| db | ||
| kubernetes | ||
| LICENSES | ||
| static | ||
| test | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .sops.yaml | ||
| app.rb | ||
| bot.rb | ||
| celebrate_calendar_banner.png | ||
| celebrate_calendar_square.png | ||
| Dockerfile | ||
| Gemfile | ||
| Gemfile.lock | ||
| holidays.sql | ||
| LICENSE | ||
| link_checker.rb | ||
| models.rb | ||
| Rakefile | ||
| README.md | ||
| REUSE.toml | ||
Every Day Celebration
Every day is a day to celebrate! This website lists fun, wacky, and interesting holidays for every day of the year.
Focused on tech and science, with an American bent.
Whether it's "Talk Like a Pirate Day", "National Pizza Day", or something even more obscure, there's always a reason to find a little joy in the day.
My goal is to provide a simple way to discover these celebrations.
Data is sourced from various public holiday databases and curated to ensure there's at least one celebration for every single day. IP2Location LITE data used to do timezone guessing.
Technical Documentation
Requirements
- Ruby 4.0+
- SQLite3
- Bundler
Installation
- Clone the repository.
- Install dependencies:
bundle install - Set up environment variables (copy
.env.exampleto.envif available, or set manually):HOLIDAY_DB_PATH: Path to the SQLite database (e.g.,db/holidays.sqlite).IP2LOCATION_DB_PATH: Path to the IP2Location LITE database (for geolocation).IP2LOCATION_TOKEN: Token for downloading the IP2Location database.MASTODON_BASE_URL: Protocol and domain (optionally port) of the mastodon server the bot should post to.MASTODON_ACCESS_TOKEN: Application access token. Needs to havewrite:statusespermission.MASTODON_ACCOUNT_NAME: For the Fediverse link.
Database Setup
Initialize the database with the provided SQL dump:
rake db:reset
To update the GeoIP database (requires IP2LOCATION_TOKEN):
rake geoip:update
Running the Application
Start the web server:
bundle exec ruby app.rb
The application will be available at http://localhost:4567.
Running with Docker
Build the image:
rake docker:build
Run the container:
rake docker:app
Testing
Run the test suite:
bundle exec rake test
Mastodon Bot
There is a bot included to post today's holiday to Mastodon.
rake bot:post
License
This project is licensed under the MPL-2.0.