Skip to content
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

Permissions #296

Merged
merged 4 commits into from
Jul 6, 2017
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
14 changes: 3 additions & 11 deletions extensions/linux/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const os = require('os');
const execa = require('execa');
const path = require('path');

const cli = require('../../lib');

Expand Down Expand Up @@ -36,17 +37,8 @@ class LinuxExtension extends cli.Extension {
skip: () => userExists,
task: () => this.ui.sudo('useradd --system --user-group ghost')
}, {
title: 'Changing directory permissions',
task: () => this.ui.sudo(`chown -R ghost:ghost ${ctx.instance.dir}`)
}, {
title: 'Adding current user to ghost group',
skip: () => userExists,
task: (ctx) => {
return execa.shell('id -un').then((result) => {
ctx.currentuser = result.stdout;
return this.ui.sudo(`gpasswd --add ${ctx.currentuser} ghost`);
});
}
title: 'Changing content directory permissions',
task: () => this.ui.sudo(`chown -R ghost:ghost ${path.join(ctx.instance.dir, 'content')}`)
}], false);
}
}
Expand Down
15 changes: 8 additions & 7 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ class InstallCommand extends Command {
}, {
title: 'Moving files',
task: () => this.ui.listr([{
title: 'Summoning Casper',
task: this.casper
}, {
title: 'Linking things',
task: this.link.bind(this)
}], false, {concurrent: true})
}, {
title: 'Summoning Casper',
task: this.casper
}], false)
}], {
version: version,
cliVersion: this.cliVersion
Expand All @@ -92,9 +92,10 @@ class InstallCommand extends Command {
});
}

casper(ctx) {
return fs.move(
path.join(ctx.installPath, 'content', 'themes', 'casper'),
casper() {
// Create a symlink to the theme from the current version
return symlinkSync(
path.join(process.cwd(), 'current', 'content', 'themes', 'casper'),
path.join(process.cwd(), 'content', 'themes', 'casper')
);
}
Expand Down
15 changes: 0 additions & 15 deletions lib/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,6 @@ class UpdateCommand extends Command {
}, {
title: 'Linking things',
task: this.link
}, {
title: 'Installing new version of Casper',
skip: (ctx) => ctx.rollback,
task: (ctx, task) => {
let casperPath = path.join(process.cwd(), 'content', 'themes', 'casper');

if (!fs.existsSync(casperPath)) {
return task.skip();
}

return fs.remove(casperPath).then(() => fs.move(
path.join(ctx.installPath, 'content', 'themes', 'casper'),
casperPath
));
}
}, {
title: 'Running database migrations',
skip: (ctx) => ctx.rollback,
Expand Down