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
48
|
# File 'lib/nostos-source-illiad/generators/source_illiad_generator.rb', line 5
def configure
puts "General Configuration:"
number_of_days_to_poll = ask('How many days in the past would you like to poll Illiad? [7]')
number_of_days_to_poll = 7 if number_of_days_to_poll.blank?
puts "Database Configuration:"
puts "The following fields are required to establish a connection with your Illiad server."
db = {}
db[:dataserver] = ask('dataserver (the name for your server as defined in freetds.conf): ')
db[:username] = ask('username (the database server user): ')
db[:password] = ask('password (the user password): ')
puts "WebCirc Configuration:"
webcirc = {}
webcirc[:url] = ask('URL: ')
webcirc[:username] = ask('Username: ')
webcirc[:password] = ask('Password: ')
create_file File.join(Rails.root, 'config', 'source_illiad.yml'), "# Source Illiad Configuration\n\n# This is the number of days into the past you would like to poll. \n# This value must be greater than how often you run your daily cron job.\nnumber_of_days_to_poll: \#{number_of_days_to_poll}\n\n# Database\ndb:\n adapter: 'sqlserver'\n dataserver: '\#{db[:dataserver]}'\n username: '\#{db[:username]}'\n password: '\#{db[:password]}'\n\n# Web Circulation\nwebcirc:\n url: '\#{webcirc[:url]}'\n username: '\#{webcirc[:username]}'\n password: '\#{webcirc[:password]}'\n"
end
|