README.md in middleman-deploy-0.1.4 vs README.md in middleman-deploy-0.2.0

- old
+ new

@@ -48,11 +48,11 @@ deploy.path = "/srv/www/site" # Optional Settings # deploy.user = "tvaughan" # no default # deploy.port = 5309 # ssh port, default: 22 # deploy.clean = true # remove orphaned files on remote host, default: false - # deploy.flags = "-rltgoDvzO --no-p --del -e" # add custom flags, default: -avze + # deploy.flags = "-rltgoDvzO --no-p --del" # add custom flags, default: -avz end ``` ### Git (e.g. GitHub Pages) @@ -61,22 +61,27 @@ ```ruby activate :deploy do |deploy| deploy.method = :git # Optional Settings - # deploy.remote = "custom-remote" # remote name or git url, default: origin - # deploy.branch = "custom-branch" # default: gh-pages + # deploy.remote = "custom-remote" # remote name or git url, default: origin + # deploy.branch = "custom-branch" # default: gh-pages + # deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push end ``` If you use a remote name, you must first add it using `git remote add`. Run `git remote -v` to see a list of possible remote names. If you use a git url, it must end with '.git'. -Afterwards, the `build` directory will become a git repo. This branch will be -created on the remote if it doesn't already exist. +Afterwards, the `build` directory will become a git repo. +If you use the force push strategy, this branch will be created on the remote if +it doesn't already exist. +But if you use the submodule strategy, you must first initialize build folder as +a submodule. See `git submodule add` documentation. + ### FTP Activate the extension by adding the following to `config.rb`: ```ruby @@ -95,15 +100,59 @@ ```ruby activate :deploy do |deploy| deploy.method = :sftp deploy.host = "sftp.example.com" + deploy.port = 22 deploy.path = "/srv/www/site" # Optional Settings # deploy.user = "tvaughan" # no default # deploy.password = "secret" # no default 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 +``` + +```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` - Removed the `--clean` command-line option. This option only applied to