]> source.dussan.org Git - gitea.git/commitdiff
Replace GOGS with GITEA in variable names
authorSandro Santilli <strk@kbt.io>
Mon, 7 Nov 2016 10:41:50 +0000 (11:41 +0100)
committerSandro Santilli <strk@kbt.io>
Mon, 7 Nov 2016 15:05:18 +0000 (16:05 +0100)
Still use GOGS_WORK_DIR and GOGS_CUSTOM env variables
as a fallback if the equivalent GITEA_* are not set,
warning user about the need for change.

Does not change "gogs" to "gitea" in webhook type name
Because "gogs" hook type is part of the API (routes) and used
in templates...

Closes #87

Dockerfile
Dockerfile.rpi
docker/build.sh
docker/s6/gogs/setup
models/pull.go
modules/setting/setting.go
routers/repo/pull.go
scripts/init/centos/gogs
scripts/init/freebsd/gogs
scripts/init/suse/gogs

index 3a3c4051183ff6f1d2b138fc9c9ef4d0b425cc0a..aa6c834e200f0a78781728b87f568e6d9ed0495e 100644 (file)
@@ -6,7 +6,7 @@ ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/go
 RUN chmod +x /usr/sbin/gosu \
  && apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
 
-ENV GOGS_CUSTOM /data/gogs
+ENV GITEA_CUSTOM /data/gogs
 
 COPY . /app/gogs/
 WORKDIR /app/gogs/
index 8fbe8252b69425493704abdb519ec0f45bf09717..8e034fe2040ad4e91fbac4e645a0f90884250e05 100644 (file)
@@ -9,7 +9,7 @@ RUN chmod +x /usr/sbin/gosu \
  && apk -U --no-progress upgrade && rm -f /var/cache/apk/APKINDEX.* \
  && apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
 
-ENV GOGS_CUSTOM /data/gogs
+ENV GITEA_CUSTOM /data/gogs
 
 COPY . /app/gogs/
 WORKDIR /app/gogs/
index fb98b12b878e3ce8175ca41beba65d3558f92438..9965cef376a61084619f548fdca160466be89a81 100755 (executable)
@@ -33,4 +33,4 @@ apk --no-progress del build-deps
 
 # Create git user for Gogs
 adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
-echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile
+echo "export GITEA_CUSTOM=${GITEA_CUSTOM}" >> /etc/profile
index 40bd82b28a77335dd156cbd750c0ff493e9755c9..8435e25b6b8b735d749dd921e8908d0bb332875a 100755 (executable)
@@ -6,7 +6,7 @@ if ! test -d ~git/.ssh; then
 fi
 
 if ! test -f ~git/.ssh/environment; then
-    echo "GOGS_CUSTOM=${GOGS_CUSTOM}" > ~git/.ssh/environment
+    echo "GITEA_CUSTOM=${GITEA_CUSTOM}" > ~git/.ssh/environment
     chmod 600 ~git/.ssh/environment
 fi
 
index ae508103d033821e7ab4320bb418b80941e34ac9..20ea1b87c556713ea7f12c23454c00b0ce0b1205 100644 (file)
@@ -26,7 +26,7 @@ var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLe
 type PullRequestType int
 
 const (
-       PULL_REQUEST_GOGS PullRequestType = iota
+       PULL_REQUEST_GITEA PullRequestType = iota
        PLLL_ERQUEST_GIT
 )
 
index 923c45674ce7a4fe6c61e301ab2eed0d9820c85e..1ddbf6d2bc037eda67c8838c1d4e203e5c7d2183 100644 (file)
@@ -297,10 +297,18 @@ func init() {
 
 // WorkDir returns absolute path of work directory.
 func WorkDir() (string, error) {
-       wd := os.Getenv("GOGS_WORK_DIR")
+       wd := os.Getenv("GITEA_WORK_DIR")
        if len(wd) > 0 {
                return wd, nil
        }
+       // Use GOGS_WORK_DIR if available, for backward compatibility
+       // TODO: drop in 1.1.0 ?
+       wd = os.Getenv("GOGS_WORK_DIR")
+       if len(wd) > 0 {
+               log.Warn(`Usage of GOGS_WORK_DIR is deprecated and will be *removed* in a future release,
+please consider changing to GITEA_WORK_DIR`)
+               return wd, nil
+       }
 
        i := strings.LastIndex(AppPath, "/")
        if i == -1 {
@@ -341,9 +349,17 @@ func NewContext() {
                log.Fatal(4, "Fail to parse 'conf/app.ini': %v", err)
        }
 
-       CustomPath = os.Getenv("GOGS_CUSTOM")
+       CustomPath = os.Getenv("GITEA_CUSTOM")
        if len(CustomPath) == 0 {
-               CustomPath = workDir + "/custom"
+               // For backward compatibility
+               // TODO: drop in 1.1.0 ?
+               CustomPath = os.Getenv("GOGS_CUSTOM")
+               if len(CustomPath) == 0 {
+                       CustomPath = workDir + "/custom"
+               } else {
+                       log.Warn(`Usage of GOGS_CUSTOM is deprecated and will be *removed* in a future release,
+please consider changing to GITEA_CUSTOM`)
+               }
        }
 
        if len(CustomConf) == 0 {
index 50cd77f3fbceb6ceabf7f9ff5252edc15c657a02..0fdffad2dbdf9dde78ae58324a2b8b029b681430 100644 (file)
@@ -687,7 +687,7 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
                HeadRepo:     headRepo,
                BaseRepo:     repo,
                MergeBase:    prInfo.MergeBase,
-               Type:         models.PULL_REQUEST_GOGS,
+               Type:         models.PULL_REQUEST_GITEA,
        }
        // FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
        // instead of 500.
index cacf57423ab73d4b72d86ee934b1377048abe0d0..1a9fc2772828957b788239526523c69f5dd03a79 100644 (file)
 # Default values
 
 NAME=gogs
-GOGS_HOME=/home/git/gogs
-GOGS_PATH=${GOGS_HOME}/$NAME
-GOGS_USER=git
+GITEA_HOME=/home/git/gogs
+GITEA_PATH=${GITEA_HOME}/$NAME
+GITEA_USER=git
 SERVICENAME="Gogs Go Git Service"
 LOCKFILE=/var/lock/subsys/gogs
-LOGPATH=${GOGS_HOME}/log
+LOGPATH=${GITEA_HOME}/log
 LOGFILE=${LOGPATH}/gogs.log
 RETVAL=0
 
@@ -37,19 +37,19 @@ RETVAL=0
 [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
 
 # Don't do anything if nothing is installed
-[ -x ${GOGS_PATH} ] || exit 0
+[ -x ${GITEA_PATH} ] || exit 0
 # exit if logpath dir is not created.
 [ -x ${LOGPATH} ] || exit 0
 
 DAEMON_OPTS="--check $NAME"
 
 # Set additional options, if any
-[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"
+[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}"
 
 start() {
-  cd ${GOGS_HOME}
+  cd ${GITEA_HOME}
   echo -n "Starting ${SERVICENAME}: "
-  daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
+  daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &"
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch ${LOCKFILE}
@@ -58,7 +58,7 @@ start() {
 }
 
 stop() {
-  cd ${GOGS_HOME}
+  cd ${GITEA_HOME}
         echo -n "Shutting down ${SERVICENAME}: "
         killproc ${NAME}
         RETVAL=$?
index eb571574764842c9241150d3985320dc46c90532..8fc0359eff19f998f62d6690a07ca1e7aeeff95b 100644 (file)
@@ -38,7 +38,7 @@ gogs_start() {
 
 gogs_stop() {
        if [ ! -f $pidfile ]; then
-               echo "GOGS PID File not found. Maybe GOGS is not running?"
+               echo "GITEA PID File not found. Maybe GITEA is not running?"
        else
                kill $(cat $pidfile)
        fi
index ea7dfa0a6ec0401685ebe8b4d7975341ad5be376..da5f795807298f5e3a64adebda2663d9af6a8db8 100644 (file)
 # Default values
 
 NAME=gogs
-GOGS_HOME=/home/git/gogs
-GOGS_PATH=${GOGS_HOME}/$NAME
-GOGS_USER=git
+GITEA_HOME=/home/git/gogs
+GITEA_PATH=${GITEA_HOME}/$NAME
+GITEA_USER=git
 SERVICENAME="Go Git Service"
 LOCKFILE=/var/lock/subsys/gogs
-LOGPATH=${GOGS_HOME}/log
+LOGPATH=${GITEA_HOME}/log
 LOGFILE=${LOGPATH}/error.log
 # gogs creates its own gogs.log from stdout
 RETVAL=0
@@ -32,7 +32,7 @@ RETVAL=0
 [ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
 
 # Don't do anything if nothing is installed
-test -x ${GOGS_PATH} || { echo "$NAME not installed";
+test -x ${GITEA_PATH} || { echo "$NAME not installed";
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }
 
@@ -53,12 +53,12 @@ case "$1" in
                echo -n "Starting ${SERVICENAME} "
 
                # As we can't use startproc, we have to check ourselves if the service is already running
-               /sbin/checkproc ${GOGS_PATH}
+               /sbin/checkproc ${GITEA_PATH}
                if [ $? -eq 0 ]; then
                        # return skipped as service is already running
                        (exit 5)
                else
-                       su - ${GOGS_USER} -c "USER=${GOGS_USER} ${GOGS_PATH} web 2>&1 >>${LOGFILE} &"
+                       su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &"
                fi
 
                # Remember status and be verbose
@@ -70,7 +70,7 @@ case "$1" in
 
                ## Stop daemon with killproc(8) and if this fails
                ## killproc sets the return value according to LSB.
-               /sbin/killproc ${GOGS_PATH}
+               /sbin/killproc ${GITEA_PATH}
 
                # Remember status and be verbose
                rc_status -v
@@ -100,7 +100,7 @@ case "$1" in
                # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
 
                # NOTE: checkproc returns LSB compliant status values.
-               /sbin/checkproc ${GOGS_PATH}
+               /sbin/checkproc ${GITEA_PATH}
                # NOTE: rc_status knows that we called this init script with
                # "status" option and adapts its messages accordingly.
                rc_status -v