setup appdata directory

fixes #3 and #4
This commit is contained in:
Girish Ramakrishnan 2017-04-04 21:42:26 -07:00
parent 072a8ea354
commit 35738a5579
4 changed files with 74 additions and 7 deletions

View file

@ -19,7 +19,6 @@ RUN cd /home/git/gogs && \
# setup config paths
ADD app.ini.template /home/git/app.ini.template
RUN mkdir -p /run/gogs && chown -R git:git /run/gogs
# setup log paths
RUN mkdir -p /run/gogs && chown -R git:git /run/gogs

View file

@ -11,10 +11,6 @@ PASSWD = ##MYSQL_PASSWORD
SSL_MODE = disable
PATH =
[repository]
ROOT = /app/data/repository
SCRIPT_TYPE = bash
[server]
PROTOCOL = http
DOMAIN = ##DOMAIN
@ -23,9 +19,23 @@ HTTP_ADDR =
HTTP_PORT = 3000
DISABLE_SSH = ##DISABLE_SSH
SSH_PORT = ##SSH_PORT
APP_DATA_PATH = /app/data/appdata
; Landing page for non-logged users, can be "home" or "explore"
LANDING_PAGE = explore
[repository]
ROOT = /app/data/repository
SCRIPT_TYPE = bash
[repository.upload]
ENABLED = true
TEMP_PATH = /run/gogs/tmp/uploads
[release.attachment]
ENABLED = true
; APP_DATA_PATH/attachments
PATH =
[mailer]
ENABLED = true
HOST = ##MAIL_SERVER:##MAIL_PORT
@ -34,8 +44,6 @@ PASSWD = ##MAIL_SMTP_PASSWORD
FROM = ##MAIL_FROM
SKIP_VERIFY = true
[admin]
[security]
INSTALL_LOCK = true
SECRET_KEY = ##SECRET_KEY
@ -51,4 +59,14 @@ MODE = console
; used for xorm.log
ROOT_PATH = /run/gogs
[picture]
; APP_DATA_PATH/avatars
AVATAR_UPLOAD_PATH =
GRAVATAR_SOURCE = gravatar
DISABLE_GRAVATAR = false
[attachment]
ENABLE = true
; APP_DATA_PATH/attachments
PATH =

View file

@ -2,6 +2,8 @@
set -eu -o pipefail
mkdir -p /run/gogs/tmp/uploads
setup_ldap_source() {
set -eu

View file

@ -55,6 +55,45 @@ describe('Application life cycle test', function () {
done();
});
function waitForUrl(url, done) {
browser.wait(function () {
return browser.getCurrentUrl().then(function (currentUrl) {
return currentUrl === url;
});
}, TIMEOUT).then(function () { done(); });
}
function setAvatar(done) {
browser.get('https://' + app.fqdn + '/user/settings/avatar');
browser.findElement(by.xpath('//input[@type="file" and @name="avatar"]')).sendKeys(path.resolve(__dirname, '../logo.png')).then(function () {
browser.findElement(by.xpath('//button[contains(text(), "Update Avatar Setting")]')).click();
browser.wait(until.elementLocated(by.xpath('//p[contains(text(),"updated successfully")]')), TIMEOUT).then(function () { done(); });
});
}
function checkAvatar(done) {
superagent.get('https://' + app.fqdn + '/avatars/1').end(function (error, result) {
expect(error).to.be(null);
expect(result.statusCode).to.be(200);
done();
});
}
function editFile(done) {
browser.get('https://' + app.fqdn + '/' + username + '/' + reponame + '/_edit/master/newfile');
var cm = browser.findElement(by.xpath('//div[contains(@class,"CodeMirror")]'));
var text = 'yo';
browser.executeScript('arguments[0].CodeMirror.setValue("' + text + '");', cm).then(function () {
browser.findElement(by.xpath('//input[@name="commit_summary"]')).sendKeys('Dummy edit');
browser.findElement(by.xpath('//button[contains(text(), "Commit Changes")]')).click();
waitForUrl('https://' + app.fqdn + '/' + username + '/' + reponame + '/src/master/newfile', done);
});
}
xit('build app', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
@ -112,6 +151,9 @@ describe('Application life cycle test', function () {
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
});
it('can set avatar', setAvatar);
it('can get avatar', checkAvatar);
it('can add public key', function (done) {
browser.get('https://' + app.fqdn + '/user/settings/ssh');
var publicKey = fs.readFileSync(__dirname + '/id_rsa.pub', 'utf8');
@ -162,6 +204,8 @@ describe('Application life cycle test', function () {
done();
});
it('can edit file', editFile);
it('can restart app', function (done) {
execSync('cloudron restart');
done();
@ -184,6 +228,8 @@ describe('Application life cycle test', function () {
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get avatar', checkAvatar);
it('can clone the url', function (done) {
var env = Object.create(process.env);
env.GIT_SSH = __dirname + '/git_ssh_wrapper.sh';
@ -209,6 +255,8 @@ describe('Application life cycle test', function () {
browser.wait(until.elementLocated(by.linkText('Dashboard')), TIMEOUT).then(function () { done(); });
});
it('can get avatar', checkAvatar);
it('displays correct clone url', function (done) {
browser.get('https://' + app.fqdn + '/' + username + '/' + reponame);
browser.findElement(by.id('repo-clone-ssh')).click();