Skip to content
Snippets Groups Projects
Commit bc83b354 authored by Sam Gleske's avatar Sam Gleske
Browse files

Added environ variable checking

Updated README for Features
Added better description comment to config.sh.SAMPLE
parent 2f435c94
No related branches found
No related tags found
No related merge requests found
gitlab-mirrors v0.2.2
* Safer environment variable option checking for config.sh in add_mirror.sh command.
* Added Features do README
gitlab-mirrors v0.2.1
* CHANGELOG update
gitlab-mirrors v0.2
* Renamed project from git-mirrors to gitlab-mirrors.
* Colorized output enabled for all commands!
......
......@@ -3,6 +3,15 @@
The [gitlab-mirrors](https://github.com/sag47/gitlab-mirrors) project is designed to fill in a feature which is currently missing from GitLab: the ability to mirror remote repositories. gitlab-mirrors creates read only copies of remote repositories in gitlab. It provides a CLI management interface for managing the mirrored repositories (e.g. add, delete, update) so that an admin may regularly update all mirrors using `crontab`. It operates by interacting with the [GitLab API][1] using [python-gitlab][2].
## Features
* Mirror git and SVN repositories.
* When adding a mirror if the project doesn't exist in GitLab then `add_mirrror.sh` will automatically create it.
* Specify initial project defaults when a project is created (e.g. issues enabled, wiki enabled, etc.)
* Update a single mirror with the `update_mirror.sh` command.
* Update all known mirrors with the `git-mirrors.sh` command. Useful for adding to a `cron` job for updating all repositories on a regular schedule.
---
# Three easy steps
......
......@@ -122,6 +122,7 @@ done
function preflight() {
STATUS=0
#test required git or svn option
if ${git} && ${svn};then
red_echo -n "Must not set " 1>&2
yellow_echo -n "--svn" 1>&2
......@@ -138,24 +139,82 @@ function preflight() {
red_echo " options." 1>&2
STATUS=1
fi
#test required project_name option
if [ -z "${project_name}" ];then
red_echo -n "Missing " 1>&2
yellow_echo -n "--project-name" 1>&2
red_echo " option." 1>&2
STATUS=1
fi
#test required mirror option
if [ -z "${mirror}" ];then
red_echo -n "Missing " 1>&2
yellow_echo -n "--mirror" 1>&2
red_echo " option." 1>&2
STATUS=1
fi
#test authors_file path for existence
if [ ! -z "${authors_file}" -a ! -f "${authors_file}" ];then
red_echo -n "Specified "
yellow_echo -n "--authors-file"
red_echo " does not exist!"
STATUS=1
fi
#test issues_enabled environment variable (must be bool)
if [ ! "${issues_enabled}" = "true" ] && [ ! "${issues_enabled}" = "false" ];then
red_echo -n "issues_enabled="
yellow_echo -n "${issues_enabled}"
red_echo -n "is not a valid option for issues_enabled! Must be "
yellow_echo -n "true"
red_echo -n "or "
yellow_echo -n "false"
red_echo "." 1>&2
STATUS=1
fi
#test wall_enabled environment variable (must be bool)
if [ ! "${wall_enabled}" = "true" ] && [ ! "${wall_enabled}" = "false" ];then
red_echo -n "wall_enabled="
yellow_echo -n "${wall_enabled}"
red_echo -n "is not a valid option for wall_enabled! Must be "
yellow_echo -n "true"
red_echo -n "or "
yellow_echo -n "false"
red_echo "." 1>&2
STATUS=1
fi
#test wiki_enabled environment variable (must be bool)
if [ ! "${wiki_enabled}" = "true" ] && [ ! "${wiki_enabled}" = "false" ];then
red_echo -n "wiki_enabled="
yellow_echo -n "${wiki_enabled}"
red_echo -n "is not a valid option for wiki_enabled! Must be "
yellow_echo -n "true"
red_echo -n "or "
yellow_echo -n "false"
red_echo "." 1>&2
STATUS=1
fi
#test snippets_enabled environment variable (must be bool)
if [ ! "${snippets_enabled}" = "true" ] && [ ! "${snippets_enabled}" = "false" ];then
red_echo -n "snippets_enabled="
yellow_echo -n "${snippets_enabled}"
red_echo -n "is not a valid option for snippets_enabled! Must be "
yellow_echo -n "true"
red_echo -n "or "
yellow_echo -n "false"
red_echo "." 1>&2
STATUS=1
fi
#test public environment variable (must be bool)
if [ ! "${public}" = "true" ] && [ ! "${public}" = "false" ];then
red_echo -n "public="
yellow_echo -n "${public}"
red_echo -n "is not a valid option for public! Must be "
yellow_echo -n "true"
red_echo -n "or "
yellow_echo -n "false"
red_echo "." 1>&2
STATUS=1
fi
return ${STATUS}
}
......
......@@ -33,6 +33,7 @@ gitlab_user_token_secret="$(head -n1 "${user_home}/private_token")"
# then it will assign the following values as defaults.
#
#values must be true or false
issues_enabled=false
wall_enabled=false
wiki_enabled=false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment