bcome 0.6.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bcome.rb +1 -1
- data/lib/bcome/version.rb +1 -1
- data/lib/interactive/session_item/transparent_ssh.rb +40 -9
- data/lib/patches/string.rb +3 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e854219fe3f3151e3beab00428c300540f1ca6
|
4
|
+
data.tar.gz: 5abe63e971b7994a35a5e45fe07a51f8f4ed657f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8031edcc26bff2f693e28fbe65a254569d12be4e8e1ea7c6329775bbfcb800014d35cff7e760f8c2f4bf07f7d4da9b6c57d232ac795bb5e097736ca9c4c1a002
|
7
|
+
data.tar.gz: 443b70d8c51e468f1658756e60e65c02bd7adf673a1aa3872f6a70be2675a02ca3189596bbe6b5464ab0f55db58b548d938741f9b6be3e1c2c07fec062946f09
|
data/lib/bcome.rb
CHANGED
data/lib/bcome/version.rb
CHANGED
@@ -4,7 +4,8 @@ module Bcome::Interactive::SessionItem
|
|
4
4
|
END_SESSION_KEY = "\\q"
|
5
5
|
HELP_KEY = "\\?"
|
6
6
|
LIST_KEY = "\\l"
|
7
|
-
|
7
|
+
|
8
|
+
DANGER_CMD = "rm\s+-r|rm\s+-f|rm\s+-fr|rm\s+-rf|rm"
|
8
9
|
def do
|
9
10
|
input = get_input
|
10
11
|
raise ::Bcome::Interactive::SessionHalt.new if exit?(input)
|
@@ -12,6 +13,8 @@ module Bcome::Interactive::SessionItem
|
|
12
13
|
show_menu
|
13
14
|
elsif list_machines?(input)
|
14
15
|
list_machines
|
16
|
+
elsif command_may_be_unwise?(input)
|
17
|
+
handle_the_unwise(input)
|
15
18
|
else
|
16
19
|
execute_on_machines(input)
|
17
20
|
end
|
@@ -22,11 +25,28 @@ module Bcome::Interactive::SessionItem
|
|
22
25
|
system("clear") ; print start_message
|
23
26
|
end
|
24
27
|
|
28
|
+
def handle_the_unwise(input)
|
29
|
+
if prompt_for_confirmation("Command may be dangerous to run on all machines. Are you sure you want to proceed? [Y|N] > ".danger)
|
30
|
+
execute_on_machines(input)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def command_may_be_unwise?(input)
|
35
|
+
input =~ /#{DANGER_CMD}/
|
36
|
+
end
|
37
|
+
|
38
|
+
def prompt_for_confirmation(message)
|
39
|
+
answer = get_input(message)
|
40
|
+
unless ["Y", "N"].include?(answer)
|
41
|
+
prompt_for_confirmation(message)
|
42
|
+
end
|
43
|
+
return answer == "Y" ? true : false
|
44
|
+
end
|
45
|
+
|
25
46
|
def start_message
|
26
|
-
warning = "\nCommands entered here will be executed on
|
27
|
-
second_warning = "\nUse with CAUTION.".danger
|
47
|
+
warning = "\nCommands entered here will be executed on EVERY machine in your selection.".danger
|
48
|
+
second_warning = "\n\nUse with CAUTION.".danger
|
28
49
|
info = "\n\n\\l list machines\n\\q to quit\n\\? this message".informational
|
29
|
-
|
30
50
|
return "#{warning}#{second_warning}#{info}\n"
|
31
51
|
end
|
32
52
|
|
@@ -51,8 +71,8 @@ module Bcome::Interactive::SessionItem
|
|
51
71
|
input == LIST_KEY
|
52
72
|
end
|
53
73
|
|
54
|
-
def get_input
|
55
|
-
return ::Readline.readline("\n#{
|
74
|
+
def get_input(message = terminal_prompt)
|
75
|
+
return ::Readline.readline("\n#{message}", true).squeeze(" " ).to_s
|
56
76
|
end
|
57
77
|
|
58
78
|
def execute_on_machines(user_input)
|
@@ -62,12 +82,23 @@ module Bcome::Interactive::SessionItem
|
|
62
82
|
end
|
63
83
|
|
64
84
|
def list_machines
|
65
|
-
|
66
|
-
|
85
|
+
puts "\n" + machines.collect {|m|
|
86
|
+
env = m.environment
|
87
|
+
platform = env.platform
|
88
|
+
"* #{platform.identifier.cyan}:#{env.identifier.orange}:#{m.identifier.yellow}"
|
89
|
+
}.join("\n")
|
67
90
|
end
|
68
91
|
|
69
92
|
def machines
|
70
|
-
@machines ||= has_selected_machines? ? selected_machines :
|
93
|
+
@machines ||= has_selected_machines? ? selected_machines : flat_list_of_machines
|
94
|
+
end
|
95
|
+
|
96
|
+
def flat_list_of_machines
|
97
|
+
resources.collect{|resource| resource.node.machines }.flatten
|
98
|
+
end
|
99
|
+
|
100
|
+
def resources
|
101
|
+
@irb_session.resources
|
71
102
|
end
|
72
103
|
|
73
104
|
def has_selected_machines?
|
data/lib/patches/string.rb
CHANGED
@@ -49,7 +49,9 @@ class String
|
|
49
49
|
:menu_title_cyan => { :colour => :cyan, :highlight => true },
|
50
50
|
:headsup => { :colour => :orange, :highlight => true },
|
51
51
|
:menu_item_magenta => { :colour => :magenta },
|
52
|
-
:cyan => { :colour => :cyan }
|
52
|
+
:cyan => { :colour => :cyan },
|
53
|
+
:yellow => { :colour => :yellow },
|
54
|
+
:orange => { :colour => :orange }
|
53
55
|
}
|
54
56
|
end
|
55
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guillaume Roderick (Webzakimbo)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -73,19 +73,19 @@ dependencies:
|
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '1.0'
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name: fog
|
76
|
+
name: fog-aws
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version:
|
81
|
+
version: 0.12.0
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
|
-
- -
|
86
|
+
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
88
|
+
version: 0.12.0
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: require_all
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.6.7
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Toolkit for managing machines - simplify your workflow.
|