capistrano-multiproject 0.0.1 → 0.0.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.
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "capistrano-multiproject"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
6
6
|
s.authors = ["Olek Poplavsky"]
|
7
7
|
s.email = ["olek@woodenbits.com"]
|
8
8
|
s.homepage = "https://github.com/woodenbits/capistrano-multiproject"
|
@@ -27,6 +27,9 @@ It is not quite enough if you have multiple projects to deploy (SOA would be one
|
|
27
27
|
Gemfile
|
28
28
|
lib/capistrano/multiproject/configurations.rb
|
29
29
|
lib/capistrano/multiproject/ensure.rb
|
30
|
+
lib/capistrano/multiproject/filter_roles.rb
|
31
|
+
lib/capistrano/multiproject/any_server_role.rb
|
32
|
+
lib/capistrano/multiproject/task_list.rb
|
30
33
|
lib/capistrano/multiproject.rb
|
31
34
|
Rakefile
|
32
35
|
README.md
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :multiproject do
|
3
|
+
desc "[internal] Generate arteficial any_server role that enumerates all known servers"
|
4
|
+
task :any_server_role do
|
5
|
+
project_roles_sym = project_roles.map(&:to_sym)
|
6
|
+
servers = roles.values.map(&:servers).flatten.sort.uniq.map(&:to_s)
|
7
|
+
top.role :any_server, *servers, :no_release => true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
on :start, 'multiproject:any_server_role', :except => (projects + stages + %w(?))
|
12
|
+
end
|
13
|
+
|
14
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :multiproject do
|
3
|
+
desc "[internal] Filter roles to only those that are used by the current project"
|
4
|
+
task :filter_roles do
|
5
|
+
project_roles_sym = project_roles.map(&:to_sym)
|
6
|
+
roles.select! { |k,v| project_roles_sym.include?(k) }
|
7
|
+
logger.info "Filtered roles down to '#{roles.keys.sort.join(', ')}'"
|
8
|
+
if roles.empty? && project_roles == [project]
|
9
|
+
abort "Define servers of role '#{project}' in stage '#{stage}' configuration, or specify project roles in project recipe (e.g. 'set :project_roles, [:foo, :bar]')"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
on :start, 'multiproject:filter_roles', :except => (projects + stages + %w(?))
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
# a capistrano task to list other tasks, filtering them based on context
|
3
|
+
desc "Contextual task list"
|
4
|
+
task '?' do
|
5
|
+
tasks = top.task_list(:all)
|
6
|
+
|
7
|
+
hidden_tasks = fetch(:hidden_tasks, [])
|
8
|
+
hidden_tasks << '?'
|
9
|
+
|
10
|
+
set(:verbose, false) unless exists?(:verbose)
|
11
|
+
|
12
|
+
unless verbose
|
13
|
+
tasks =
|
14
|
+
if exists?(:project) && exists?(:stage)
|
15
|
+
tasks.reject do |t|
|
16
|
+
t.description.empty? ||
|
17
|
+
t.description =~ /^\[internal\]/ ||
|
18
|
+
t.options[:multiproject] ||
|
19
|
+
hidden_tasks.include?(t.fully_qualified_name)
|
20
|
+
end
|
21
|
+
elsif exists?(:project) && !exists?(:stage)
|
22
|
+
tasks.select { |t| t.options[:multiproject] && t.options[:kind] == :stage }
|
23
|
+
elsif exists?(:stage) && !exists?(:project)
|
24
|
+
tasks.select { |t| t.options[:multiproject] && t.options[:kind] == :project }
|
25
|
+
else
|
26
|
+
tasks.select { |t| t.options[:multiproject] && t.options[:kind] == :stage }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
longest = tasks.map { |task| task.fully_qualified_name.length }.max
|
31
|
+
tasks.sort! { |a,b| a.fully_qualified_name <=> b.fully_qualified_name }
|
32
|
+
|
33
|
+
max_length = 76
|
34
|
+
tasks.each do |task|
|
35
|
+
description = task.desc
|
36
|
+
description ||= ''
|
37
|
+
description = description.gsub(/\n/,' ')
|
38
|
+
description = description.squeeze(' ')
|
39
|
+
description = description.strip
|
40
|
+
description = description[0..max_length] + "..." if description.size > max_length
|
41
|
+
puts "%-#{longest}s # %s" % [task.fully_qualified_name, description]
|
42
|
+
end
|
43
|
+
puts "\n"
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-multiproject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Olek Poplavsky
|
@@ -49,6 +49,9 @@ files:
|
|
49
49
|
- Gemfile
|
50
50
|
- lib/capistrano/multiproject/configurations.rb
|
51
51
|
- lib/capistrano/multiproject/ensure.rb
|
52
|
+
- lib/capistrano/multiproject/filter_roles.rb
|
53
|
+
- lib/capistrano/multiproject/any_server_role.rb
|
54
|
+
- lib/capistrano/multiproject/task_list.rb
|
52
55
|
- lib/capistrano/multiproject.rb
|
53
56
|
- Rakefile
|
54
57
|
- README.md
|