capistrano-hostmenu 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -21
- data/README.md +2 -0
- data/lib/capistrano/hostmenu.rb +23 -4
- data/lib/capistrano/tasks/hostmenu.rake +6 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb1ce6a65f9589590ea473bb909654a9ec070f0
|
4
|
+
data.tar.gz: bec4a857bee763b2069fffb81c5b3505959e0a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b93d3977bb5f815bce980bc1f857ea23710e67264456c90716ba86870f9382137ce348f622204ff07814ace81be7ae4d4b11fa5ff7129cba7baeeb9985d28d
|
7
|
+
data.tar.gz: 9eb775bd8b4f80121e4b45a8b800313469158e0c3ad24fe14097cf6b33178c7cc8cf41cc62ae06d690c7b192137749f2231f3e3fe83854100c8a980010ade145
|
data/Gemfile.lock
CHANGED
@@ -8,35 +8,41 @@ PATH
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
11
|
+
airbrussh (1.3.0)
|
12
|
+
sshkit (>= 1.6.1, != 1.7.0)
|
13
|
+
capistrano (3.10.2)
|
14
|
+
airbrussh (>= 1.0.0)
|
12
15
|
i18n
|
13
16
|
rake (>= 10.0.0)
|
14
|
-
sshkit (
|
17
|
+
sshkit (>= 1.9.0)
|
15
18
|
colored (1.2)
|
16
|
-
|
17
|
-
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
diff-lcs (1.3)
|
21
|
+
i18n (1.0.1)
|
22
|
+
concurrent-ruby (~> 1.0)
|
18
23
|
net-scp (1.2.1)
|
19
24
|
net-ssh (>= 2.6.5)
|
20
|
-
net-ssh (
|
21
|
-
rake (
|
22
|
-
rake-compiler (0.
|
25
|
+
net-ssh (5.0.0)
|
26
|
+
rake (12.3.1)
|
27
|
+
rake-compiler (1.0.4)
|
23
28
|
rake
|
24
|
-
rspec (3.
|
25
|
-
rspec-core (~> 3.
|
26
|
-
rspec-expectations (~> 3.
|
27
|
-
rspec-mocks (~> 3.
|
28
|
-
rspec-core (3.1
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-expectations (3.
|
29
|
+
rspec (3.7.0)
|
30
|
+
rspec-core (~> 3.7.0)
|
31
|
+
rspec-expectations (~> 3.7.0)
|
32
|
+
rspec-mocks (~> 3.7.0)
|
33
|
+
rspec-core (3.7.1)
|
34
|
+
rspec-support (~> 3.7.0)
|
35
|
+
rspec-expectations (3.7.0)
|
31
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-mocks (3.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-mocks (3.7.0)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-support (3.7.1)
|
42
|
+
sshkit (1.16.1)
|
37
43
|
net-scp (>= 1.1.2)
|
38
44
|
net-ssh (>= 2.8.0)
|
39
|
-
yard (0.
|
45
|
+
yard (0.9.13)
|
40
46
|
|
41
47
|
PLATFORMS
|
42
48
|
ruby
|
@@ -50,4 +56,4 @@ DEPENDENCIES
|
|
50
56
|
yard
|
51
57
|
|
52
58
|
BUNDLED WITH
|
53
|
-
1.
|
59
|
+
1.11.2
|
data/README.md
CHANGED
@@ -57,4 +57,6 @@ set :host_menu_caption_of_all, 'all'
|
|
57
57
|
set :host_menu_caption_of_default, '(default)'
|
58
58
|
set :host_menu_invalid_range_msg, 'Please provide a number in (1..%d)'.red
|
59
59
|
set :host_menu_invalid_multi_choose_msg, 'Do you mean to choose all servers?'.red
|
60
|
+
set :host_menu_role_to_filter, :all
|
61
|
+
set :host_menu_env_key, :rails_env
|
60
62
|
~~~
|
data/lib/capistrano/hostmenu.rb
CHANGED
@@ -13,6 +13,8 @@ module Capistrano
|
|
13
13
|
set :host_menu_caption_of_default, '(default)'
|
14
14
|
set :host_menu_invalid_range_msg, 'Please provide a number in (1..%d)'.red
|
15
15
|
set :host_menu_invalid_multi_choose_msg, 'Do you mean to choose all servers?'.red
|
16
|
+
set :host_menu_role_to_filter, :all
|
17
|
+
set :host_menu_env_key, :rails_env
|
16
18
|
end
|
17
19
|
|
18
20
|
def initialize
|
@@ -60,7 +62,7 @@ module Capistrano
|
|
60
62
|
end
|
61
63
|
|
62
64
|
def deploy_hosts
|
63
|
-
release_roles(:
|
65
|
+
release_roles(fetch(:host_menu_role_to_filter))
|
64
66
|
end
|
65
67
|
|
66
68
|
def selection_for_all
|
@@ -88,10 +90,27 @@ module Capistrano
|
|
88
90
|
if defined? Capistrano::Configuration::Servers::HostFilter
|
89
91
|
set :filter, hosts: hosts
|
90
92
|
else
|
91
|
-
|
92
|
-
Capistrano::Configuration.env.
|
93
|
-
|
93
|
+
role = fetch(:host_menu_role_to_filter)
|
94
|
+
Capistrano::Configuration.env.add_filter Filter.new(hosts, role)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
class Filter < Struct.new(:hosts, :role)
|
100
|
+
def filter srv
|
101
|
+
if Array === srv
|
102
|
+
return srv.select {|s| filter(s)}
|
94
103
|
end
|
104
|
+
|
105
|
+
if role != :all and not srv.roles.include?(role)
|
106
|
+
return srv
|
107
|
+
end
|
108
|
+
|
109
|
+
if hosts.include? srv.hostname
|
110
|
+
return srv
|
111
|
+
end
|
112
|
+
|
113
|
+
return nil
|
95
114
|
end
|
96
115
|
end
|
97
116
|
|
@@ -2,11 +2,15 @@ namespace :deploy do
|
|
2
2
|
|
3
3
|
desc 'print environment variables'
|
4
4
|
task :info do
|
5
|
+
role = fetch(:host_menu_role_to_filter)
|
6
|
+
|
5
7
|
puts "--" * 50
|
6
8
|
puts "About to deploy, check your seatbelt~"
|
7
|
-
puts "env: #{fetch(:
|
9
|
+
puts "env: #{fetch(fetch(:host_menu_env_key)).to_s.bold.blue}"
|
8
10
|
puts "branch: #{fetch(:branch).to_s.bold.green}"
|
9
|
-
|
11
|
+
|
12
|
+
servers = Capistrano::Configuration.env.filter(roles(role))
|
13
|
+
puts "server: #{servers.map(&:hostname).join("\n ").red}"
|
10
14
|
puts "--" * 50
|
11
15
|
end
|
12
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-hostmenu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- qhwa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -143,9 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
requirements: []
|
145
145
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.6.11
|
147
147
|
signing_key:
|
148
148
|
specification_version: 4
|
149
149
|
summary: Capistrano plugin that prompt a text menu to choose target host.
|
150
150
|
test_files: []
|
151
|
-
has_rdoc: false
|