forked from jgergic/gooddata.github.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jakefile.js
65 lines (53 loc) · 2.34 KB
/
Jakefile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
var sys = require('sys')
,exec = require('child_process').exec;
var run_command = function(info, command, callback) {
sys.puts(info);
return exec(command, {env:process.env,cwd:process.cwd()}, function(err, stdout, stderr) {
if (err) throw new Error('Failed command: '+command+' Error: '+stderr);
else callback(err, stdout, stderr);
});
};
desc('…blank…');
task('default', [], function() {
sys.puts('Available targets: upload, clean, build, deploy, deploy-production');
}, true);
// --BETA-DEPLOYS------------------------------------------
desc('Build Jekyll website, compress CSS');
task('build', ['clean'], function() {
run_command('Building Jekyll site...', 'jekyll && cat _site/css/style.css | java -jar /usr/local/bin/yuicompressor.jar --type css > _site/css/style-min.css && mv _site/css/style-min.css _site/css/style.css && echo "User-Agent: *\nDisallow: /" > _site/robots.txt', function() {
sys.puts('done.');
complete();
});
}, true);
desc('Push website to developer-beta');
task('deploy', [], function() {
run_command('Uploading website...', '$(cd _site/ && tar czf - . | ssh [email protected] \'cat | tar xzf - -C /opt/devsite/\')', function() {
sys.puts('done.');
complete();
});
}, true);
desc('Build and upload website');
task('upload', ['build','deploy'], function() {});
// --PRODUCTION-DEPLOYS------------------------------------
desc('Build Jekyll website, compress CSS');
task('build-production', ['clean'], function() {
run_command('Building Jekyll site...', 'cat css/style.less | tail -n +3 > /tmp/style.less && lessc /tmp/style.less | java -jar /usr/local/bin/yuicompressor.jar --type css > css/style.css', function() {
sys.puts('done.');
complete();
});
}, true);
desc('Push website to developer-beta');
task('deploy-production', [], function() {
sys.puts('Review your changes in git, commit and push to origin.');
complete();
}, true);
desc('Build and upload website');
task('upload-production', ['build-production','deploy-production'], function() {});
// --------------------------------------------------------
desc('Clean old statically generated version');
task('clean', [], function() {
run_command('Cleaning...', 'rm -Rf _site', function() {
sys.puts('done.');
complete();
});
}, true);