When deploying to the test server, Grunt now cleans up the folder before uploading.
This is to avoid filling it up with files : since our file names change every time there's a modification (filerev), every time we deployed we would have created a new copy of, say, scripts.min.js
This commit is contained in:
parent
7c8c33dbc3
commit
b0248725eb
1 changed files with 29 additions and 7 deletions
36
Gruntfile.js
36
Gruntfile.js
|
@ -303,18 +303,40 @@ module.exports = function (grunt) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// don't keep server passwords in source control
|
// SSH files used to clean and deploy using sftp on a test server.
|
||||||
serverCredentials: grunt.file.readJSON('.ssh/serverCredentials.json'),
|
// Be sure to .gitignore the .ssh/ folder !
|
||||||
|
// testServer should contain :
|
||||||
|
// {
|
||||||
|
// "host": 'my-test-server.com',
|
||||||
|
// "username": 'my-username-on-this-server',
|
||||||
|
// "password": 'include-only-if-not-using-private-key-below'
|
||||||
|
// }
|
||||||
|
sshconfig: {
|
||||||
|
testServer: grunt.file.readJSON('.ssh/testServer.json')
|
||||||
|
},
|
||||||
|
// This is the private key for the username on the host defined in testServer.json
|
||||||
|
testServerKey: grunt.file.read('.ssh/test-server-key'),
|
||||||
|
// Removes everything at the deploy location to avoid filling up the server with revved files.
|
||||||
|
sshexec: {
|
||||||
|
cleanTest: {
|
||||||
|
command: 'rm -rf /var/www/jamstash/*',
|
||||||
|
options: {
|
||||||
|
config: 'testServer',
|
||||||
|
privateKey: '<%= testServerKey %>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// Deploy with sftp to the test server
|
||||||
sftp: {
|
sftp: {
|
||||||
test: {
|
test: {
|
||||||
files: {
|
files: {
|
||||||
'./': ['<%= yeoman.dist %>/{,*/}*', '!<%= yeoman.dist %>/.git*']
|
'./': ['<%= yeoman.dist %>/{,*/}*', '<%= yeoman.dist %>/.git*']
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
path: '/var/www/jamstash',
|
path: '/var/www/jamstash',
|
||||||
host: '<%= serverCredentials.host %>',
|
srcBasePath: "dist/",
|
||||||
username: '<%= serverCredentials.username %>',
|
config: 'testServer',
|
||||||
privateKey: grunt.file.read('.ssh/test-server-key'),
|
privateKey: '<%= testServerKey %>',
|
||||||
showProgress: true,
|
showProgress: true,
|
||||||
createDirectories: true
|
createDirectories: true
|
||||||
}
|
}
|
||||||
|
@ -361,7 +383,7 @@ module.exports = function (grunt) {
|
||||||
grunt.registerTask('deploy', 'Build and deploy to test server', function() {
|
grunt.registerTask('deploy', 'Build and deploy to test server', function() {
|
||||||
return grunt.task.run([
|
return grunt.task.run([
|
||||||
'build',
|
'build',
|
||||||
//'sshexec:clean-test',
|
'sshexec:cleanTest',
|
||||||
'sftp:test'
|
'sftp:test'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue