- Description
- Directories and Files
- Commands
- Installation
- Requirements
- Example Commands
- Build with
- Authors
In the next few months, we at Holberton School will be creating the AirBnB clone project, and how it says is a clone of the AirBnB application. We will face and develop this project in parts like:
- The console
- Web static
- MySQL storage
- Web framework - templating
- RESTful API
- Web dynamic
This is the final part of our project:
https://github.com/dario-castano/AirBnB_clone_v2.git
This console was built and tested in Ubuntu 14.04LTS, interpreted/compiled using Python3
All the test should be executed by using this command:
python3 -m unittest discover tests
Also you can test file by file using this command:
python3 -m unittest tests/test_models/test_base_model.py
Directory | Description |
---|---|
models | This package contains the modules and classes to create an specific object |
engine | This package contains the module to manage the file storage |
tests | This package contains all the test for models and classes |
scripts | This directory contains the script to generate the AUTHORS file |
Files | Description |
---|---|
console.py | The console file |
AUTHORS | This file contains all the authors of this project |
File | Description |
---|---|
amenity.py | The amenity subclass |
base_model.py | The base model superclass |
city.py | The city subclass |
place.py | The place subclass |
review.py | The review subclass |
state.py | The state subclass |
user.py | The user subclass |
File | Description |
---|---|
file_storage.py | The file storage class |
db_storage.py | DBStorage |
File | Description |
---|---|
test_amenity.py | Unittest module for amenity |
test_base_model.py | Unittest module for base model |
test_city.py | Unittest module for city |
test_place.py | Unittest module for place |
test_review.py | Unittest module for review |
test_state.py | Unittest module for state |
test_user.py | Unittest module for user |
test_engine/test_file_storage.py | Unittest module for file storage |
Command | Usage | Example | Functionality |
---|---|---|---|
help |
help |
help |
Display the list of the commands that can be executed |
create |
create <class> |
create Place |
Creates a new instance of a class |
show |
show <class> <id> |
show Place 123-123-123 |
Shows a specific instance |
destroy |
destroy <class> <id> |
destroy Place 123-123-123 |
deletes a specific instance |
all |
all or all <class> |
all Place |
Shows all instances or shows an entire class |
update |
update <class> <id> <attribute> <value> |
update User 123-123-123 email '[email protected]' |
Updates an specific attribute of an instance |
quit |
quit |
quit |
Quits the console |
EOF |
Ctr+D |
EOF |
Quits the console with keyboard interruption |
To run : ./console.py
or non-interactive mode run echo "command to run" | ./console.py
$ ./console.py
(hbnb) help
Documented commands (type help <topic>):
========================================
EOF all count create destroy help quit show update
(hbnb)
(hbnb)
(hbnb)
(hbnb) quit
$
$ ./console.py
(hbnb) create BaseModel
5dccfbf9-03a6-45f7-8a75-80094392bf97
(hbnb) show BaseModel 5dccfbf9-03a6-45f7-8a75-80094392bf97
[BaseModel] (5dccfbf9-03a6-45f7-8a75-80094392bf97) {'id': '5dccfbf9-03a6-45f7-8a75-80094392bf97', 'updated_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549740), 'created_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549699)}
(hbnb) all
[[BaseModel] (5dccfbf9-03a6-45f7-8a75-80094392bf97) {'id': '5dccfbf9-03a6-45f7-8a75-80094392bf97', 'updated_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549740), 'created_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549699)}]
(hbnb) BaseModel.count
1
(hbnb) update BaseModel 5dccfbf9-03a6-45f7-8a75-80094392bf97 number 89
(hbnb) show BaseModel 5dccfbf9-03a6-45f7-8a75-80094392bf97
[BaseModel] (5dccfbf9-03a6-45f7-8a75-80094392bf97) {'number': '89', 'updated_at': datetime.datetime(2018, 6, 13, 23, 11, 51, 470426), 'created_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549699), 'id': '5dccfbf9-03a6-45f7-8a75-80094392bf97'}
(hbnb) create User
71e19890-6440-4ca9-9976-59ba61571f09
(hbnb) all
[[User] (71e19890-6440-4ca9-9976-59ba61571f09) {'id': '71e19890-6440-4ca9-9976-59ba61571f09', 'updated_at': datetime.datetime(2018, 6, 13, 23, 12, 39, 71568), 'created_at': datetime.datetime(2018, 6, 13, 23, 12, 39, 71532)}, [BaseModel] (5dccfbf9-03a6-45f7-8a75-80094392bf97) {'number': '89', 'updated_at': datetime.datetime(2018, 6, 13, 23, 11, 51, 470426), 'created_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549699), 'id': '5dccfbf9-03a6-45f7-8a75-80094392bf97'}]
(hbnb) destroy User 71e19890-6440-4ca9-9976-59ba61571f09
(hbnb) all
[[BaseModel] (5dccfbf9-03a6-45f7-8a75-80094392bf97) {'number': '89', 'updated_at': datetime.datetime(2018, 6, 13, 23, 11, 51, 470426), 'created_at': datetime.datetime(2018, 6, 13, 23, 10, 13, 549699), 'id': '5dccfbf9-03a6-45f7-8a75-80094392bf97'}]
(hbnb) destroy BaseModel 5dccfbf9-03a6-45f7-8a75-80094392bf97
(hbnb) all
[]
(hbnb) create Place city_id="0001" user_id="0001" name="My_little_house" number_rooms=4 number_bathrooms=2 max_guest=10 price_by_night=300 latitude=37.773972 longitude=-122.431297
76b65327-9e94-4632-b688-aaa22ab8a124
(hbnb) quit
$
$ echo "help" | ./console.py
(hbnb)
Documented commands (type help <topic>):
========================================
EOF all count create destroy help quit show update
(hbnb) $
$
$ echo "create BaseModel" | ./console.py
(hbnb) f09bfbad-532d-4bbe-a2c1-815b1958f01e
(hbnb) $
$ echo "all" | ./console.py
(hbnb) [[BaseModel] (f09bfbad-532d-4bbe-a2c1-815b1958f01e) {'id': 'f09bfbad-532d-4bbe-a2c1-815b1958f01e', 'updated_at': datetime.datetime(2018, 6, 13, 23, 16, 30, 420332), 'created_at': datetime.datetime(2018, 6, 13, 23, 16, 30, 420300)}]
(hbnb) $
$ echo "destroy BaseModel f09bfbad-532d-4bbe-a2c1-815b1958f01e" | ./console.py
(hbnb) (hbnb) $
$ echo "all" | ./console.py
(hbnb) []
(hbnb) $
$
- Python3: Language builded
- Ubuntu 14.04 LTS: Operative System
- PEP8: Style guide for Python code in ver. 1.7
- MySQL 5.7: RDBMS in version 5.7.8-rc
- SQLAlchemy: The Database Toolkit for Python in version 1.2.x
Initial authors:
Miranda Evans [email protected]
Kevin Yook [email protected]
We are:
Dario Castaño - Twitter -