WIP: GitWalk
This is a simple fetcher Github Repo Stars.
Index
- Project dependencies
- Creating the database user
- Project Instalation
- Usage Gitwalk
- Contact
- Contributing
Project dependencies
- Ruby 3.2.0
- Rails 7.0.4.2
- PostgreSQL
- Redis
- Foreman
Follow these instrunctions to install dependencies
If you use MacOS: Ruby: https://github.com/rbenv/rbenv#homebrew-on-macos PostgreSQL: https://www.postgresql.org/download/macosx/ Redis: https://redis.io/docs/getting-started/installation/install-redis-on-mac-os/
If you use Ubuntu: Ruby: https://github.com/rbenv/rbenv-installer#rbenv-installer PostgreSQL:https://www.postgresql.org/download/linux/ubuntu/ Redis: https://redis.io/docs/getting-started/installation/install-redis-on-linux/
Foreman: gem install foreman
Creating database user
$ sudo -u postgres psql
for Linux users$ psql postgres
for Brew Mac users$ create role gitwalk with createdb login password 'gitwalk123';
or you can use pg_hba.config with trust method Obs: trust IS ONLY for development local mode
Project Instalation
Cloning project
git clone [email protected]:juuh42dias/gitwalk.git
Setup project
bin/setup
Execute the bin/setup script. This script will:
- Verify if the necessary Ruby version is installed
- Install the gems using Bundler
- Create local copies of .env and database.yml
- Create, migrate and populate the database
Running tests
Run!
- Run the
bundle exec rspec
to guarantee that everything is working fine.
Running app
-
If everything is ok, run
foreman s -f Procfile.dev
you can check app running on http://localhost:3000 -
Procfile runs web and worker services
-
If you prefer use docker, run
docker-compose up
-
Obs: if you have Macbook M1, before run docker-compose maybe you should run
docker build . --platform linux/amd64
to build images using amd64 arch
Project Use
Creating user
Request:
curl --request POST \
--url 'http://localhost:3000/api/v1/github/users?=' \
--header 'Content-Type: application/json' \
--cookie BetterErrors-2.9.1-CSRF-Token=15c9505e-551f-480f-b527-72efd587d7c9 \
--data '{
"username": "juuh42dias"
}'
Response:
{
"user": {
"id": 2,
"username": "juuh42dias",
"created_at": "2023-02-06T03:49:47.809Z",
"updated_at": "2023-02-06T03:49:47.809Z"
},
"message": "We are processing your repo projects"
}
Retrieving user (with your projects)
Request:
curl --request GET \
--url 'http://localhost:3000/api/v1/github/users/juuh42dias?username=' \
--cookie BetterErrors-2.9.1-CSRF-Token=15c9505e-551f-480f-b527-72efd587d7c9
Response:
{
"id": 2,
"username": "juuh42dias",
"created_at": "2023-02-06T03:49:47.809Z",
"updated_at": "2023-02-06T03:49:47.809Z",
"projects": [
{
"id": 31,
"name": "100-days-of-code",
"star_count": 0,
"user_id": 2,
"created_at": "2023-02-06T03:49:50.976Z",
"updated_at": "2023-02-06T03:49:50.976Z"
},
{
"id": 32,
"name": "agendamento-vacina",
"star_count": 1,
"user_id": 2,
"created_at": "2023-02-06T03:49:50.976Z",
"updated_at": "2023-02-06T03:49:50.976Z"
},
{
"id": 33,
"name": "aprenda-rubyonrails",
"star_count": 7,
"user_id": 2,
"created_at": "2023-02-06T03:49:50.976Z",
"updated_at": "2023-02-06T03:49:50.976Z"
}
]
}
Enjoy the app!
Contact
Juliana Dias β [email protected]
https://gitlab.com/juuh42dias/ https://github.com/juuh42dias/
Contributing
- Fork it (https://github.com/juuh42dias/bank_account/fork)
- Create your feature branch (
git checkout -b feature/fooBar
) - Commit your changes (
git commit -am 'Add some fooBar'
) - Push to the branch (
git push origin feature/fooBar
) - Create a new Pull Request