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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e61e228388284a1c25fc8bad337517ad352605ba
4
- data.tar.gz: 9218065db179cde6a25821c06e27630f208523a9
3
+ metadata.gz: 8fb1ce6a65f9589590ea473bb909654a9ec070f0
4
+ data.tar.gz: bec4a857bee763b2069fffb81c5b3505959e0a5a
5
5
  SHA512:
6
- metadata.gz: b1bf987f68018ffe59ef021d3cb176e80814bb72ea82063e2aebbda6f7b4eef7d7ac568f10555a1162b47bb4dcfcbe95f6e716b38f0fc9b30275d30dd35af563
7
- data.tar.gz: 05820a0783ac9c81d009c3f2e5682829cf84b76c131ea852fc33dd972cf8974c5b064128c8378522a0d3ca39f14d11283fd8721c8570134fe2eb6394d5a59c47
6
+ metadata.gz: e0b93d3977bb5f815bce980bc1f857ea23710e67264456c90716ba86870f9382137ce348f622204ff07814ace81be7ae4d4b11fa5ff7129cba7baeeb9985d28d
7
+ data.tar.gz: 9eb775bd8b4f80121e4b45a8b800313469158e0c3ad24fe14097cf6b33178c7cc8cf41cc62ae06d690c7b192137749f2231f3e3fe83854100c8a980010ade145
@@ -8,35 +8,41 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- capistrano (3.4.0)
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 (~> 1.3)
17
+ sshkit (>= 1.9.0)
15
18
  colored (1.2)
16
- diff-lcs (1.2.5)
17
- i18n (0.7.0)
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 (3.0.1)
21
- rake (10.4.2)
22
- rake-compiler (0.9.2)
25
+ net-ssh (5.0.0)
26
+ rake (12.3.1)
27
+ rake-compiler (1.0.4)
23
28
  rake
24
- rspec (3.1.0)
25
- rspec-core (~> 3.1.0)
26
- rspec-expectations (~> 3.1.0)
27
- rspec-mocks (~> 3.1.0)
28
- rspec-core (3.1.7)
29
- rspec-support (~> 3.1.0)
30
- rspec-expectations (3.1.2)
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.1.0)
33
- rspec-mocks (3.1.3)
34
- rspec-support (~> 3.1.0)
35
- rspec-support (3.1.2)
36
- sshkit (1.8.1)
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.8.7.6)
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.10.6
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
  ~~~
@@ -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(:all)
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
- # hack for Capistrano v3.3+
92
- Capistrano::Configuration.env.send(:servers).send(:servers).select! do |srv|
93
- hosts.include?(srv.hostname)
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(:rails_env).to_s.bold.blue}"
9
+ puts "env: #{fetch(fetch(:host_menu_env_key)).to_s.bold.blue}"
8
10
  puts "branch: #{fetch(:branch).to_s.bold.green}"
9
- puts "server: #{roles(:all).map(&:hostname).join("\n ").red}"
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.1.3
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: 2015-12-05 00:00:00.000000000 Z
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.5.0
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