Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Recommend.Games
Board Game Scraper
Commits
21181cdd
Commit
21181cdd
authored
Oct 22, 2020
by
Markus Shepherd
🙈
Browse files
Merge branch 'pre-commit' into 'master'
Add pre-commit hooks Closes
#76
See merge request
!52
parents
389b26a4
c3deea5d
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
341 additions
and
157 deletions
+341
-157
.env.example
.env.example
+2
-0
.pre-commit-config.yaml
.pre-commit-config.yaml
+20
-0
Pipfile
Pipfile
+1
-0
Pipfile.lock
Pipfile.lock
+222
-146
_config.yml
_config.yml
+1
-1
board_game_scraper/version_env.py
board_game_scraper/version_env.py
+85
-0
docker-compose.yaml
docker-compose.yaml
+10
-10
No files found.
.env.example
View file @
21181cdd
# the following line will be updated automatically from board_game_scraper.__version__
LIBRARY_VERSION=
# environment variables
LOG_LEVEL=DEBUG
LOG_SCRAPED_ITEMS=0
...
...
.pre-commit-config.yaml
0 → 100644
View file @
21181cdd
repos
:
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v3.3.0
hooks
:
-
id
:
check-yaml
-
id
:
end-of-file-fixer
-
id
:
trailing-whitespace
-
repo
:
https://github.com/psf/black
rev
:
20.8b1
hooks
:
-
id
:
black
-
repo
:
local
hooks
:
-
id
:
version-env
name
:
Writing version to .env
description
:
Reading library __version__ and saving it to .env
entry
:
pipenv run python -m board_game_scraper.version_env
language
:
system
always_run
:
true
pass_filenames
:
false
Pipfile
View file @
21181cdd
...
...
@@ -30,6 +30,7 @@ twisted = "*"
black
=
"==20.8b1"
docker
=
"*"
mypy
=
"*"
pre-commit
=
"*"
psutil
=
"*"
pylint
=
"*"
pytimeparse
=
"*"
...
...
Pipfile.lock
View file @
21181cdd
This diff is collapsed.
Click to expand it.
_config.yml
View file @
21181cdd
theme
:
jekyll-theme-merlot
\ No newline at end of file
theme
:
jekyll-theme-merlot
board_game_scraper/version_env.py
0 → 100644
View file @
21181cdd
# -*- coding: utf-8 -*-
"""Read library __version__ and write to .env."""
import
argparse
import
logging
import
sys
from
pathlib
import
Path
from
shutil
import
copyfileobj
from
tempfile
import
TemporaryFile
from
.__version__
import
__version__
LOGGER
=
logging
.
getLogger
(
__name__
)
def
_parse_args
():
parser
=
argparse
.
ArgumentParser
(
description
=
"Read library __version__ and write to .env."
)
parser
.
add_argument
(
"--target"
,
"-t"
,
default
=
".env"
,
help
=
"target file"
,
)
parser
.
add_argument
(
"--variable"
,
"-V"
,
default
=
"LIBRARY_VERSION"
,
help
=
"variable name"
,
)
parser
.
add_argument
(
"--verbose"
,
"-v"
,
action
=
"count"
,
default
=
0
,
help
=
"log level (repeat for more verbosity)"
,
)
return
parser
.
parse_args
()
def
main
():
"""Read library __version__ and write to .env."""
args
=
_parse_args
()
logging
.
basicConfig
(
stream
=
sys
.
stderr
,
level
=
logging
.
DEBUG
if
args
.
verbose
>
0
else
logging
.
INFO
,
format
=
"%(asctime)s %(levelname)-8.8s [%(name)s:%(lineno)s] %(message)s"
,
)
LOGGER
.
info
(
args
)
target
=
Path
(
args
.
target
).
resolve
()
LOGGER
.
info
(
"Trying to write version %s to file <%s>..."
,
__version__
,
target
)
if
not
target
.
exists
():
LOGGER
.
error
(
"Target file <%s> does not exist, aborting"
,
target
)
sys
.
exit
(
1
)
LOGGER
.
info
(
"Looking for environment variable <%s>"
,
args
.
variable
)
with
TemporaryFile
(
"w+"
)
as
temp
:
with
target
.
open
()
as
in_file
:
for
line
in
in_file
:
if
line
.
startswith
(
f
"
{
args
.
variable
}
="
):
temp
.
write
(
f
"
{
args
.
variable
}
=
{
__version__
}
\n
"
)
else
:
temp
.
write
(
line
)
temp
.
seek
(
0
)
with
target
.
open
(
"w"
)
as
out_file
:
copyfileobj
(
temp
,
out_file
)
LOGGER
.
info
(
"Done."
)
if
__name__
==
"__main__"
:
main
()
docker-compose.yaml
View file @
21181cdd
version
:
'
3.
7
'
version
:
'
3.
8
'
services
:
bga
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-bga
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
bga'
]
...
...
@@ -17,7 +17,7 @@ services:
stop_signal
:
SIGINT
bgg
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-bgg
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
bgg'
]
...
...
@@ -34,7 +34,7 @@ services:
stop_signal
:
SIGINT
bgg-hotness
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-bgg-hotness
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
bgg_hotness'
]
...
...
@@ -49,7 +49,7 @@ services:
stop_signal
:
SIGINT
bgg-rankings
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-bgg-rankings
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
bgg_rankings'
]
...
...
@@ -64,7 +64,7 @@ services:
stop_signal
:
SIGINT
bgg-geeklist
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-bgg-geeklist
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
bgg_geeklist'
,
'
--feeds-subdir'
,
'
bgg_rankings'
]
...
...
@@ -80,7 +80,7 @@ services:
stop_signal
:
SIGINT
dbpedia
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-dbpedia
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
dbpedia'
]
...
...
@@ -95,7 +95,7 @@ services:
stop_signal
:
SIGINT
luding
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-luding
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
luding'
]
...
...
@@ -110,7 +110,7 @@ services:
stop_signal
:
SIGINT
spielen
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-spielen
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
spielen'
]
...
...
@@ -125,7 +125,7 @@ services:
stop_signal
:
SIGINT
wikidata
:
image
:
bg-scraper:latest
image
:
registry.gitlab.com/recommend.games/board-game-scraper:${LIBRARY_VERSION}
container_name
:
bg-scraper-wikidata
build
:
'
.'
command
:
[
'
python'
,
'
-m'
,
'
board_game_scraper'
,
'
wikidata'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment