bcome 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/bcome +6 -101
- data/bin/boot.rb +108 -0
- data/lib/bcome.rb +0 -2
- data/lib/bcome/version.rb +1 -1
- data/lib/boot.rb +9 -0
- data/lib/helpers/environment_ssh.rb +4 -0
- data/lib/nodes/instance.rb +0 -1
- data/lib/stack/base.rb +1 -1
- data/lib/stack/instance.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65790bceb47d5870e33e4879362c00a154a06326
|
4
|
+
data.tar.gz: 2f940a8ee313e71752f66ed852048b3d48c6ad46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb5e1c75221c5145890bae1c75112e82d8ff6ccdfa2b078bf7a7eb15f01230aeafdb9f8c4fe33458b36fb0f25669a49e2e4a807c84a8db476ea0b0b6783f36ba
|
7
|
+
data.tar.gz: 2c96b8e049ad3b1c18562670a9ed5fb419ce362572a442cc8ec96b4be9ffcaeded6cc9ed0e630afa22dd9e0c4beac041b05d72db8b5d3e44162d2b81f15b66a6
|
data/bin/bcome
CHANGED
@@ -3,109 +3,14 @@
|
|
3
3
|
# (C) Guillaume Roderick (webzakimbo)
|
4
4
|
# MIT licence.
|
5
5
|
|
6
|
+
## Load & Boot into namespace
|
7
|
+
require 'irb'
|
8
|
+
require "irb/completion"
|
6
9
|
require 'bcome'
|
7
|
-
Dir[Dir.pwd + "/bcome/patches/**/*.rb"].each {|file| load file }
|
8
10
|
|
9
|
-
|
10
|
-
START_PROMPT = "bcome"
|
11
|
-
|
12
|
-
# The ssh_mode identifier in platforms.yml signifying that this platform is to be accessed via an SSH bastion machine
|
13
|
-
SSH_JUMP_MODE_IDENTIFIER = "jump"
|
14
|
-
|
15
|
-
# The ssh mode identifier in platforms.yml signifying that this platform is to be accessed directly
|
16
|
-
SSH_DIRECT_MODE_IDENTIFIER = "direct"
|
17
|
-
|
18
|
-
# The SSH role in instances.yml signifying that an instance is an SSJ jump host
|
19
|
-
SSH_JUMP_HOST_ROLE_IDENTIFIER = "sshjumphost"
|
20
|
-
|
21
|
-
## The base resource classes - may be overriden
|
22
|
-
PLATFORM_STACK_KLASS = ::Bcome::Stack::Platform
|
23
|
-
ENV_STACK_KLASS = ::Bcome::Stack::Environment
|
24
|
-
INSTANCE_STACK_KLASS = ::Bcome::Stack::Instance
|
25
|
-
|
26
|
-
##################
|
27
|
-
## DEPENDENCIES ##
|
28
|
-
##################
|
29
|
-
|
30
|
-
## Filters are loaded lower down as modules, and hence need to be include first
|
31
|
-
Dir[Dir.pwd + "/bcome/filters/**/*.rb"].each {|file| load file }
|
32
|
-
|
33
|
-
quick_contexts = []
|
34
|
-
|
35
|
-
BECOME = ::Bcome::WorkspaceContext.new
|
36
|
-
ESTATE = ::Bcome::Stack::Estate.new
|
37
|
-
RENDER = ::Bcome::RenderIrb.new
|
38
|
-
|
39
|
-
###########################
|
40
|
-
## MANAGE QUICK CONTEXTS #
|
41
|
-
###########################
|
42
|
-
if ARGV[0]
|
43
|
-
quick_context = ARGV[0]
|
44
|
-
quick_context =~ /(.+):(.+)/
|
45
|
-
platform_key = $1
|
46
|
-
context_reference = $2
|
47
|
-
|
48
|
-
unless platform_key && context_reference
|
49
|
-
puts "Quick context is missing platform key or the context reference".failure
|
50
|
-
exit 1
|
51
|
-
end
|
52
|
-
|
53
|
-
unless platform = ESTATE.resource_for_identifier(platform_key)
|
54
|
-
puts "Cannot find platform named #{platform_key}".failure
|
55
|
-
exit
|
56
|
-
end
|
57
|
-
|
58
|
-
unless platform.has_quick_contexts? && (context = platform.quick_context_for_reference(context_reference))
|
59
|
-
puts "No quick context found on platform #{platform_key} for reference #{context_reference}".failure
|
60
|
-
exit
|
61
|
-
end
|
62
|
-
|
63
|
-
quick_contexts = context[:keys]
|
64
|
-
end
|
65
|
-
|
66
|
-
####################
|
67
|
-
## BASIC IRB SETUP #
|
68
|
-
####################
|
69
|
-
IRB.setup nil
|
70
|
-
IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
|
71
|
-
|
72
|
-
#########################
|
73
|
-
## QUICK CONTEXT & BOOT #
|
74
|
-
#########################
|
75
|
-
|
76
|
-
context_object = ESTATE
|
77
|
-
|
78
|
-
if quick_contexts.any?
|
79
|
-
|
80
|
-
is_first_context = true
|
81
|
-
|
82
|
-
spawn = false
|
83
|
-
quick_contexts.each do |resource_context_key|
|
84
|
-
next_context_resource = context_object.resource_for_identifier(resource_context_key)
|
85
|
-
|
86
|
-
# Initialize our object namespace, but only from our lowest level namespace object. This
|
87
|
-
# ensure we don't load more than we need.
|
88
|
-
if is_first_context
|
89
|
-
next_context_resource.init
|
90
|
-
is_first_context = false
|
91
|
-
end
|
92
|
-
|
93
|
-
if next_context_resource.nil?
|
94
|
-
puts "Cannot find any resources object named: #{resource_context_key}. Please check your quick contexts and try again".failure
|
95
|
-
exit
|
96
|
-
end
|
97
|
-
|
98
|
-
BECOME.set(next_context_resource, context_object, spawn)
|
99
|
-
context_object = next_context_resource
|
100
|
-
end
|
101
|
-
else
|
102
|
-
ESTATE.init
|
103
|
-
end
|
104
|
-
|
105
|
-
##################
|
106
|
-
## INIT SESSION ##
|
107
|
-
##################
|
11
|
+
load Bcome::Boot.boot_path
|
108
12
|
|
13
|
+
## Load the shell
|
109
14
|
require 'irb/ext/multi-irb'
|
110
15
|
IRB.parse_opts_with_ignoring_script
|
111
|
-
IRB.irb nil, context_object
|
16
|
+
IRB.irb nil, @context_object
|
data/bin/boot.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
|
2
|
+
### Boot up bcome - used by the shell & exterior bcome processes
|
3
|
+
|
4
|
+
unless @no_shell
|
5
|
+
Dir[Dir.pwd + "/bcome/patches/**/*.rb"].each {|file| load file }
|
6
|
+
end
|
7
|
+
|
8
|
+
VERBOSE = true
|
9
|
+
START_PROMPT = "bcome"
|
10
|
+
|
11
|
+
# The ssh_mode identifier in platforms.yml signifying that this platform is to be accessed via an SSH bastion machine
|
12
|
+
SSH_JUMP_MODE_IDENTIFIER = "jump"
|
13
|
+
|
14
|
+
# The ssh mode identifier in platforms.yml signifying that this platform is to be accessed directly
|
15
|
+
SSH_DIRECT_MODE_IDENTIFIER = "direct"
|
16
|
+
|
17
|
+
# The SSH role in instances.yml signifying that an instance is an SSJ jump host
|
18
|
+
SSH_JUMP_HOST_ROLE_IDENTIFIER = "sshjumphost"
|
19
|
+
|
20
|
+
## The base resource classes - may be overriden
|
21
|
+
PLATFORM_STACK_KLASS = ::Bcome::Stack::Platform
|
22
|
+
ENV_STACK_KLASS = ::Bcome::Stack::Environment
|
23
|
+
INSTANCE_STACK_KLASS = ::Bcome::Stack::Instance
|
24
|
+
|
25
|
+
##################
|
26
|
+
## DEPENDENCIES ##
|
27
|
+
##################
|
28
|
+
|
29
|
+
## Filters are loaded lower down as modules, and hence need to be include first
|
30
|
+
Dir[Dir.pwd + "/bcome/filters/**/*.rb"].each {|file| load file }
|
31
|
+
|
32
|
+
quick_contexts = []
|
33
|
+
|
34
|
+
BECOME = ::Bcome::WorkspaceContext.new
|
35
|
+
ESTATE = ::Bcome::Stack::Estate.new
|
36
|
+
RENDER = ::Bcome::RenderIrb.new
|
37
|
+
|
38
|
+
###########################
|
39
|
+
## MANAGE QUICK CONTEXTS #
|
40
|
+
###########################
|
41
|
+
|
42
|
+
quick_context = @bcome_context ? @bcome_context : ARGV[0]
|
43
|
+
|
44
|
+
if quick_context
|
45
|
+
quick_context =~ /(.+):(.+)/
|
46
|
+
platform_key = $1
|
47
|
+
context_reference = $2
|
48
|
+
|
49
|
+
unless platform_key && context_reference
|
50
|
+
puts "Quick context is missing platform key or the context reference".failure
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
unless platform = ESTATE.resource_for_identifier(platform_key)
|
55
|
+
puts "Cannot find platform named #{platform_key}".failure
|
56
|
+
exit
|
57
|
+
end
|
58
|
+
|
59
|
+
unless platform.has_quick_contexts? && (context = platform.quick_context_for_reference(context_reference))
|
60
|
+
puts "No quick context found on platform #{platform_key} for reference #{context_reference}".failure
|
61
|
+
exit
|
62
|
+
end
|
63
|
+
|
64
|
+
quick_contexts = context[:keys]
|
65
|
+
end
|
66
|
+
|
67
|
+
#########################
|
68
|
+
## QUICK CONTEXT & BOOT #
|
69
|
+
#########################
|
70
|
+
|
71
|
+
@context_object = ESTATE
|
72
|
+
|
73
|
+
unless @no_shell
|
74
|
+
IRB.setup nil
|
75
|
+
IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
|
76
|
+
end
|
77
|
+
|
78
|
+
if quick_contexts.any?
|
79
|
+
is_first_context = true
|
80
|
+
|
81
|
+
spawn = false
|
82
|
+
quick_contexts.each do |resource_context_key|
|
83
|
+
next_context_resource = @context_object.resource_for_identifier(resource_context_key)
|
84
|
+
|
85
|
+
# Initialize our object namespace, but only from our lowest level namespace object. This
|
86
|
+
# ensures that we don't load more than we need.
|
87
|
+
if is_first_context
|
88
|
+
next_context_resource.init
|
89
|
+
is_first_context = false
|
90
|
+
end
|
91
|
+
|
92
|
+
if next_context_resource.nil?
|
93
|
+
puts "Cannot find any resources object named: #{resource_context_key}. Please check your quick contexts and try again".failure
|
94
|
+
exit
|
95
|
+
end
|
96
|
+
|
97
|
+
unless @no_shell
|
98
|
+
BECOME.set(next_context_resource, @context_object, spawn)
|
99
|
+
end
|
100
|
+
|
101
|
+
@context_object = next_context_resource
|
102
|
+
end
|
103
|
+
|
104
|
+
B_PIN = @context_object
|
105
|
+
B_PIN.init
|
106
|
+
else
|
107
|
+
ESTATE.init
|
108
|
+
end
|
data/lib/bcome.rb
CHANGED
data/lib/bcome/version.rb
CHANGED
data/lib/boot.rb
ADDED
data/lib/nodes/instance.rb
CHANGED
data/lib/stack/base.rb
CHANGED
data/lib/stack/instance.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.0.
|
4
|
+
version: 0.0.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: 2015-11-
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -114,6 +114,7 @@ extra_rdoc_files: []
|
|
114
114
|
files:
|
115
115
|
- bin/bcome
|
116
116
|
- bin/bcome-setup
|
117
|
+
- bin/boot.rb
|
117
118
|
- documentation/configuration.md
|
118
119
|
- documentation/examples/functions.yml-example
|
119
120
|
- documentation/examples/network.yml-example
|
@@ -125,6 +126,7 @@ files:
|
|
125
126
|
- lib/bcome.rb
|
126
127
|
- lib/bcome/version.rb
|
127
128
|
- lib/become_object.rb
|
129
|
+
- lib/boot.rb
|
128
130
|
- lib/command.rb
|
129
131
|
- lib/filters/base.rb
|
130
132
|
- lib/filters/ec2_filter.rb
|