|
@ -6,6 +6,11 @@ jobs:
|
|||
- image: circleci/python:3.7
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Pull Submodules
|
||||
command: |
|
||||
git submodule init
|
||||
git submodule update --remote
|
||||
- run:
|
||||
name: Install deps
|
||||
command: sudo make dev-install
|
||||
|
@ -21,6 +26,11 @@ jobs:
|
|||
image: ubuntu-1604:201903-01 # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images with Docker 18.09.3
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Pull Submodules
|
||||
command: |
|
||||
git submodule init
|
||||
git submodule update --remote
|
||||
- add_ssh_keys:
|
||||
fingerprints:
|
||||
- "d3:5f:9d:68:ea:12:9a:42:d3:d3:e1:db:b0:6a:fc:d2"
|
||||
|
|
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "data/v2/sprites"]
|
||||
path = data/v2/sprites
|
||||
url = https://github.com/PokeAPI/sprites.git
|
|
@ -40,7 +40,7 @@ Once you've signed up visit [PokéAPI on Slack](https://pokeapi.slack.com)
|
|||
|
||||
## Setup [![pyVersion37](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/download/releases/3.7/)
|
||||
|
||||
- Download this source code into a working directory.
|
||||
- Download this source code into a working directory, be sure to use the flag `--recurse-submodules` to clone also our submodules.
|
||||
|
||||
- Install the requirements using pip:
|
||||
|
||||
|
@ -151,7 +151,7 @@ To contribute to this repository:
|
|||
- Download the forked project using git clone:
|
||||
|
||||
```sh
|
||||
git clone git@github.com:<YOUR_USERNAME>/pokeapi.git
|
||||
git clone --recurse-submodules git@github.com:<YOUR_USERNAME>/pokeapi.git
|
||||
```
|
||||
|
||||
- Create a new branch with a descriptive name:
|
||||
|
|
|
@ -28,6 +28,9 @@ cleanexit() {
|
|||
elif [ "$1" = "no-deploy" ]; then
|
||||
notify_engine_pr "end_no_deploy"
|
||||
exit 0
|
||||
elif [ "$1" = "no-new-data" ]; then
|
||||
notify_engine_pr "end_no_new_data"
|
||||
exit 0
|
||||
else
|
||||
notify_engine_pr "end_failed"
|
||||
exit 1
|
||||
|
@ -141,9 +144,17 @@ pr_input_updater_end_failed() {
|
|||
EOF
|
||||
}
|
||||
|
||||
pr_input_updater_end_no_new_data() {
|
||||
cat <<EOF
|
||||
{
|
||||
"body": "The updater script finished its job and the generated data didn't change. The deploy was thus skipped. For further information check [CircleCI's builds]($engine_circleci_status_url) and [logs](${CIRCLE_BUILD_URL})."
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
# If the job was started by a Pull Request, add a comment to notify the users
|
||||
notify_engine_pr() {
|
||||
if [[ $1 == "start" || $1 == "end_failed" || $1 == "end_success" || $1 == "end_no_deploy" ]]; then
|
||||
if [[ $1 == "start" || $1 == "end_failed" || $1 == "end_success" || $1 == "end_no_deploy" || $1 == "end_no_new_data" ]]; then
|
||||
engine_repo_pr_number=$(get_invokator_pr_number)
|
||||
if [ "$engine_repo_pr_number" != "null" ]; then
|
||||
curl -f "$auth_header" -X POST --data "$(pr_input_updater_$1)" "https://api.github.com/repos/$org/$engine_repo/issues/$engine_repo_pr_number/comments"
|
||||
|
@ -164,8 +175,11 @@ run_updater() {
|
|||
fi
|
||||
|
||||
# Run the updater
|
||||
docker run --privileged -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" pokeapi-updater
|
||||
if [ $? -ne 0 ]; then
|
||||
docker run --privileged -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" pokeapi-updater
|
||||
return_code=$?
|
||||
if [ "$return_code" -eq 2 ]; then
|
||||
cleanexit 'no-new-data' "Generated data is the same as old data, skipping deploy"
|
||||
elif [ "$return_code" -ne 0 ]; then
|
||||
cleanexit 'fail' "Failed to run the pokeapi-updater container"
|
||||
fi
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ DB_VENDOR = connection.vendor
|
|||
|
||||
|
||||
MEDIA_DIR = "/media/sprites/{0}"
|
||||
IMAGE_DIR = os.getcwd() + "/data/v2/sprites/"
|
||||
IMAGE_DIR = os.getcwd() + "/data/v2/sprites/sprites/"
|
||||
RESOURCE_IMAGES = []
|
||||
|
||||
for root, dirs, files in os.walk(IMAGE_DIR):
|
||||
|
@ -1347,27 +1347,45 @@ def _build_pokemons():
|
|||
build_generic((Pokemon,), "pokemon.csv", csv_record_to_objects)
|
||||
|
||||
def csv_record_to_objects(info):
|
||||
file_name = "%s.png" % info[0]
|
||||
file_name_png = "%s.png" % info[0]
|
||||
file_name_svg = "%s.svg" % info[0]
|
||||
poke_sprites = "pokemon/{0}"
|
||||
dream_world = "other/dream-world/{0}"
|
||||
sprites = {
|
||||
"front_default": file_path_or_none(poke_sprites.format(file_name)),
|
||||
"front_default": file_path_or_none(poke_sprites.format(file_name_png)),
|
||||
"front_female": file_path_or_none(
|
||||
poke_sprites.format("female/" + file_name)
|
||||
poke_sprites.format("female/" + file_name_png)
|
||||
),
|
||||
"front_shiny": file_path_or_none(
|
||||
poke_sprites.format("shiny/" + file_name_png)
|
||||
),
|
||||
"front_shiny": file_path_or_none(poke_sprites.format("shiny/" + file_name)),
|
||||
"front_shiny_female": file_path_or_none(
|
||||
poke_sprites.format("shiny/female/" + file_name)
|
||||
poke_sprites.format("shiny/female/" + file_name_png)
|
||||
),
|
||||
"back_default": file_path_or_none(
|
||||
poke_sprites.format("back/" + file_name_png)
|
||||
),
|
||||
"back_default": file_path_or_none(poke_sprites.format("back/" + file_name)),
|
||||
"back_female": file_path_or_none(
|
||||
poke_sprites.format("back/female/" + file_name)
|
||||
poke_sprites.format("back/female/" + file_name_png)
|
||||
),
|
||||
"back_shiny": file_path_or_none(
|
||||
poke_sprites.format("back/shiny/" + file_name)
|
||||
poke_sprites.format("back/shiny/" + file_name_png)
|
||||
),
|
||||
"back_shiny_female": file_path_or_none(
|
||||
poke_sprites.format("back/shiny/female/" + file_name)
|
||||
poke_sprites.format("back/shiny/female/" + file_name_png)
|
||||
),
|
||||
"other": {
|
||||
"dream_world": {
|
||||
"front_default": file_path_or_none(
|
||||
poke_sprites.format(dream_world.format(file_name_svg))
|
||||
),
|
||||
"front_female": file_path_or_none(
|
||||
poke_sprites.format(
|
||||
dream_world.format("female/" + file_name_svg)
|
||||
)
|
||||
),
|
||||
}
|
||||
},
|
||||
}
|
||||
yield PokemonSprites(
|
||||
id=int(info[0]),
|
||||
|
|
1
data/v2/sprites
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 10a4d1cbb0e4d675d314eaa7afaff1d338c66e2e
|
Before Width: | Height: | Size: 254 B |
Before Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 228 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 245 B |
Before Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 275 B |
Before Width: | Height: | Size: 239 B |
Before Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 280 B |
Before Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 363 B |
Before Width: | Height: | Size: 294 B |
Before Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 248 B |
Before Width: | Height: | Size: 235 B |
Before Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 236 B |
Before Width: | Height: | Size: 237 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 318 B |
Before Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 599 B |
Before Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 524 B |
Before Width: | Height: | Size: 574 B |
Before Width: | Height: | Size: 577 B |
Before Width: | Height: | Size: 555 B |
Before Width: | Height: | Size: 595 B |
Before Width: | Height: | Size: 454 B |
Before Width: | Height: | Size: 569 B |
Before Width: | Height: | Size: 629 B |
Before Width: | Height: | Size: 576 B |
Before Width: | Height: | Size: 836 B |
Before Width: | Height: | Size: 505 B |
Before Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 535 B |
Before Width: | Height: | Size: 548 B |
Before Width: | Height: | Size: 716 B |
Before Width: | Height: | Size: 768 B |
Before Width: | Height: | Size: 605 B |
Before Width: | Height: | Size: 565 B |
Before Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 615 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 491 B |
Before Width: | Height: | Size: 395 B |
Before Width: | Height: | Size: 603 B |
Before Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 520 B |
Before Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 658 B |
Before Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 561 B |
Before Width: | Height: | Size: 549 B |
Before Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 614 B |
Before Width: | Height: | Size: 640 B |
Before Width: | Height: | Size: 523 B |
Before Width: | Height: | Size: 673 B |