mina-multi_server 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +41 -5
- data/mina-multi_server.gemspec +2 -1
- data/tasks/mina/multi_server/select.rb +20 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156403b3e7629f267233b946f5027a04aa339834
|
4
|
+
data.tar.gz: 8df9fbb7b178407c6d3e84afab6fa5925e70e8fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d471714bf72b91e93818206351f1f6f3413aa451acd81a082fc99ab70955c1e48b1871421f8de08d2727c07f58628367e732e6f4cc1bc1a6d2571ba251c2b7
|
7
|
+
data.tar.gz: 17c45fbb5a290568cd1732b1197af4c2e8d250ad97379caf69f33a2de09e31d07c3e9850b866ff2dd32f37c7edd87b0431b6e731eb5b9127c01996e82e406a5d
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ gem install mina-multi_server
|
|
14
14
|
## Usage
|
15
15
|
|
16
16
|
Set a `servers` array in your deploy.rb with the hostnames of the servers where
|
17
|
-
you want the tasks to be executed.
|
17
|
+
you want the tasks to be executed on.
|
18
18
|
|
19
19
|
When using `mina-multi_server`, there is no need to set a `domain` var as Mina
|
20
20
|
requires.
|
@@ -39,10 +39,46 @@ $ mina production deploy
|
|
39
39
|
|
40
40
|
## How it works
|
41
41
|
|
42
|
-
Each remote task will be executed for each server
|
43
|
-
to each
|
42
|
+
Each remote task will be executed for each server of `servers` array, setting
|
43
|
+
`ENV['domain']` to each server. Mina [checks][checks] ENV[`domain`] when fetching the
|
44
|
+
`domain` to be used by the task. Using the `ENV` keeps the `domain` var of Mina
|
45
|
+
untouched, so you can still use it for other task (such as `ssh`). In addition,
|
46
|
+
`ENV['domain']` is also restored to its previous value in case it was set.
|
44
47
|
|
45
|
-
For non-remote tasks, each task will be executed only once
|
46
|
-
not be used
|
48
|
+
For non-remote tasks, each task will be executed only once and `servers` var
|
49
|
+
will not be used.
|
47
50
|
|
48
51
|
Tasks will be executed one after the other, sequentially.
|
52
|
+
|
53
|
+
[checks]: https://github.com/mina-deploy/mina/blob/master/lib/mina/configuration.rb#L27
|
54
|
+
|
55
|
+
## Running tasks on a single server
|
56
|
+
|
57
|
+
Mina-multi_server includes a `select` task that lets you pick the server where you
|
58
|
+
want the task to be executed on. You just need to call it before the main task.
|
59
|
+
You will also need to require `mina/multi_server/select` in your deploy.rb.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
# deploy.rb
|
63
|
+
|
64
|
+
require 'mina/multi_server'
|
65
|
+
require 'mina/multi_server/select'
|
66
|
+
|
67
|
+
task :production do
|
68
|
+
set :servers, ['server-1.example.com', 'server-2.example.com']
|
69
|
+
end
|
70
|
+
|
71
|
+
# ...
|
72
|
+
```
|
73
|
+
|
74
|
+
```
|
75
|
+
$ mina production select ssh
|
76
|
+
|
77
|
+
Select server:
|
78
|
+
1. server-1.example.com
|
79
|
+
2. server-2.example.com
|
80
|
+
>
|
81
|
+
```
|
82
|
+
After you select an option, the `domain` var that Mina uses will be set to the
|
83
|
+
selected server. In addition, the `servers` array will be reduced to a
|
84
|
+
single-item array including only the selected server.
|
data/mina-multi_server.gemspec
CHANGED
@@ -5,8 +5,9 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.homepage = 'https://github.com/Juanmcuello/mina-multi_server'
|
6
6
|
s.license = 'MIT'
|
7
7
|
s.name = 'mina-multi_server'
|
8
|
+
s.require_paths = ['lib', 'tasks']
|
8
9
|
s.summary = 'Mina multi-server support'
|
9
|
-
s.version = '0.0.
|
10
|
+
s.version = '0.0.3'
|
10
11
|
|
11
12
|
s.add_dependency 'mina', '~> 1.0'
|
12
13
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
task :select do
|
2
|
+
ensure!(:servers)
|
3
|
+
puts 'Select server:'
|
4
|
+
|
5
|
+
fetch(:servers).each_with_index do |item, index|
|
6
|
+
puts "#{index + 1}. #{item}"
|
7
|
+
end
|
8
|
+
print '> '
|
9
|
+
|
10
|
+
begin
|
11
|
+
exit 1 unless (result = STDIN.gets.to_i) > 0
|
12
|
+
exit 1 unless (server = fetch(:servers)[result - 1])
|
13
|
+
|
14
|
+
set :domain, server
|
15
|
+
set :servers, [server]
|
16
|
+
rescue Interrupt
|
17
|
+
print "\n"
|
18
|
+
exit 1
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mina-multi_server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Manuel Cuello
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mina
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- README.md
|
35
35
|
- lib/mina/multi_server.rb
|
36
36
|
- mina-multi_server.gemspec
|
37
|
+
- tasks/mina/multi_server/select.rb
|
37
38
|
homepage: https://github.com/Juanmcuello/mina-multi_server
|
38
39
|
licenses:
|
39
40
|
- MIT
|
@@ -42,6 +43,7 @@ post_install_message:
|
|
42
43
|
rdoc_options: []
|
43
44
|
require_paths:
|
44
45
|
- lib
|
46
|
+
- tasks
|
45
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
48
|
requirements:
|
47
49
|
- - ">="
|
@@ -54,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
56
|
version: '0'
|
55
57
|
requirements: []
|
56
58
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.6.11
|
58
60
|
signing_key:
|
59
61
|
specification_version: 4
|
60
62
|
summary: Mina multi-server support
|