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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba3d7f05bc363f6bde68a3499ac349554297e908
4
- data.tar.gz: 4b9e52b2e61dbf40f3af58357086bb9bafe6c1db
3
+ metadata.gz: 36bed9da6ba25bfdd86c18ec3de32295c847ed10
4
+ data.tar.gz: e8c372858270c7497f080251fd0ff42c0d1183be
5
5
  SHA512:
6
- metadata.gz: f73554edcfac13aee2be802f97d04357b795940ec552fefcae627a5fb8488148b608df5c187e6b06aaee8d8895a153f99c6f0a8023622711aca5458454689b5c
7
- data.tar.gz: 4c2eb3ca28d08d38057963cf0b0da384f4f020f7feeafade71c0edd7fe0bae85df6d113cdf89fd618eec0f7e5313a9615beb578dc38213dc4076926ad22b91cb
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"][nil]
140
+ eventbase = proxy.events["onEvent"]["cli"]
100
141
  eventbase.exec(context)
101
142
 
102
143
  end
@@ -1,4 +1,5 @@
1
1
  require 'ocular/dsl/etcd.rb'
2
2
  require 'ocular/dsl/fog.rb'
3
3
  require 'ocular/dsl/logging.rb'
4
- require 'ocular/dsl/ssh.rb'
4
+ require 'ocular/dsl/ssh.rb'
5
+ require 'ocular/dsl/orbit.rb'
@@ -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
@@ -13,6 +13,7 @@ class Ocular
13
13
  include Ocular::DSL::SSH
14
14
  include Ocular::DSL::Fog
15
15
  include Ocular::DSL::Etcd
16
+ include Ocular::DSL::Orbit
16
17
 
17
18
  def initialize
18
19
  @run_id = SecureRandom.uuid()
@@ -1,3 +1,3 @@
1
1
  class Ocular
2
- Version = "0.1.5"
2
+ Version = "0.1.6"
3
3
  end
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.5
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-14 00:00:00.000000000 Z
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