capistrano-multiyaml 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +10 -3
- data/capistrano-multiyaml.gemspec +1 -1
- data/lib/capistrano-multiyaml.rb +3 -2
- metadata +2 -2
data/README.md
CHANGED
|
@@ -13,6 +13,8 @@ For more information about the general idea of multistage deployment, see the [d
|
|
|
13
13
|
set :stages, %w(integration staging production)
|
|
14
14
|
set :default_stage, "staging"
|
|
15
15
|
set :multiyaml_stages, "config/stages.yaml"`
|
|
16
|
+
|
|
17
|
+
require 'capistrano-multiyaml'
|
|
16
18
|
|
|
17
19
|
**Note:** `:default_stage` is optional, and `:multiyaml_stages` only needs to be set if you are using a location other than `config/stages.yaml`.
|
|
18
20
|
|
|
@@ -25,11 +27,11 @@ The easiest way to understand the capabilities of the YAML file is to see a comp
|
|
|
25
27
|
integration:
|
|
26
28
|
roles:
|
|
27
29
|
app:
|
|
28
|
-
'
|
|
30
|
+
'#{`hostname -f`}':
|
|
29
31
|
staging:
|
|
30
32
|
variables: &vars
|
|
31
33
|
:data_path: '/nfs/#{application}/#{stage}'
|
|
32
|
-
:clean_script: '
|
|
34
|
+
:clean_script: '/usr/local/bin/clean-cache.sh'
|
|
33
35
|
tasks: &tasks
|
|
34
36
|
- type : after_callback
|
|
35
37
|
target: 'deploy:setup'
|
|
@@ -62,7 +64,7 @@ production:
|
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
* Variable keys are symbols
|
|
65
|
-
*
|
|
67
|
+
* Variables and roles are interpolated. It is valid to use other variables within variables and roles, such as the staging data_path variable including the stage and application name, and the development app server role looking up the FQDN of localhost.
|
|
66
68
|
* Tasks can be one of `after_callback` (using the "after" hook) or `before_callback` (using the "before" hook). Action can be either another task or a code block to be evaluated.
|
|
67
69
|
* Additional parameters can be passed to servers in an array
|
|
68
70
|
|
|
@@ -73,3 +75,8 @@ Prefix deploy actions with the name of the stage, i.e. `cap production TASK`. I
|
|
|
73
75
|
## Caveats
|
|
74
76
|
|
|
75
77
|
* Don't name your stage "stage", as this is a reserved word under the multistage extension (deploys won't do anything and in fact it will cause an infinite loop).
|
|
78
|
+
|
|
79
|
+
## Inspiration
|
|
80
|
+
|
|
81
|
+
* [Jamis Buck's original](https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension)
|
|
82
|
+
* [Lee Hambly's alternative](https://github.com/leehambley/capistrano-yaml-multistage)
|
data/lib/capistrano-multiyaml.rb
CHANGED
|
@@ -37,6 +37,7 @@ Capistrano::Configuration.instance.load do
|
|
|
37
37
|
config.each do |section, contents|
|
|
38
38
|
case section.to_s
|
|
39
39
|
|
|
40
|
+
# Set variables first so they can be used in roles if necessary.
|
|
40
41
|
when "variables"
|
|
41
42
|
contents.each do |key, value|
|
|
42
43
|
if key.is_a?(Symbol) and not value.nil? then
|
|
@@ -59,9 +60,9 @@ Capistrano::Configuration.instance.load do
|
|
|
59
60
|
hosts.each do |hostname, options|
|
|
60
61
|
logger.info "Processing host settings for #{hostname} (#{name})"
|
|
61
62
|
if options.is_a?(Hash) then
|
|
62
|
-
role(rolename.to_sym, hostname.to_s, options)
|
|
63
|
+
role(rolename.to_sym, String.interpolate{hostname.to_s}, options)
|
|
63
64
|
else
|
|
64
|
-
role(rolename.to_sym, hostname.to_s)
|
|
65
|
+
role(rolename.to_sym, String.interpolate{hostname.to_s})
|
|
65
66
|
end
|
|
66
67
|
end
|
|
67
68
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: capistrano-multiyaml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-04-
|
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: capistrano
|