le1t0-capistrano 2.5.18.002 → 2.5.18.003

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/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 2.5.18.003 / May 18, 2010
2
+
3
+ Merged in multistage support.
4
+
1
5
  == 2.5.18.002 / May 18, 2010
2
6
 
3
7
  Various fixes and additions:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.5.18.002
1
+ 2.5.18.003
@@ -1,3 +1,5 @@
1
+ require 'capistrano/multistage'
2
+
1
3
  module Capistrano
2
4
  class ExtensionProxy #:nodoc:
3
5
  def initialize(config, mod)
@@ -0,0 +1,61 @@
1
+ require 'fileutils'
2
+
3
+ unless Capistrano::Configuration.respond_to?(:instance)
4
+ abort "capistrano/ext/multistage requires Capistrano 2"
5
+ end
6
+
7
+ Capistrano::Configuration.instance.load do
8
+ location = fetch(:stage_dir, "config/deploy")
9
+
10
+ unless exists?(:stages)
11
+ set :stages, Dir["#{location}/*.rb"].map { |f| File.basename(f, ".rb") }
12
+ end
13
+
14
+ stages.each do |name|
15
+ desc "Set the target stage to `#{name}'."
16
+ task(name) do
17
+ set :stage, name.to_sym
18
+ load "#{location}/#{stage}"
19
+ end
20
+ end
21
+
22
+ on :load do
23
+ if stages.include?(ARGV.first)
24
+ # Execute the specified stage so that recipes required in stage can contribute to task list
25
+ find_and_execute_task(ARGV.first) if ARGV.any?{ |option| option =~ /-T|--tasks|-e|--explain/ }
26
+ else
27
+ # Execute the default stage so that recipes required in stage can contribute tasks
28
+ find_and_execute_task(default_stage) if exists?(:default_stage)
29
+ end
30
+ end
31
+
32
+ namespace :multistage do
33
+ desc "[internal] Ensure that a stage has been selected."
34
+ task :ensure do
35
+ if !exists?(:stage)
36
+ if exists?(:default_stage)
37
+ logger.important "Defaulting to `#{default_stage}'"
38
+ find_and_execute_task(default_stage)
39
+ else
40
+ abort "No stage specified. Please specify one of: #{stages.join(', ')} (e.g. `cap #{stages.first} #{ARGV.last}')"
41
+ end
42
+ end
43
+ end
44
+
45
+ desc "Stub out the staging config files."
46
+ task :prepare do
47
+ FileUtils.mkdir_p(location)
48
+ stages.each do |name|
49
+ file = File.join(location, name + ".rb")
50
+ unless File.exists?(file)
51
+ File.open(file, "w") do |f|
52
+ f.puts "# #{name.upcase}-specific deployment configuration"
53
+ f.puts "# please put general deployment config in config/deploy.rb"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+
60
+ on :start, "multistage:ensure", :except => stages + ['multistage:prepare']
61
+ end
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 2
7
7
  - 5
8
8
  - 18
9
- - 2
10
- version: 2.5.18.002
9
+ - 3
10
+ version: 2.5.18.003
11
11
  platform: ruby
12
12
  authors:
13
13
  - Le1t0
@@ -140,6 +140,7 @@ files:
140
140
  - lib/capistrano/errors.rb
141
141
  - lib/capistrano/extensions.rb
142
142
  - lib/capistrano/logger.rb
143
+ - lib/capistrano/multistage.rb
143
144
  - lib/capistrano/processable.rb
144
145
  - lib/capistrano/recipes/compat.rb
145
146
  - lib/capistrano/recipes/deploy.rb