capistrano-deploy-all 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +40 -0
- data/bin/deploy_all +24 -0
- data/bin/deployment.rb +15 -0
- data/bin/rake_all +27 -0
- data/lib/capistrano-deploy-all/capistrano/tasks/invoke.rake +15 -0
- data/lib/capistrano-deploy-all/tasks.rb +1 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 19c6543f455dfc349183672adad8f1f63fcc03ff
|
4
|
+
data.tar.gz: 3dc45413dd235cae0ef27357257ddcf7936be366
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: df80d510265996bba5f37aa012d6cf5bf1a56bb30114c296a6fd8d528052bc42919ab3f2f8d98dcac63a0400a62853d47ac99be0a17edb16329ebca502e233b2
|
7
|
+
data.tar.gz: be88a2cbd2a2859d3d8c0be18cdc64a62d20cc329892204ca495a250ffc706d3764f7b5a9243293b5abe4faa7f63abc2249972ea2f0f99c828d1deaeb36a5ceb
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# capistrano-deploy-all
|
2
|
+
|
3
|
+
This Ruby gem provides the code to deploy a service or run a Rake task against
|
4
|
+
all environments using Capistrano.
|
5
|
+
|
6
|
+
The environments are going to be read based on the `/config/deploy/*.rb` files.
|
7
|
+
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Include `capistrano-deploy-all` in your project adding into your `Gemfile`:
|
12
|
+
|
13
|
+
```
|
14
|
+
gem "capistrano-deploy-all"
|
15
|
+
```
|
16
|
+
|
17
|
+
In order to run a Rake task against all environment you have to require the
|
18
|
+
Rake tasks from the gem in your project:
|
19
|
+
|
20
|
+
```
|
21
|
+
require "capistrano-deploy-all/tasks"
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
There are two interactive executables where you can select the environments
|
28
|
+
that you want to use:
|
29
|
+
- `bundle exec deploy_all` to deploy a service.
|
30
|
+
- `bundle exec rake_all` to run a Rake task.
|
31
|
+
|
32
|
+
Bundler can install binstubs for the executables:
|
33
|
+
|
34
|
+
```
|
35
|
+
bundle binstubs capistrano-deploy-all
|
36
|
+
```
|
37
|
+
|
38
|
+
This provides the executables in the `bin` directory of the project:
|
39
|
+
- `bin/deploy_all`
|
40
|
+
- `bin/rake_all`
|
data/bin/deploy_all
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "deployment"
|
4
|
+
include Deployment
|
5
|
+
|
6
|
+
if deployments.any?
|
7
|
+
puts "Project to be deployed to: #{deployments.join(", ")}"
|
8
|
+
puts "Are you sure? (Y/n): "
|
9
|
+
response = gets.strip
|
10
|
+
if response.empty? || response.downcase == "y"
|
11
|
+
succeeded = []
|
12
|
+
deployments.each do |deployment|
|
13
|
+
if system("#{File.join("bin", "cap")} #{deployment} deploy")
|
14
|
+
succeeded << deployment
|
15
|
+
else
|
16
|
+
puts "FAILED deploying to #{deployment}"
|
17
|
+
break
|
18
|
+
end
|
19
|
+
puts "Successfully deployed to #{succeeded.join(", ")}" if succeeded.any?
|
20
|
+
end
|
21
|
+
else
|
22
|
+
puts "Aborted."
|
23
|
+
end
|
24
|
+
end
|
data/bin/deployment.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Deployment
|
2
|
+
def deployments
|
3
|
+
@deployments ||= [].tap do |deployments|
|
4
|
+
Dir[File.join("config", "deploy", "*.rb")].each do |file|
|
5
|
+
deployment = file.split("/").last[0..-4]
|
6
|
+
next if deployment == "deployment"
|
7
|
+
puts "Include #{deployment}? (Y/n): "
|
8
|
+
response = gets.strip
|
9
|
+
if response.empty? || response.downcase == "y"
|
10
|
+
deployments << deployment
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/bin/rake_all
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative "deployment"
|
4
|
+
include Deployment
|
5
|
+
|
6
|
+
if deployments.any?
|
7
|
+
puts "What is the name of the Rake task you want to run?"
|
8
|
+
task = gets.strip
|
9
|
+
|
10
|
+
puts "Rake task to be ran against: #{deployments.join(", ")}"
|
11
|
+
puts "Are you sure? (Y/n): "
|
12
|
+
response = gets.strip
|
13
|
+
if response.empty? || response.downcase == "y"
|
14
|
+
succeeded = []
|
15
|
+
deployments.each do |deployment|
|
16
|
+
if system("#{File.join("bin", "cap")} #{deployment} invoke:rake task=#{task}")
|
17
|
+
succeeded << deployment
|
18
|
+
else
|
19
|
+
puts "FAILED running against #{deployment}"
|
20
|
+
break
|
21
|
+
end
|
22
|
+
puts "Successfully ran against #{succeeded.join(", ")}" if succeeded.any?
|
23
|
+
end
|
24
|
+
else
|
25
|
+
puts "Aborted."
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
namespace :invoke do
|
2
|
+
set :task, ENV["task"]
|
3
|
+
|
4
|
+
desc "Invoke Rake task"
|
5
|
+
task :rake do
|
6
|
+
on primary fetch(:migration_role) do
|
7
|
+
within "#{current_path}" do
|
8
|
+
with rails_env: fetch(:rails_env) do
|
9
|
+
exclude = Regexp.union([/\Adb:.+/, /\Aasset:.+/])
|
10
|
+
info(capture(:rake, fetch(:task))) unless fetch(:task).match(exclude)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Dir[File.join(__dir__, "**", "tasks", "*.rake")].each { |file| load file }
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-deploy-all
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Arturo Herrero
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Deploy a service or run a Rake task against all environments using Capistrano.
|
28
|
+
The environments are going to be read based on the /config/deploy/*.rb files
|
29
|
+
email: arturo.herrero@gmail.com
|
30
|
+
executables:
|
31
|
+
- deploy_all
|
32
|
+
- rake_all
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- README.md
|
37
|
+
- bin/deploy_all
|
38
|
+
- bin/deployment.rb
|
39
|
+
- bin/rake_all
|
40
|
+
- lib/capistrano-deploy-all/capistrano/tasks/invoke.rake
|
41
|
+
- lib/capistrano-deploy-all/tasks.rb
|
42
|
+
homepage: https://github.com/mydrive/capistrano-deploy-all
|
43
|
+
licenses:
|
44
|
+
- BSD 2-clause
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.2.0
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.4.5.2
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Deploy a service or run a Rake task against all environments
|
66
|
+
test_files: []
|