From 80fe55bebb3f6ac2faffdf7cc0d4ea486954a692 Mon Sep 17 00:00:00 2001 From: Tunghsiao Liu Date: Wed, 2 Sep 2015 09:05:08 +0800 Subject: [PATCH] feat(grunt): move deployment variables to a separate file --- Gruntfile.coffee | 10 +++++++--- _config.init.yml | 19 ------------------- _config.yml | 19 ------------------- _deploy.yml | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 41 deletions(-) create mode 100644 _deploy.yml diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 916b7c53e..49664fd89 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -21,6 +21,7 @@ module.exports = (grunt) -> cfg: grunt.file.readYAML("_config.yml") pkg: grunt.file.readJSON("package.json") amsf: grunt.file.readYAML("_amsf/_config.yml") + deploy: grunt.file.readYAML("_deploy.yml") app: "<%= config.cfg.source %>" dist: "<%= config.cfg.destination %>" base: "<%= config.cfg.base %>" @@ -293,15 +294,18 @@ module.exports = (grunt) -> # Direct sync compiled static files to remote server sync_server: - command: "rsync -avz --delete --progress <%= config.cfg.ignore_files %> <%= config.dist %>/ <%= config.cfg.remote_host %>:<%= config.cfg.remote_dir %> > rsync.log" + command: "rsync -avz --delete --progress <%= config.deploy.ignore_files %> <%= config.dist %>/ <%= config.deploy.sftp.host %>:<%= config.deploy.sftp.dest %> > rsync-sftp.log" # Copy compiled static files to local directory for further post-process sync_local: - command: "rsync -avz --delete --progress <%= config.cfg.ignore_files %> <%= jekyll.dist.options.dest %>/ /Users/sparanoid/Workspace/Sites/sparanoid.com<%= config.base %> > rsync.log" + command: [ + "rsync -avz --delete --progress <%= config.deploy.ignore_files %> <%= jekyll.dist.options.dest %>/ <%= config.deploy.s3_website.dest %>/site/<%= config.base %> > rsync-s3_website.log" + "sh <%= config.deploy.s3_website.dest %>/auto-commit" + ].join("&&") # Sync images to a separate CloudFront s3: - command: "s3cmd sync -rP --guess-mime-type --delete-removed --no-preserve --cf-invalidate --add-header=Cache-Control:max-age=31536000 --exclude '.DS_Store' <%= config.cfg.static_files %> <%= config.cfg.s3_bucket %>" + command: "s3cmd sync -rP --guess-mime-type --delete-removed --no-preserve --cf-invalidate --add-header=Cache-Control:max-age=31536000 --exclude '.DS_Store' <%= config.deploy.s3.cwd %> <%= config.deploy.s3.bucket %>" amsf__theme__to_app: command: [ diff --git a/_config.init.yml b/_config.init.yml index 13631f0ac..e7e13a24d 100644 --- a/_config.init.yml +++ b/_config.init.yml @@ -110,22 +110,3 @@ rss_excerpt: false # Show generator credits # Default: true credits: true - -# -# Custom distribution variables -# - -# SSH remote server hostname -remote_host: caladbolg - -# Prevent them from being deleted on server (rsync --delete), these files and directories are available on the remote server but outside this git repo. I need to ignore them. -ignore_files: --exclude=lab - -# Media assets sync'ed using s3cmd -static_files: ~/Workspace/Sites/static.sparanoid.com/ - -# Remote server root directory -remote_dir: /srv/www/sparanoid.com/public_html - -# Amazon S3 Bucket variable for s3cmd -s3_bucket: s3://sparanoid/ diff --git a/_config.yml b/_config.yml index 4033e91d9..edde12e8a 100644 --- a/_config.yml +++ b/_config.yml @@ -117,22 +117,3 @@ rss_excerpt: false # Show generator credits # Default: true credits: true - -# -# Custom distribution variables -# - -# SSH remote server hostname -remote_host: caladbolg - -# Prevent them from being deleted on server (rsync --delete), these files and directories are available on the remote server but outside this git repo. I need to ignore them. -ignore_files: --exclude=lab - -# Media assets sync'ed using s3cmd -static_files: ~/Workspace/Sites/static.sparanoid.com/ - -# Remote server root directory -remote_dir: /srv/www/sparanoid.com/public_html - -# Amazon S3 Bucket variable for s3cmd -s3_bucket: s3://sparanoid/ diff --git a/_deploy.yml b/_deploy.yml new file mode 100644 index 000000000..c17255f95 --- /dev/null +++ b/_deploy.yml @@ -0,0 +1,17 @@ +# +# Custom deployment variables +# + +# Prevent them from being deleted on server (rsync --delete), these files and directories are available on the remote server but outside this git repo. I need to ignore them. +ignore_files: --exclude=lab + +sftp: + host: caladbolg + dest: /srv/www/sparanoid.com/public_html + +s3: + cwd: ~/Workspace/Sites/static.sparanoid.com + bucket: s3://sparanoid/ + +s3_website: + dest: ~/Git/sparanoid.com-prod