From 861c1654e7d3c5f7992d06b6e23370dadd160eed Mon Sep 17 00:00:00 2001 From: Pete Hodgson Date: Wed, 29 May 2013 22:34:39 -0700 Subject: [PATCH] use microstatic rake tasks to deploy --- .travis.yml | 2 +- Gemfile | 2 +- Gemfile.lock | 6 +++++- tasks/deploy_tasks.rb | 21 ++++++++++++++++----- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ce8b7e..b7f6bfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ rvm: - 1.9.3 script: - rake generate -- rake deploy +- rake deploy:preview env: global: - secure: ! 'EShtaDZJGtAPbrx7yzNEaXw+pLvOfyMklloEgLa9mvRtniYGXF9iQjcUYSvq diff --git a/Gemfile b/Gemfile index bbc4d79..4c2fe1d 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,4 @@ source 'http://rubygems.org' gem "rake" gem "jekyll", "0.11.0" gem "liquid", "~>2.2.2" -gem "microstatic", "~> 0.1.0" +gem "microstatic", "~> 0.2.0" diff --git a/Gemfile.lock b/Gemfile.lock index 2b37a85..6f87ee9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -23,8 +23,11 @@ GEM liquid (2.2.2) maruku (0.6.0) syntax (>= 1.0.0) + microstatic (0.2.0) + aws-s3 (~> 0.6.3) mime-types (1.23) posix-spawn (0.3.6) + rake (10.0.4) syntax (1.0.0) xml-simple (1.1.2) @@ -32,6 +35,7 @@ PLATFORMS ruby DEPENDENCIES - aws-s3 (~> 0.6.3) jekyll (= 0.11.0) liquid (~> 2.2.2) + microstatic (~> 0.2.0) + rake diff --git a/tasks/deploy_tasks.rb b/tasks/deploy_tasks.rb index 93f3c3c..9c6bdec 100644 --- a/tasks/deploy_tasks.rb +++ b/tasks/deploy_tasks.rb @@ -1,4 +1,4 @@ -require 'microstatic' +require 'microstatic/rake' PREVIEW_AWS_BUCKET = "preview.testingwithfrank.com" PRODUCTION_AWS_BUCKET = "preview.testingwithfrank.com" # NOT CONFIDENT QUITE YET @@ -16,8 +16,19 @@ def deploy_to_bucket(bucket) deployer.upload end -desc "deploy to production" -task :deploy do - deploy_to_bucket(PRODUCTION_AWS_BUCKET) -end +namespace :deploy do + source_dir = File.expand_path("../../public",__FILE__) + + desc "deploy to production" + Microstatic::Rake.s3_deploy_task( :prod ) do |task| + task.source_dir = source_dir + task.bucket_name = PRODUCTION_AWS_BUCKET + end + + desc "deploy to preview" + Microstatic::Rake.s3_deploy_task( :preview ) do |task| + task.source_dir = source_dir + task.bucket_name = PREVIEW_AWS_BUCKET + end +end