Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
simplify project initialisation by utilising the git_deps_py tool
  • Loading branch information
EsGeh authored and EsGeh committed Nov 27, 2019
1 parent 8400697 commit e5dfecf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 53 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -20,9 +20,11 @@ Installing and running the project without Docker or the scripts is possible, bu

- Python 3
- Docker, Docker Compose
- [git_deps_py](https://github.molgen.mpg.de/EditionOpenAccess/git_deps_py)

## Initialise the Repository

$ git_deps_py
$ ./scripts/init.py [--build]

This will pull remote repositories and resources, initialize the database, etc.
Expand Down
17 changes: 17 additions & 0 deletions dependencies.conf
@@ -0,0 +1,17 @@
# Dependencies

[TEI]

uri = https://github.com/TEIC/TEI.git
hash = 7fbbc7c5c2ba533dc70f561b27101dbfa7f519a0

[Stylesheets]

uri = https://github.com/TEIC/stylesheets.git
hash = 2a01be46ee82fce5eba6074359b3d18db2222e0c

[eoa-publication-model]

uri = https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git
hash = ea8a2eb99b22703f1ef92544352701f07c08d17e
# init not needed, since only example publication is needed
54 changes: 1 addition & 53 deletions scripts/init.py
Expand Up @@ -59,44 +59,12 @@ def create_dirs( config ):
target_is_directory = True,
)

def install_git_dep(
repo_name,
repo_uri,
repo_hash,
force = False,
init_script = None,
):
DEP_DIR = BASE_DIR / config['DEPENDENCIES_DIR']
# remove repo, if necessary:
if force:
if (DEP_DIR / repo_name).exists():
shutil.rmtree( DEP_DIR / repo_name )

if not((DEP_DIR / repo_name).exists()):
subprocess.check_call(
["git", "clone", repo_uri, DEP_DIR / repo_name]
)
subprocess.check_call(
["git", "checkout", repo_hash],
cwd = DEP_DIR / repo_name
)
if init_script is not None:
subprocess.check_call(
shlex.split( init_script ),
cwd = DEP_DIR / repo_name
)

if __name__ == '__main__':

from argparse import ArgumentParser

parser = ArgumentParser(
description="initialize the repository: download git deps, create directories, etc"
)
parser.add_argument(
"-d", "--force-deps",
action = "store_true",
help = "download dependencies, even if yet existing",
description="initialize the repository: create directories, etc"
)
parser.add_argument(
"--build",
Expand All @@ -118,26 +86,6 @@ def install_git_dep(

create_dirs( config )

## install git dependencies:
install_git_dep(
repo_name = "TEI",
repo_uri = "https://github.com/TEIC/TEI.git",
repo_hash = "7fbbc7c5c2ba533dc70f561b27101dbfa7f519a0",
force = args.force_deps,
)
install_git_dep(
repo_name = "Stylesheets",
repo_uri = "https://github.com/TEIC/stylesheets.git",
repo_hash = "2a01be46ee82fce5eba6074359b3d18db2222e0c",
force = args.force_deps,
)
install_git_dep(
repo_name = "eoa-publication-model",
repo_uri = "https://github.molgen.mpg.de/EditionOpenAccess/eoa-publication-model.git",
repo_hash = "ea8a2eb99b22703f1ef92544352701f07c08d17e",
force = args.force_deps,
)

# rebuild docker image:
if args.build:
run(
Expand Down

0 comments on commit e5dfecf

Please sign in to comment.