Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
POC Mirador
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IIIF
POC Mirador
Commits
3c8f9ad5
Commit
3c8f9ad5
authored
2 years ago
by
Anthony
Browse files
Options
Downloads
Patches
Plain Diff
WIP cli
parent
a6808e7b
No related branches found
No related tags found
1 merge request
!15
Draft : Resolve "Add a CLI tool"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cli
+25
-23
25 additions, 23 deletions
cli
with
25 additions
and
23 deletions
cli
+
25
−
23
View file @
3c8f9ad5
#!/bin/bash
#!/bin/bash
is_docker
()
{
if
[
!
-z
"
$(
which docker-compose 2>/dev/null
)
"
]
;
then
echo
"1"
else
echo
"0"
fi
}
usage
()
{
usage
()
{
echo
-e
"Usage
$0
<command> [args]
\n
"
echo
-e
"Usage
$0
<command> [args]
\n
"
echo
-e
"COMMANDS
\n
"
echo
-e
"COMMANDS
\n
"
...
@@ -22,30 +13,25 @@ usage() {
...
@@ -22,30 +13,25 @@ usage() {
echo
-e
"update-submodule : Need to be run after installation or when updating Mirador or the plugin"
echo
-e
"update-submodule : Need to be run after installation or when updating Mirador or the plugin"
}
}
cmdup
=
"docker-compose up"
cmdup
=
"docker-compose up"
cmddown
=
"docker-compose down"
cmddown
=
"docker-compose down"
cmdinitsubmodule
=
"git submodule init"
cmdupdatetsubmodule
=
"git submodule update"
cmdbuildmirador
=
"docker run --rm -v
$PWD
:/opt -it node:12 /bin/sh -c 'cd /opt && npm install && npm run build:es'"
cmdbuildmiradorplugin
=
"docker run --rm -v
$PWD
:/opt -it node:12 /bin/sh -c 'cd /opt && npm install && npm run build'"
MIRADOR_FOLDER
=
mirador-video-annotation
MIRADOR_FOLDER
=
mirador-video-annotation
MIRADOR_ANNOTATION_FOLDER
=
annotations-plugin
MIRADOR_ANNOTATION_FOLDER
=
annotations-plugin
user
=
$(
awk
-F
'='
'/DB_USERNAME/{print $2}'
.env
)
db
=
$(
awk
-F
'='
'/DB_DATABASE/{print $2}'
.env
)
pass
=
$(
awk
-F
'='
'/DB_PASSWORD/{print $2}'
.env
)
mysql
=
"mysql -u
$user
$db
-p
$pass
"
DIR
=
"
$(
dirname
$0
)
"
SCRIPTS_DIR
=
"
$DIR
/public/scripts"
action
=
$1
action
=
$1
shift
shift
# Keep actions sorted
# Keep actions sorted
case
$action
in
case
$action
in
"build-mirador"
)
"build-mirador"
)
cd
$MIRADOR_FOLDER
&&
docker run
--rm
-v
$PWD
:/opt
-it
node:12 /bin/sh
-c
"cd /opt && npm install && npm run build:es"
cd
$MIRADOR_FOLDER
&&
;;
;;
"build-mirador-plugin"
)
"build-mirador-plugin"
)
cd
$MIRADOR_ANNOTATION_FOLDER
&&
docker run
--rm
-v
$PWD
:/opt
-it
node:12 /bin/sh
-c
"cd /opt && npm install && npm run build"
cd
$MIRADOR_ANNOTATION_FOLDER
&&
$cmdbuildmiradorplugin
;;
;;
"clean-mirador"
)
"clean-mirador"
)
cd
$MIRADOR_FOLDER
&&
rm
-R
-f
node_modules package-lock.json
cd
$MIRADOR_FOLDER
&&
rm
-R
-f
node_modules package-lock.json
...
@@ -66,16 +52,32 @@ case $action in
...
@@ -66,16 +52,32 @@ case $action in
usage
usage
;;
;;
"install"
)
"install"
)
echo
"TODO"
echo
"** Start install ..."
FILE
=
.env
if
[
!
-f
"
$FILE
"
]
;
then
echo
"**
$FILE
does not exist. Please copy .env template cp .env.template .env and set COMPOSE_FILE to suit your needs"
exit
0
fi
echo
"** Submodule initialisation ..."
$cmdinitsubmodule
$cmdupdatesubmodule
echo
"** Submodule initialized"
echo
"** Building Mirador ..."
$cmdbuildmirador
echo
"** Mirador build."
echo
"** Building Mirador plugin ..."
$cmdbuildmiradorplugin
echo
"** Mirador plugin build."
;;
;;
"up"
)
"up"
)
$cmdup
$@
$cmdup
$@
;;
;;
"init-submodules"
)
"init-submodules"
)
g
it
submodule
init
$cmdin
itsubmodule
;;
;;
"update-submodules"
)
"update-submodules"
)
git
submodule
update
$cmdupdate
submodule
;;
;;
*
)
*
)
echo
"ERROR: No command given"
echo
"ERROR: No command given"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment