osp 0.3.0.pre.dev.1 → 0.3.0
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/Gemfile.lock +1 -1
- data/bin/osp +61 -45
- data/lib/osp/database.rb +11 -0
- data/lib/osp/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4c1c9cfa0c03b3bf0b9d49993c599d977ca17fb
|
4
|
+
data.tar.gz: 71bddbe633aedc04160f3743a10841ce3b2b1e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56dcef1066c82389ec100152a834c79bb16351731e1871d298a7407da1669be36a001a3ec1b97b222e526f68185b9702f272bc82f6c5032bbb38b856829ece08
|
7
|
+
data.tar.gz: 325c774f4eb87ec8c955a3a1ba45797c8fcd44375ac1fa2fbebd474ecbcc0052ef2eb87f048284cedbad3d89acbf95f5928914f0561f537a1e19432bef7ff0d0
|
data/Gemfile.lock
CHANGED
data/bin/osp
CHANGED
@@ -60,7 +60,7 @@ puts 'Password: *****'
|
|
60
60
|
puts
|
61
61
|
|
62
62
|
@osp_class = TheFox::OSP::OSP
|
63
|
-
|
63
|
+
#@osp_class = TheFox::OSP::OSPDev
|
64
64
|
|
65
65
|
printf "Calculating base hash: #{@osp_class::HASHES_N} (#{@osp_class::HASHES_EXP}-bit) - please wait ..."
|
66
66
|
@osp = @osp_class.new(email, password)
|
@@ -212,22 +212,25 @@ while true
|
|
212
212
|
index = 1
|
213
213
|
if found_hosts.count > 1
|
214
214
|
index = @cli.ask('Show host, select by number: ', Integer){ |q|
|
215
|
-
q.character = true if found_hosts.count < 10
|
216
|
-
q.in = 1..(found_hosts.count) }.to_i
|
215
|
+
q.character = true if found_hosts.count < 10 }.to_i
|
217
216
|
puts
|
218
217
|
end
|
219
218
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
219
|
+
if index >= 1 && index <= found_hosts.count
|
220
|
+
puts "Host ##{index} selected:"
|
221
|
+
index -= 1
|
222
|
+
selected_host = nil
|
223
|
+
begin
|
224
|
+
selected_host = found_hosts.values[index]
|
225
|
+
rescue Exception => e
|
226
|
+
puts "ERROR: #{e}"
|
227
|
+
end
|
228
|
+
|
229
|
+
if !selected_host.nil?
|
230
|
+
host_show(selected_host)
|
231
|
+
end
|
232
|
+
else
|
233
|
+
puts 'Abort.'
|
231
234
|
end
|
232
235
|
else
|
233
236
|
puts 'No hosts found.'
|
@@ -238,25 +241,28 @@ while true
|
|
238
241
|
index = 1
|
239
242
|
if found_hosts.count > 1
|
240
243
|
index = @cli.ask('Edit, select host by number: ', Integer){ |q|
|
241
|
-
q.character = true if found_hosts.count < 10
|
242
|
-
q.in = 1..(found_hosts.count) }.to_i
|
244
|
+
q.character = true if found_hosts.count < 10 }.to_i
|
243
245
|
puts
|
244
246
|
end
|
245
247
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
if !selected_host.nil?
|
256
|
-
host_edit(selected_host)
|
257
|
-
host_show(selected_host, true)
|
248
|
+
if index >= 1 && index <= found_hosts.count
|
249
|
+
puts "Host ##{index} selected:"
|
250
|
+
index -= 1
|
251
|
+
selected_host = nil
|
252
|
+
begin
|
253
|
+
selected_host = found_hosts.values[index].clone
|
254
|
+
rescue Exception => e
|
255
|
+
puts "ERROR: #{e}"
|
256
|
+
end
|
258
257
|
|
259
|
-
|
258
|
+
if !selected_host.nil?
|
259
|
+
host_edit(selected_host)
|
260
|
+
host_show(selected_host, true)
|
261
|
+
|
262
|
+
@database.add_host(selected_host)
|
263
|
+
end
|
264
|
+
else
|
265
|
+
puts 'Abort.'
|
260
266
|
end
|
261
267
|
else
|
262
268
|
puts 'No hosts found.'
|
@@ -267,22 +273,30 @@ while true
|
|
267
273
|
index = 1
|
268
274
|
if found_hosts.count > 1
|
269
275
|
index = @cli.ask('Delete, select host by number: ', Integer){ |q|
|
270
|
-
q.character = true if found_hosts.count < 10
|
271
|
-
q.in = 1..(found_hosts.count) }.to_i
|
276
|
+
q.character = true if found_hosts.count < 10 }.to_i
|
272
277
|
puts
|
273
278
|
end
|
274
279
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
280
|
+
if index >= 1 && index <= found_hosts.count
|
281
|
+
puts "Delete host ##{index}."
|
282
|
+
index -= 1
|
283
|
+
selected_host = nil
|
284
|
+
begin
|
285
|
+
selected_host = found_hosts.values[index]
|
286
|
+
rescue Exception => e
|
287
|
+
puts "ERROR: #{e}"
|
288
|
+
end
|
289
|
+
|
290
|
+
if !selected_host.nil?
|
291
|
+
if @database.remove_host(selected_host)
|
292
|
+
found_hosts.delete(selected_host.name)
|
293
|
+
puts "Host '#{selected_host.name}' deleted."
|
294
|
+
else
|
295
|
+
puts "ERROR: Can't delete host '#{selected_host.name}'."
|
296
|
+
end
|
297
|
+
end
|
298
|
+
else
|
299
|
+
puts 'Abort.'
|
286
300
|
end
|
287
301
|
else
|
288
302
|
puts 'No hosts found.'
|
@@ -296,7 +310,7 @@ while true
|
|
296
310
|
puts "\tl - List found hosts."
|
297
311
|
puts "\ti - Print informations about a host found by a search."
|
298
312
|
puts "\te - Edit a host found by search."
|
299
|
-
|
313
|
+
puts "\td - Delete a host found by search."
|
300
314
|
puts "\tq - Quit search."
|
301
315
|
puts "\t? - Print help."
|
302
316
|
else
|
@@ -306,7 +320,7 @@ while true
|
|
306
320
|
next if search_actions.count > 0
|
307
321
|
|
308
322
|
puts
|
309
|
-
search_actions << @cli.ask('[
|
323
|
+
search_actions << @cli.ask('[sliedq?] >> '){ |q| q.character = true }.downcase
|
310
324
|
end
|
311
325
|
when 'x'
|
312
326
|
actions << 'q'
|
@@ -326,12 +340,14 @@ while true
|
|
326
340
|
actions << 'x'
|
327
341
|
else
|
328
342
|
really = @cli.ask('Really? [yN] ', String){ |q| q.character = true }.strip.downcase
|
329
|
-
really = '
|
343
|
+
really = 'n' if really == ''
|
330
344
|
puts "Answer: '#{really}'"
|
331
345
|
|
332
346
|
if really == 'y'
|
333
347
|
@database.has_changed = false
|
334
348
|
actions << 'q'
|
349
|
+
else
|
350
|
+
puts 'Qutting aborted.'
|
335
351
|
end
|
336
352
|
end
|
337
353
|
else
|
data/lib/osp/database.rb
CHANGED
@@ -160,6 +160,17 @@ module TheFox
|
|
160
160
|
@has_changed = true
|
161
161
|
end
|
162
162
|
|
163
|
+
def remove_host(host)
|
164
|
+
if @data['hosts'].has_key?(host.name)
|
165
|
+
@data['hosts'].delete(host.name)
|
166
|
+
update
|
167
|
+
@has_changed = true
|
168
|
+
true
|
169
|
+
else
|
170
|
+
false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
163
174
|
end
|
164
175
|
|
165
176
|
end
|
data/lib/osp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: osp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Mayer
|
@@ -123,9 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: 2.1.0
|
124
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
|
-
- - "
|
126
|
+
- - ">="
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
128
|
+
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
131
|
rubygems_version: 2.4.7
|