bcome 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bcome/version.rb +1 -1
- data/lib/context_functions.rb +6 -8
- data/lib/orchestrator/loader.rb +4 -3
- data/lib/orchestrator/registry.rb +37 -0
- data/lib/render_irb.rb +2 -0
- data/lib/stack/base.rb +6 -6
- data/lib/stack/environment.rb +0 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 613edda110e0f6d9a425088ae6d81ea97c085c27
|
4
|
+
data.tar.gz: f589219de99e684a05e8381ec4b4c1955c8f54b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcb9cd3d9bfff842663a09f0e702ce7acf40f31022360727dde257f9f22190fde6a148f28e7976a2acf5ee9bf1b4ec53e39290f902b7cf7ddcd2c61f261af3d
|
7
|
+
data.tar.gz: 38e06ddb8491f634c6fe5472e8f6a5ae30c2169819ea15ea108166ebc946999c20338458bccfed7e583d3cc5184237891aa514e5f14752e75ed467b39a9b7e8b
|
data/lib/bcome/version.rb
CHANGED
data/lib/context_functions.rb
CHANGED
@@ -18,17 +18,15 @@ module Bcome::ContextFunctions
|
|
18
18
|
|
19
19
|
def context_commands
|
20
20
|
if context_cmd_functions && context_cmd_functions.any?
|
21
|
-
|
21
|
+
description = "\n\s\s" + "Context Commands".menu_title_green + "\n"
|
22
22
|
context_cmd_functions.each_with_index do |context_function, index|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
description += "\n\s\s\s#{index+1}. #{context_function[:description].menu_item_green}"
|
24
|
+
description += "\n\s\s\sExecuted command:".menu_item_cyan + "\s#{context_function[:executed_command]} bcome_context=\"#{context_breadcrumb}\""
|
25
|
+
description += "\n\s\s\sUsage:".menu_item_cyan + "\s#{context_function[:command].command}"
|
26
|
+
description += "\n"
|
27
27
|
end
|
28
|
-
else
|
29
|
-
puts "You don't have any context specific functions defined yet."
|
30
28
|
end
|
31
|
-
return
|
29
|
+
return description
|
32
30
|
end
|
33
31
|
|
34
32
|
def context_cmd_functions
|
data/lib/orchestrator/loader.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
module Bcome::Orchestrator
|
2
2
|
class Loader
|
3
3
|
|
4
|
-
def initialize(machines)
|
4
|
+
def initialize(machines, registry_for_context)
|
5
5
|
config_path = "#{Dir.pwd}/bcome/config/orchestration"
|
6
|
-
@recipes_path = "#{config_path}/
|
6
|
+
@recipes_path = "#{config_path}/recipes.yml"
|
7
7
|
@machine_targets_path = "#{config_path}/node_target_selectors.yml"
|
8
8
|
@direct_commands_path = "#{config_path}/direct_command_sets.yml"
|
9
9
|
@machines = machines
|
10
|
+
@registry_for_context = registry_for_context
|
10
11
|
end
|
11
12
|
|
12
13
|
def recipes
|
@@ -22,7 +23,7 @@ module Bcome::Orchestrator
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def do_load_recipes
|
25
|
-
return json_from_file(@recipes_path)
|
26
|
+
return json_from_file(@recipes_path).select{|r| @registry_for_context.include?(r[:recipe_identifier]) }
|
26
27
|
end
|
27
28
|
|
28
29
|
def do_load_direct_commands
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Bcome::Orchestrator::Registry
|
2
|
+
|
3
|
+
CONFIGS_PATH = "bcome/config/orchestration"
|
4
|
+
|
5
|
+
def do_load_recipes
|
6
|
+
return [] unless config_for_registry.any?
|
7
|
+
::Bcome::Orchestrator::Loader.new(machines, config_for_registry).recipes
|
8
|
+
end
|
9
|
+
|
10
|
+
def config_for_registry
|
11
|
+
return [] unless has_registry_config?
|
12
|
+
|
13
|
+
matching_keys = []
|
14
|
+
recipe_registry.keys.each {|registry_key|
|
15
|
+
matching_keys << registry_key if /^#{registry_key}$/.match(context_breadcrumb)
|
16
|
+
}
|
17
|
+
|
18
|
+
return matching_keys.collect{|registry_key| recipe_registry[registry_key] }.flatten
|
19
|
+
end
|
20
|
+
|
21
|
+
def recipe_registry
|
22
|
+
load_recipe_registry
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_recipe_registry
|
26
|
+
return YAML.load_file(registry_configs_path)
|
27
|
+
end
|
28
|
+
|
29
|
+
def registry_configs_path
|
30
|
+
"#{CONFIGS_PATH}/registry.yml"
|
31
|
+
end
|
32
|
+
|
33
|
+
def has_registry_config?
|
34
|
+
File.exist?(registry_configs_path)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/lib/render_irb.rb
CHANGED
data/lib/stack/base.rb
CHANGED
@@ -3,6 +3,7 @@ module ::Bcome::Stack
|
|
3
3
|
|
4
4
|
include ::Bcome::ContextFunctions
|
5
5
|
include ::Bcome::CommandHelper
|
6
|
+
include ::Bcome::Orchestrator::Registry
|
6
7
|
|
7
8
|
def machines
|
8
9
|
node.machines
|
@@ -12,12 +13,12 @@ module ::Bcome::Stack
|
|
12
13
|
## Construction & Initialisation
|
13
14
|
##
|
14
15
|
|
15
|
-
def
|
16
|
-
@
|
16
|
+
def recipes
|
17
|
+
@recipes ||= do_load_recipes
|
17
18
|
end
|
18
19
|
|
19
|
-
def
|
20
|
-
|
20
|
+
def node
|
21
|
+
@node ||= construct_node
|
21
22
|
end
|
22
23
|
|
23
24
|
def method_missing(method_sym, *arguments, &block)
|
@@ -93,8 +94,7 @@ module ::Bcome::Stack
|
|
93
94
|
{ :command => "exit", :description => "Return to the previous context" },
|
94
95
|
{ :command => "exit!", :description => "Close all contexts, and exit Become."},
|
95
96
|
{ :command => "local", :description => "Execute a shell command on your local machine.", :usage => 'local "command"'},
|
96
|
-
{ :command => "machines", :description => "Return all servers below the current level to the console. These objects can be manipulated directly" }
|
97
|
-
{ :command => "context_commands", :description => "List all shell commands for invoking non-shell processes, in the current bcome context" },
|
97
|
+
{ :command => "machines", :description => "Return all servers below the current level to the console. These objects can be manipulated directly" }
|
98
98
|
]
|
99
99
|
end
|
100
100
|
|
data/lib/stack/environment.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.9
|
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-01-
|
11
|
+
date: 2016-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- lib/orchestrator/node_target/base.rb
|
159
159
|
- lib/orchestrator/node_target/single.rb
|
160
160
|
- lib/orchestrator/recipe.rb
|
161
|
+
- lib/orchestrator/registry.rb
|
161
162
|
- lib/orchestrator/validate_and_set.rb
|
162
163
|
- lib/patches/string.rb
|
163
164
|
- lib/render_irb.rb
|