https://github.com/trueheart78/food-tracker
Tracks Food using YAML files instead of a traditional database.
https://github.com/trueheart78/food-tracker
ruby sinatra sinatrarb yaml
Last synced: over 1 year ago
JSON representation
Tracks Food using YAML files instead of a traditional database.
- Host: GitHub
- URL: https://github.com/trueheart78/food-tracker
- Owner: trueheart78
- License: mit
- Archived: true
- Created: 2021-03-12T02:53:50.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-24T06:19:25.000Z (about 4 years ago)
- Last Synced: 2024-10-24T15:39:05.804Z (over 1 year ago)
- Topics: ruby, sinatra, sinatrarb, yaml
- Language: Ruby
- Homepage:
- Size: 980 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Food Tracker :watermelon: [](https://circleci.com/gh/trueheart78/food-tracker)
Tracks food.
## Features
Each item supports multiple:
* Brands
* Expiration dates
* "Best by" dates
* Custom Locations
Items also support a single "out of stock" flag.
## Endpoints
* Index: `/`
* Just a landing page, so as to not give site traversal to those that are unaware.
* Kitchen: `/in-the-kitchen`
* Displays items in stock that aren't fully expired.
* Expiring: `/expiring`
* Displays items expiring soon, already expired, and where the "best buy" date has passed.
* Out of stock: `/out-of-stock`
* Displays items that are out of stock.
* Environment: `/env`, `/environment`
* Displays all environment variables available.
* **Note:** Only available in the `development` environment.
## Tasks
### Sort Data
Sorts the types and items in the `data/` YAML files, alphabetically.
```sh
./tasks/sort_data.rb
```
### Date Detector (WIP)
Sends an email with items that are expiring, expired, and out-of-stock.
```sh
./tasks/date_detector.rb
```
## Data Files
Utilizes YAML files, which are located in the `data/` directory.
### Locations
Default locations are defined in the data files.
### Types
Assigned types are defined in the data files.
### Notations
Each data file supports the use of the following notations (even multiple times per entry):
* Square brackets to denote expiration dates: `[4/30/29]`.
* Bars to denote "best by" dates: `|4/30/29|`.
* Curly braces to denote brands: `{Reeses's}`.
* Parentheses to denote custom location: `(freezer)`.
**Note:** For each entry, spacing between the notations does not matter, neither does the order.
#### Out of Stock
The only limited notation is for the "out of stock" marker, which is denoted by `^oos^`. These are items that are generally available, so a re-order is required. These items will not show up on any page except the Out of Stock endpoint.
## Development
### Running the Server Locally
It is designed to be run with `Shotgun`, to enable code reloading without having to restart the
server.
```
bundle exec shotgun
```
### Environment File (.env)
Create a copy of the `.env` file, and then make sure to update it with relevant details:
```sh
cp .env .env.local
vim .env.local
```
Load order for `.env` files are as follows:
1. `.env.APP_ENV`, where `APP_ENV` is `test` or `development`
2. `.env.local`
3. `.env`
You can setup a `.env.local` for data that is general, and put specifics in the
`APP_ENV` versions.