Created
May 10, 2013 04:42
-
-
Save katapad/5552420 to your computer and use it in GitHub Desktop.
Gruntで更新のあったファイルだけFTPする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (grunt) -> | |
grunt.loadNpmTasks 'grunt-contrib-watch' | |
grunt.loadNpmTasks 'grunt-ftp-deploy' | |
ftpSettings = | |
auth: | |
host: "hogehoge.com" | |
port: 21 | |
authKey: "hogehogekey" | |
src: "www" | |
dest: "/public_html/dest" | |
exclusions: ['**/.DS_Store', '**/*.*'] | |
grunt.initConfig | |
watch: | |
ftp: | |
files: [ 'www/**/*' ] | |
tasks: ['ftp-deploy:changed'] | |
options: | |
nospawn: true | |
'ftp-deploy': | |
changed: | |
# auth: '<%= ftp-deploy.build.auth %>' | |
auth: ftpSettings.auth | |
src: ftpSettings.src | |
dest: ftpSettings.dest | |
exclusions: ftpSettings.exclusions | |
grunt.registerTask 'w', ['watch:ftp'] | |
grunt.event.on "watch", (action, filepath) -> | |
if action != 'changed' | |
return | |
target = '!' + filepath | |
exclusions = ftpSettings.exclusions.concat() | |
exclusions.push(target) | |
grunt.config.set 'ftp-deploy:changed:exclusions', exclusions | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment