documented multiple environment config
This commit is contained in:
parent
83c24d7443
commit
260665eef9
1 changed files with 49 additions and 0 deletions
49
README.md
49
README.md
|
@ -109,6 +109,55 @@ activate :deploy do |deploy|
|
||||||
end
|
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
|
## Breaking Changes
|
||||||
|
|
||||||
* `v0.1.0`
|
* `v0.1.0`
|
||||||
|
|
Loading…
Reference in a new issue