-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_kb_wipe.rb
executable file
·40 lines (33 loc) · 905 Bytes
/
t_kb_wipe.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/bin/ruby
=begin
--------------------------------------------------------------------------------
Erase the KnowledgeBase
--------------------------------------------------------------------------------
=end
$: << File.dirname(File.expand_path(__FILE__))
require 'common'
#
# ---------------------------------------------------------
# MAIN ROUTINE
# ---------------------------------------------------------
#
begin
raise UserInputError.new("Stop tomcat first.") if $instance.tomcat.running?
begin
$instance.knowledge_base.confirm
rescue SettingsError
puts "Knowledge base does not exist: #{$instance.knowledge_base}."
puts "Create it? (y/n)"
raise UserInputError.new("OK") unless gets.chomp == 'y'
end
$instance.knowledge_base.erase
$instance.knowledge_base.create
rescue SettingsError
puts
puts $!
puts
rescue UserInputError
puts
puts $!
puts
end