Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsmunim/parking-lot-manager
A simple parking lot management abstraction POC
https://github.com/itsmunim/parking-lot-manager
Last synced: about 4 hours ago
JSON representation
A simple parking lot management abstraction POC
- Host: GitHub
- URL: https://github.com/itsmunim/parking-lot-manager
- Owner: itsmunim
- Created: 2019-10-29T16:46:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T18:58:01.000Z (almost 2 years ago)
- Last Synced: 2024-02-23T09:43:03.775Z (9 months ago)
- Language: TypeScript
- Size: 80.1 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: ReadMe.md
Awesome Lists containing this project
README
##### Parking Lot CLI
A simple command line interface for managing your parking lot.
###### Setup
- You can either run: `cd program && npm i && npm run build` or `./bin/setup` to setup necessary files
- In case you can't run `./bin/setup`, give the file `execution` permission by running `chmod +x bin/setup`
in your terminal- `./bin/setup` is recommended as it will also run the unit tests
- If you follow the node way of preparing the project, then run unit tests manually to
confirm everything is working as expected. To do that type: `npm test` inside `program` dir###### Testing the CLI
- The CLI can either be run in interactive mode or provided a file to process
- It can be spawn up using either of the approaches below:
```bash
cd program
./dist/index.js # interactive mode
./dist/index.js file.txt # file based processing
```or
```bash
./bin/parking_lot # interactive mode
./bin/parking_lot file.txt # file based processing
```- To test the file based processing, you can put the following content in a text file
and try running the CLI with the file path provided```text
// file.txtcreate_parking_lot 6
park KA-01-HH-1234 White
park KA-01-HH-9999 White
park KA-01-BB-0001 Black
park KA-01-HH-7777 Red
park KA-01-HH-2701 Blue
park KA-01-HH-3141 Black
leave 4
status
park KA-01-P-333 White
park DL-12-AA-9999 White
registration_numbers_for_cars_with_colour White
slot_numbers_for_cars_with_colour White
slot_number_for_registration_number KA-01-HH-3141
slot_number_for_registration_number MH-04-AY-1111
``````bash
./bin/parking_lot file.txt
```###### Running the Integration Tests
- To check both the modes specified above, you can run the whole integration test suit
given under `functional_spec` dir```bash
./bin/run_functional_tests
```- To run different specs separately, refer to the `readme` given inside `functional_spec` dir
###### Source Code Structure
- The `core` module contains the main functionality of the CLI
- The file structure looks like below:
```
| - src
| - core
| - domains
| - test
| - car.ts
| - ...
| - services
| - command.executors
| - test
| - parking.lot.manager.ts
| - index.ts
```- `src/index.ts` is the entry point for the CLI
- The project uses `typescript` and hence the `npm run build` step is crucial, which creates
the executable `dist/` dir under `program/`- `core/domains` contains the main business models for the CLI
- `core/services/command.executors` contains the backbone of execution flow for the CLI