From 260665eef9aa105ebd6521f300cbdc059e063a82 Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Sat, 22 Feb 2014 23:09:29 -0500 Subject: [PATCH 1/5] documented multiple environment config --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/README.md b/README.md index b669d5b..be6c224 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,55 @@ activate :deploy do |deploy| end ``` +### Multiple Environments + +Deploy to different environments using environment variables and Rake tasks. + +```ruby +# config.rb + +case ENV['TARGET'].to_s.downcase +when 'production' + activate :deploy do |deploy| + deploy.method = :rsync + deploy.host = "www.example.com" + deploy.path = "/srv/www/production-site" + end +else + activate :deploy do |deploy| + deploy.method = :rsync + deploy.host = "staging.example.com" + deploy.path = "/srv/www/staging-site" + end +end +``` + +```ruby +# Rakefile + +namespace :deploy do + def deploy(env) + puts "Deploying to #{env}" + exec "TARGET=#{env} bundle exec middleman deploy" + end + + task :staging do + deploy :staging + end + + task :production do + deploy :production + end +end +``` + +Deploy using your new custom rake tasks. + +```sh +$ rake deploy:staging +$ rake deploy:production +``` + ## Breaking Changes * `v0.1.0` From a7e90214f2b2774515b1ceb58b2cd3ad422a8189 Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Sat, 22 Feb 2014 23:09:29 -0500 Subject: [PATCH 2/5] documented multiple environment config --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README.md b/README.md index b669d5b..24be975 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,56 @@ activate :deploy do |deploy| end ``` +### Multiple Environments + +Deploy your site to more than one configuration using environment variables. + +```ruby +# config.rb + +case ENV['TARGET'].to_s.downcase +when 'production' + activate :deploy do |deploy| + deploy.method = :rsync + deploy.host = "www.example.com" + deploy.path = "/srv/www/production-site" + end +else + activate :deploy do |deploy| + deploy.method = :rsync + deploy.host = "staging.example.com" + deploy.path = "/srv/www/staging-site" + end +end +``` + + $ TARGET=staging bundle exec middleman deploy + $ TARGET=production bundle exec middleman deploy + +Tighten this up with some custom Rake tasks + +```ruby +# Rakefile + +namespace :deploy do + def deploy(env) + puts "Deploying to #{env}" + exec "TARGET=#{env} bundle exec middleman deploy" + end + + task :staging do + deploy :staging + end + + task :production do + deploy :production + end +end +``` + + $ rake deploy:staging + $ rake deploy:production + ## Breaking Changes * `v0.1.0` From 669763b8788e85ed4853daacdbe50618c7cd7ca6 Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Sat, 22 Feb 2014 23:22:24 -0500 Subject: [PATCH 3/5] rmeoved conflicts --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 0e2611c..24be975 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,7 @@ end ### Multiple Environments -<<<<<<< HEAD Deploy your site to more than one configuration using environment variables. -======= -Deploy to different environments using environment variables and Rake tasks. ->>>>>>> 260665eef9aa105ebd6521f300cbdc059e063a82 ```ruby # config.rb From dbaef1ead75923a17323a27f954a4b425bdfbfed Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Sat, 22 Feb 2014 23:23:27 -0500 Subject: [PATCH 4/5] refined language --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 24be975..8e1b2df 100644 --- a/README.md +++ b/README.md @@ -132,11 +132,6 @@ else end ``` - $ TARGET=staging bundle exec middleman deploy - $ TARGET=production bundle exec middleman deploy - -Tighten this up with some custom Rake tasks - ```ruby # Rakefile From ae68d406167a52a6a587b9468cc0592ea36e5f8d Mon Sep 17 00:00:00 2001 From: Derek Watson Date: Sat, 22 Feb 2014 23:24:54 -0500 Subject: [PATCH 5/5] whitespace --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 8e1b2df..10c47b3 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,6 @@ Deploy your site to more than one configuration using environment variables. ```ruby # config.rb - case ENV['TARGET'].to_s.downcase when 'production' activate :deploy do |deploy| @@ -134,7 +133,6 @@ end ```ruby # Rakefile - namespace :deploy do def deploy(env) puts "Deploying to #{env}"