This repo contains command line scripts that report on as well as modify the content of a DSpace instance. Please be aware that this Gem is no longer actively maintained.
Scripts are implemented with the help of the dspace-jruby repository.
Most of scripts here are actively used at the Princeton University Library; some are tailored to the specific Princeton needs.
$ asdf install java adoptopenjdk-8.0.282+8
# For the BASH:
$ . ~/.asdf/plugins/java/set-java-home.bash
# For zsh:
$ . ~/.asdf/plugins/java/set-java-home.zsh
$ asdf install ruby jruby-9.2.13.0
$ jgem install bundler
Clone this repository:
Install the gems used by the scripts:
bundle install
set the DSPACE_HOME environment variable to point to the installation directory of your DSpace repository
run a scripts
bundle exec script_file
Scripts either prompt for input or have a --help option
There is a Docker image on docker hub, but I do not promise to keep it up with this repo;
If you want to add your own scripts or do changes to the scripts here, you need to build your own image.
# cd into the cloned code directory for thsi repo
# clone dspace-jruby
git clone https://github.com/pulibrary/dspace-jruby
# build an image and name it dspace-cli
docker build -t dspace-cli .
# run a container based on the image
# this maps the local /dspace diretory onto /dspace in the container
# it also maps the current directory on the host to /dspace/cli in the container
# it then starts the given jruby script, eg netid/create.rb
docker run -v '/dspace:/dspace' -v `pwd`:/dspace-cli dspace-cli netid/create.rb
# to run the inertace dspace console
docker run -it -v '/dspace:/dspace' -v $PWD:/dspace-cli dspace-cli dspace-jruby/bin/idspace
# to connect with a interactive bash shell
docker run -it -v '/dspace:/dspace' -v `pwd`:/dspace-cli dspace-cli
# once the shell starts you can run any of the scripts interactively, for example
> ./print.rb handel1 handle2 handle3
docker save -o dspace-cli.docker dspace-cli
docker load -i dspace-cli.docker
@ with given user id
docker run -it -v '/dspace:/dspace' -v `pwd`:/dspace-cli -u 67381 dspace-cli bash
# leave containers running by Ctrl-C Ctrl-D out of bash then restart
docker exec -it dspace-cli bash
Have a look at the DSpace JRuby repository.