Skip to content

Replace GOGS with GITEA in variable names #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.rpi
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docker/s6/gogs/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var PullRequestQueue = sync.NewUniqueQueue(setting.Repository.PullRequestQueueLe
type PullRequestType int

const (
PULL_REQUEST_GOGS PullRequestType = iota
PLLL_ERQUEST_GIT
PULL_REQUEST_GITEA PullRequestType = iota
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Constants should be named lowerCamelCase for unexported ones and UpperCamelCase for exported ones.
https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a separate PR for cleaning that up ? I'm just focusing on ^GOGS^GITEA here...

(and maybe we could use some automatici linting check to spot those)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #110

PULL_REQUEST_GIT
)

type PullRequestStatus int
Expand Down
22 changes: 19 additions & 3 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion routers/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 17 additions & 17 deletions scripts/init/centos/gogs → scripts/init/centos/gitea
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# /etc/rc.d/init.d/gogs
# /etc/rc.d/init.d/gitea
#
# Runs the Gogs Go Git Service.
#
Expand All @@ -9,47 +9,47 @@
#

### BEGIN INIT INFO
# Provides: gogs
# Provides: gitea
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start gogs at boot time.
# Description: Control gogs.
# Short-Description: Start gitea at boot time.
# Description: Control gitea.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Default values

NAME=gogs
GOGS_HOME=/home/git/gogs
GOGS_PATH=${GOGS_HOME}/$NAME
GOGS_USER=git
NAME=gitea
GITEA_HOME=/home/git/gitea
GITEA_PATH=${GITEA_HOME}/$NAME
GITEA_USER=git
SERVICENAME="Gogs Go Git Service"
LOCKFILE=/var/lock/subsys/gogs
LOGPATH=${GOGS_HOME}/log
LOGFILE=${LOGPATH}/gogs.log
LOCKFILE=/var/lock/subsys/gitea
LOGPATH=${GITEA_HOME}/log
LOGFILE=${LOGPATH}/gitea.log
RETVAL=0

# Read configuration from /etc/sysconfig/gogs to override defaults
# Read configuration from /etc/sysconfig/gitea to override defaults
[ -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}
Expand All @@ -58,7 +58,7 @@ start() {
}

stop() {
cd ${GOGS_HOME}
cd ${GITEA_HOME}
echo -n "Shutting down ${SERVICENAME}: "
killproc ${NAME}
RETVAL=$?
Expand Down
6 changes: 3 additions & 3 deletions scripts/init/debian/gogs → scripts/init/debian/gitea
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: gogs
# Provides: gitea
# Required-Start: $syslog $network
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
Expand All @@ -16,11 +16,11 @@
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Go Git Service"
NAME=gogs
NAME=gitea
SERVICEVERBOSE=yes
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
WORKINGDIR=/home/git/gogs
WORKINGDIR=/home/git/gitea
DAEMON=$WORKINGDIR/$NAME
DAEMON_ARGS="web"
USER=git
Expand Down
47 changes: 47 additions & 0 deletions scripts/init/freebsd/gitea
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: gitea
# REQUIRE: NETWORKING SYSLOG
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable gitea:
#
#gitea_enable="YES"

. /etc/rc.subr

name="gitea"
rcvar="gitea_enable"

load_rc_config $name

: ${gitea_user:="git"}
: ${gitea_enable:="NO"}
: ${gitea_directory:="/home/git"}

command="${gitea_directory}/gitea web"
procname="$(echo $command |cut -d' ' -f1)"

pidfile="${gitea_directory}/${name}.pid"

start_cmd="${name}_start"
stop_cmd="${name}_stop"

gitea_start() {
cd ${gitea_directory}
export USER=${gitea_user}
export HOME=/usr/home/${gitea_user}
/usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command
}

gitea_stop() {
if [ ! -f $pidfile ]; then
echo "GITEA PID File not found. Maybe GITEA is not running?"
else
kill $(cat $pidfile)
fi
}

run_rc_command "$1"
47 changes: 0 additions & 47 deletions scripts/init/freebsd/gogs

This file was deleted.

19 changes: 19 additions & 0 deletions scripts/init/openbsd/gitea
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
#
# $OpenBSD$

daemon="/home/git/gitea/gitea"
daemon_user="git"
daemon_flags="web"

gitea_directory="/home/git/gitea"

rc_bg=YES

. /etc/rc.d/rc.subr

rc_start() {
${rcexec} "cd ${gitea_directory}; ${daemon} ${daemon_flags} ${_bg}"
}

rc_cmd $1
19 changes: 0 additions & 19 deletions scripts/init/openbsd/gogs

This file was deleted.

Loading