ocular 0.1.5 → 0.1.6
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/ocular +43 -2
- data/lib/ocular/dsl/dsl.rb +2 -1
- data/lib/ocular/dsl/orbit.rb +32 -0
- data/lib/ocular/dsl/runcontext.rb +1 -0
- data/lib/ocular/version.rb +1 -1
- 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: 36bed9da6ba25bfdd86c18ec3de32295c847ed10
|
4
|
+
data.tar.gz: e8c372858270c7497f080251fd0ff42c0d1183be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b29306534a2ddc5947988858f4b0330468f501fa09374158ad8c1dc86894619e2a626c0242d52759fa4e8ed316e9b0de9b4020aaf1d16012d5bf5d026bd31206
|
7
|
+
data.tar.gz: 3c4b7a4a81cdc76799616bf5e4e71fb3fd34f51ba4d0399dca67b0bb790dc838fe63494b159d5d15c1659f6d75cde6102142e661a2930d50fb286b788ed91058
|
data/bin/ocular
CHANGED
@@ -88,7 +88,48 @@ else
|
|
88
88
|
# Start shell mode
|
89
89
|
|
90
90
|
if ARGV.length == 0
|
91
|
-
puts "Missing script file to run. use -h to get more info"
|
91
|
+
puts "Missing script file to run, starting ocular interactive shell. use -h to get more info"
|
92
|
+
|
93
|
+
ARGV.clear
|
94
|
+
require 'irb'
|
95
|
+
IRB.setup nil
|
96
|
+
|
97
|
+
IRB.conf[:PROMPT] = {}
|
98
|
+
IRB.conf[:IRB_NAME] = 'ocular'
|
99
|
+
IRB.conf[:PROMPT][:MY_PROJECT] = {
|
100
|
+
:PROMPT_I => '%N:%03n:%i> ',
|
101
|
+
:PROMPT_N => '%N:%03n:%i> ',
|
102
|
+
:PROMPT_S => '%N:%03n:%i%l ',
|
103
|
+
:PROMPT_C => '%N:%03n:%i* ',
|
104
|
+
:RETURN => "# => %s\n"
|
105
|
+
}
|
106
|
+
IRB.conf[:PROMPT_MODE] = :MY_PROJECT
|
107
|
+
|
108
|
+
IRB.conf[:RC] = false
|
109
|
+
|
110
|
+
require 'irb/completion'
|
111
|
+
require 'irb/ext/save-history'
|
112
|
+
IRB.conf[:READLINE] = true
|
113
|
+
IRB.conf[:SAVE_HISTORY] = 1000
|
114
|
+
IRB.conf[:HISTORY_FILE] = '~/.ocular_history'
|
115
|
+
|
116
|
+
context = Ocular::DSL::RunContext.new
|
117
|
+
|
118
|
+
irb = IRB::Irb.new(IRB::WorkSpace.new(context))
|
119
|
+
IRB.conf[:MAIN_CONTEXT] = irb.context
|
120
|
+
|
121
|
+
trap("SIGINT") do
|
122
|
+
IRB.irb.signal_handle
|
123
|
+
end
|
124
|
+
|
125
|
+
begin
|
126
|
+
catch(:IRB_EXIT) do
|
127
|
+
irb.eval_input
|
128
|
+
end
|
129
|
+
ensure
|
130
|
+
IRB.irb_at_exit
|
131
|
+
end
|
132
|
+
|
92
133
|
exit
|
93
134
|
end
|
94
135
|
|
@@ -96,7 +137,7 @@ else
|
|
96
137
|
proxy = ef.load_from_file(ARGV.shift)
|
97
138
|
|
98
139
|
context = Ocular::DSL::RunContext.new
|
99
|
-
eventbase = proxy.events["onEvent"][
|
140
|
+
eventbase = proxy.events["onEvent"]["cli"]
|
100
141
|
eventbase.exec(context)
|
101
142
|
|
102
143
|
end
|
data/lib/ocular/dsl/dsl.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'etcd'
|
3
|
+
|
4
|
+
class Ocular
|
5
|
+
module DSL
|
6
|
+
module Orbit
|
7
|
+
|
8
|
+
class OrbitFunctions
|
9
|
+
def initialize(etcd)
|
10
|
+
@etcd = etcd
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_service_endpoints(service_name)
|
14
|
+
orbit_endpoints = []
|
15
|
+
endpoints = @etcd.get("/orbit/services/#{service_name}/endpoints").node.children
|
16
|
+
endpoints.each do |node|
|
17
|
+
ip = node.key.match(/.*endpoints.(.+?):.+/).captures[0]
|
18
|
+
orbit_endpoints << ip
|
19
|
+
end
|
20
|
+
|
21
|
+
return orbit_endpoints
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def orbit()
|
27
|
+
return OrbitFunctions.new(etcd())
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
data/lib/ocular/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocular
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juho Mäkinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rye
|
@@ -146,6 +146,7 @@ files:
|
|
146
146
|
- lib/ocular/dsl/etcd.rb
|
147
147
|
- lib/ocular/dsl/fog.rb
|
148
148
|
- lib/ocular/dsl/logging.rb
|
149
|
+
- lib/ocular/dsl/orbit.rb
|
149
150
|
- lib/ocular/dsl/runcontext.rb
|
150
151
|
- lib/ocular/dsl/ssh.rb
|
151
152
|
- lib/ocular/event/eventbase.rb
|