Skip to content

Commit

Permalink
feat(grunt): move deployment variables to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Sep 2, 2015
1 parent 972c6c2 commit 80fe55b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 41 deletions.
10 changes: 7 additions & 3 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>"
Expand Down Expand Up @@ -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: [
Expand Down
19 changes: 0 additions & 19 deletions _config.init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
19 changes: 0 additions & 19 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
17 changes: 17 additions & 0 deletions _deploy.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 80fe55b

Please sign in to comment.