Skip to content

Instantly share code, notes, and snippets.

@afelicioni
Last active September 10, 2015 22:34
Show Gist options
  • Save afelicioni/2ca11b3e8d3bcaf61c45 to your computer and use it in GitHub Desktop.
Save afelicioni/2ca11b3e8d3bcaf61c45 to your computer and use it in GitHub Desktop.
deploy su ftp con file system watcher via grunt
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
ftpush: {
all: {
auth: {
host: 'ftp.felolabs.com',
port: 21,
authKey: 'key1'
},
src: './',
dest: '/www.felolabs.com/a/',
exclusions: ['node_modules', '.*'],
keep: ['/important/images/at/server/*.jpg']
}
},
watch: {
all:{
files: '**/*',
tasks: ['ftpush:all'],
options: {
nospawn: true
}
}
}
});
grunt.event.on('watch', function(action, filepath, target) {
var files = {"./":filepath};
// grunt.config(['ftp_push', 'files', 'src'], files);
// grunt.config(['ftp_push', 'files', 'src'], [filepath]);
// grunt.config('ftp_push.all.files.src', [filepath]);
// console.log(grunt.config('ftp_push.all.files.src'));
});
//grunt.loadNpmTasks('grunt-contrib-uglify');
//grunt.loadNpmTasks('grunt-ftp-push');
grunt.loadNpmTasks('grunt-ftpush');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['watch:all']);
};
{
"name": "my-project-name",
"version": "0.1.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-uglify": "^0.9.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-ftp-push": "^0.4.1",
"grunt-ftpush": "^0.3.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment