capistrano-ext-params 0.1.1 → 0.1.2
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/lib/capistrano/ext/params.rb +41 -11
- metadata +7 -7
@@ -3,7 +3,7 @@ require 'capistrano'
|
|
3
3
|
require 'capistrano/ext/set/helpers'
|
4
4
|
|
5
5
|
class CapistranoExtParams
|
6
|
-
VERSION = '0.1.
|
6
|
+
VERSION = '0.1.2'
|
7
7
|
|
8
8
|
def self.with_configuration(&block)
|
9
9
|
Capistrano::Configuration.instance(:must_exist).load(&block)
|
@@ -12,14 +12,6 @@ end
|
|
12
12
|
|
13
13
|
$capistrano_ext_params = {}
|
14
14
|
|
15
|
-
CapistranoExtParams.with_configuration do
|
16
|
-
namespace :params do
|
17
|
-
desc "List all known parameters and their options"
|
18
|
-
task :list do
|
19
|
-
puts $capistrano_ext_params.to_yaml
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
15
|
|
24
16
|
module Capistrano
|
25
17
|
class Configuration
|
@@ -42,6 +34,9 @@ module Capistrano
|
|
42
34
|
brief << " " * (max_length-brief.length) if max_length > brief.length
|
43
35
|
brief << "requires " + @options[:required].join(",")
|
44
36
|
end
|
37
|
+
unless @options.nil? || @options[:optional].nil? || @options[:optional].empty?
|
38
|
+
brief << " optional " + @options[:optional].join(",")
|
39
|
+
end
|
45
40
|
brief
|
46
41
|
end
|
47
42
|
end
|
@@ -52,7 +47,13 @@ module Capistrano
|
|
52
47
|
class Configuration
|
53
48
|
module Execution
|
54
49
|
|
55
|
-
def
|
50
|
+
def optional_params(params=[])
|
51
|
+
params.each do |param|
|
52
|
+
env_set_optional(param)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def required_params(params=[])
|
56
57
|
params = [ params ].flatten
|
57
58
|
|
58
59
|
# Query user for any undefined variables
|
@@ -68,7 +69,8 @@ module Capistrano
|
|
68
69
|
|
69
70
|
alias_method :original_execute_task, :execute_task
|
70
71
|
def execute_task(task)
|
71
|
-
|
72
|
+
optional_params(task.options[:optional]) if task.options[:optional]
|
73
|
+
required_params(task.options[:required]) if task.options[:required]
|
72
74
|
original_execute_task(task)
|
73
75
|
end
|
74
76
|
|
@@ -148,3 +150,31 @@ module Capistrano
|
|
148
150
|
end
|
149
151
|
|
150
152
|
end
|
153
|
+
|
154
|
+
CapistranoExtParams.with_configuration do
|
155
|
+
desc_param :task_name, "A fully qualified capistrano task name"
|
156
|
+
|
157
|
+
namespace :params do
|
158
|
+
desc "List all known parameters and their options"
|
159
|
+
task :list,
|
160
|
+
:optional => [:task_name] do
|
161
|
+
param_defs = $capistrano_ext_params
|
162
|
+
if exists?(:task_name)
|
163
|
+
all_params = []
|
164
|
+
param_defs_task = {}
|
165
|
+
target_task = top.find_task(task_name)
|
166
|
+
if target_task
|
167
|
+
optional = target_task.options[:optional]
|
168
|
+
required = target_task.options[:required]
|
169
|
+
all_params = [optional,required].flatten.compact
|
170
|
+
all_params.each do |param|
|
171
|
+
param_defs_task[param] = nil
|
172
|
+
end
|
173
|
+
end
|
174
|
+
param_defs = param_defs_task.merge(param_defs.select{|k,v| all_params.include? k})
|
175
|
+
end
|
176
|
+
|
177
|
+
puts param_defs.to_yaml
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ext-params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-06 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &10956720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10956720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano-ext-set-helpers
|
27
|
-
requirement: &
|
27
|
+
requirement: &10956120 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *10956120
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hoe
|
38
|
-
requirement: &
|
38
|
+
requirement: &10955560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.12'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *10955560
|
47
47
|
description: ! 'This package adds optional and required params to capistrano.
|
48
48
|
|
49
49
|
|