capistrano-multiproject 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +19 -0
- data/Rakefile +1 -0
- data/capistrano-multiproject.gemspec +35 -0
- data/lib/capistrano/multiproject.rb +5 -0
- data/lib/capistrano/multiproject/configurations.rb +55 -0
- data/lib/capistrano/multiproject/ensure.rb +22 -0
- metadata +89 -0
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
source "http://rubygems.org"
|
data/README.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# capistrano-multiproject
|
2
|
+
|
3
|
+
## Description
|
4
|
+
|
5
|
+
Capistrano extension that allows to deploy multiple projects from one location.
|
6
|
+
|
7
|
+
Everybody knows/uses original multistage extension written by Jamis Buck. It works great while you have only one project/app to deploy.
|
8
|
+
It is not quite enough if you have multiple projects to deploy (SOA would be one big use case here). Capistrano-multiproject solves this problem by allowing splitting up deploy.rb into multiple project-specific recipe files.
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
Install gem
|
13
|
+
|
14
|
+
$ gem install capistrano-multiproject
|
15
|
+
|
16
|
+
|
17
|
+
Add to `Capfile`
|
18
|
+
|
19
|
+
require 'capistrano/multiproject'
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "capistrano-multiproject"
|
5
|
+
s.version = "0.0.1"
|
6
|
+
s.authors = ["Olek Poplavsky"]
|
7
|
+
s.email = ["olek@woodenbits.com"]
|
8
|
+
s.homepage = "https://github.com/woodenbits/capistrano-multiproject"
|
9
|
+
s.date = '2012-01-26'
|
10
|
+
|
11
|
+
s.summary = 'Capistrano extension that allows to deploy multiple projects from one location'
|
12
|
+
s.description = %q{
|
13
|
+
Everybody knows/uses original multistage extension written by Jamis Buck. It works great while you have only one project/app to deploy.
|
14
|
+
It is not quite enough if you have multiple projects to deploy (SOA would be one big use case here). Capistrano-multiproject solves this problem by allowing splitting up deploy.rb into multiple project-specific recipe files.
|
15
|
+
}
|
16
|
+
s.require_paths = %w[lib]
|
17
|
+
|
18
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
19
|
+
s.extra_rdoc_files = %w[README.md]
|
20
|
+
|
21
|
+
## List your runtime dependencies here. Runtime dependencies are those
|
22
|
+
## that are needed for an end user to actually USE your code.
|
23
|
+
s.add_dependency('capistrano', "~> 2.9.0")
|
24
|
+
|
25
|
+
s.files = %w[
|
26
|
+
capistrano-multiproject.gemspec
|
27
|
+
Gemfile
|
28
|
+
lib/capistrano/multiproject/configurations.rb
|
29
|
+
lib/capistrano/multiproject/ensure.rb
|
30
|
+
lib/capistrano/multiproject.rb
|
31
|
+
Rakefile
|
32
|
+
README.md
|
33
|
+
]
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
|
3
|
+
def _cset(name, *args, &block)
|
4
|
+
unless exists?(name)
|
5
|
+
set(name, *args, &block)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
set(:application) { project }
|
10
|
+
|
11
|
+
_cset(:project_roles) { [project] }
|
12
|
+
|
13
|
+
# configurations root directory
|
14
|
+
config_root = File.expand_path(fetch(:config_root, "config/deploy"))
|
15
|
+
|
16
|
+
projects_dir = File.join(config_root, 'projects')
|
17
|
+
stages_dir = File.join(config_root, 'stages')
|
18
|
+
|
19
|
+
project_files = Dir["#{projects_dir}/*.rb"]
|
20
|
+
stage_files = Dir["#{stages_dir}/*.rb"]
|
21
|
+
|
22
|
+
hash_creating_block = lambda do |paths|
|
23
|
+
paths.inject({}) do |memo, path|
|
24
|
+
memo.merge path.sub(/^.*\/(.+)\.rb$/, '\1') => path
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
projects_hash = hash_creating_block.call(project_files)
|
29
|
+
stages_hash = hash_creating_block.call(stage_files)
|
30
|
+
|
31
|
+
# ensure that configuration segments don't override any method, task or namespace
|
32
|
+
overriding_tasks = (projects_hash.keys + stages_hash.keys) & all_methods
|
33
|
+
unless overriding_tasks.empty?
|
34
|
+
abort "Config task(s) #{overriding_tasks.inspect} override existing method/task/namespace"
|
35
|
+
end
|
36
|
+
|
37
|
+
task_creating_block = lambda do |kind, task_name, task_file|
|
38
|
+
desc "Load #{kind} #{task_name} configuration"
|
39
|
+
task(task_name, :multiproject => true, :kind => kind) do
|
40
|
+
top.set(kind, task_name)
|
41
|
+
top.load(:file => task_file)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
projects_hash.each do |task_name, task_file|
|
46
|
+
task_creating_block.call(:project, task_name, task_file)
|
47
|
+
end
|
48
|
+
|
49
|
+
stages_hash.each do |task_name, task_file|
|
50
|
+
task_creating_block.call(:stage, task_name, task_file)
|
51
|
+
end
|
52
|
+
|
53
|
+
set(:projects, projects_hash.keys)
|
54
|
+
set(:stages, stages_hash.keys)
|
55
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Capistrano::Configuration.instance.load do
|
2
|
+
namespace :multiproject do
|
3
|
+
desc "[internal] Ensure that project/stage has been selected"
|
4
|
+
task :ensure do
|
5
|
+
unless exists?(:stage)
|
6
|
+
warn "No stage configuration specified. Please specify one of:"
|
7
|
+
stages.each { |name| puts " * #{name}" }
|
8
|
+
warn "(e.g. 'cap #{stages.first} #{ARGV.last}')"
|
9
|
+
abort
|
10
|
+
end
|
11
|
+
|
12
|
+
unless exists?(:project)
|
13
|
+
warn "No project configuration specified. Please specify one of:"
|
14
|
+
projects.each { |name| puts " * #{name}" }
|
15
|
+
warn "(e.g. 'cap #{stage} #{projects.first} #{ARGV.last}')"
|
16
|
+
abort
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
on :start, 'multiproject:ensure', :except => (projects + stages + %w(?))
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-multiproject
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Olek Poplavsky
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-01-26 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: capistrano
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 43
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 9
|
32
|
+
- 0
|
33
|
+
version: 2.9.0
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: "\n\
|
37
|
+
Everybody knows/uses original multistage extension written by Jamis Buck. It works great while you have only one project/app to deploy.\n\
|
38
|
+
It is not quite enough if you have multiple projects to deploy (SOA would be one big use case here). Capistrano-multiproject solves this problem by allowing splitting up deploy.rb into multiple project-specific recipe files.\n "
|
39
|
+
email:
|
40
|
+
- olek@woodenbits.com
|
41
|
+
executables: []
|
42
|
+
|
43
|
+
extensions: []
|
44
|
+
|
45
|
+
extra_rdoc_files:
|
46
|
+
- README.md
|
47
|
+
files:
|
48
|
+
- capistrano-multiproject.gemspec
|
49
|
+
- Gemfile
|
50
|
+
- lib/capistrano/multiproject/configurations.rb
|
51
|
+
- lib/capistrano/multiproject/ensure.rb
|
52
|
+
- lib/capistrano/multiproject.rb
|
53
|
+
- Rakefile
|
54
|
+
- README.md
|
55
|
+
homepage: https://github.com/woodenbits/capistrano-multiproject
|
56
|
+
licenses: []
|
57
|
+
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options:
|
60
|
+
- --charset=UTF-8
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.8.13
|
85
|
+
signing_key:
|
86
|
+
specification_version: 3
|
87
|
+
summary: Capistrano extension that allows to deploy multiple projects from one location
|
88
|
+
test_files: []
|
89
|
+
|