Class: TargetVoyager::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/nostos-target-voyager/generators/target_voyager_generator.rb

Instance Method Summary collapse

Instance Method Details

#configureObject



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
41
42
43
44
45
46
47
# File 'lib/nostos-target-voyager/generators/target_voyager_generator.rb', line 5

def configure
  # Ask DB Questions
  puts "Database Configuration:"
  puts "The following fields are required to establish a connection with your Voyager server."
  db = {}
  db[:database] = ask('database: [VGER]')
  db[:database] = 'VGER' if db[:database].blank?
  db[:username] = ask('username (e.g. ro_XXXDB): []')
  db[:password] = ask('password: []')

  # Ask SIP Questions
  puts "SIP Configuration:"
  sip = {}
  sip[:host] = ask('Host: []')
  sip[:port] = ask('Port: [7031]')
  sip[:port] = '7031' if sip[:port].blank?
  sip[:username] = ask('Username (the operator used to sign into SIP. This will determine the allowed privleges and will be the operator used for circulation transactions): []')
  sip[:password] = ask('Password: []')
  sip[:operator] = ask('Operator (the operator used to create short records. This overrides the operator used to sign in. It is recommended that you create a cataloging operator for this driver so that you can easily identify records created in your ILS): []')
  sip[:location] = ask('Location: []')

  # Configure application settings
  create_file File.join(Rails.root, 'config', 'target_voyager.yml'), <<CONFIG
# Target Voyager Configuration

# Database
db:
  adapter:  'oracle_enhanced'
  database: '#{db[:database]}'
  username: '#{db[:username]}'
  password: '#{db[:password]}'

# SIP
sip:
  host:     '#{sip[:host]}'
  port:     '#{sip[:port]}'
  username: '#{sip[:username]}'
  password: '#{sip[:password]}'
  operator: '#{sip[:operator]}'
  location: '#{sip[:location]}'
CONFIG

end