talia_core 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/generators/talia_base/templates/script/configure_talia +41 -30
- metadata +1 -1
data/VERSION.yml
CHANGED
@@ -19,11 +19,35 @@ talia_dir = TALIA_CODE_ROOT
|
|
19
19
|
config_dir = File.join(rails_dir, 'config')
|
20
20
|
config_template_dir = File.join(talia_dir, 'config')
|
21
21
|
|
22
|
-
def
|
22
|
+
def check_result(value, regexp)
|
23
|
+
if(regexp && !regexp.match(value))
|
24
|
+
puts "Value does not have the right format (must match #{regexp})"
|
25
|
+
value = ''
|
26
|
+
end
|
27
|
+
value
|
28
|
+
end
|
29
|
+
|
30
|
+
def raw_read(default, regexp)
|
23
31
|
result = gets.chomp.strip
|
32
|
+
result = default if(default && result == '')
|
33
|
+
check_result(result, regexp)
|
34
|
+
end
|
35
|
+
|
36
|
+
def readl(required_or_default = false, match_check = nil)
|
37
|
+
# Checks if we have a default value or a "required" bool
|
38
|
+
required = required_or_default
|
39
|
+
default = nil
|
40
|
+
if(required_or_default.is_a?(String))
|
41
|
+
reuqired = false
|
42
|
+
default = required_or_default
|
43
|
+
end
|
44
|
+
|
45
|
+
match_check = Regexp.new(match_check) if(match_check.is_a?(String))
|
46
|
+
|
47
|
+
result = raw_read(default, match_check)
|
24
48
|
while(result == '' && required)
|
25
49
|
print 'Must enter a value, retry: '
|
26
|
-
result =
|
50
|
+
result = raw_read(default, match_check)
|
27
51
|
end
|
28
52
|
result
|
29
53
|
end
|
@@ -110,8 +134,7 @@ puts " done."
|
|
110
134
|
|
111
135
|
puts
|
112
136
|
print "Enter the sql driver you want to use (e.g. jdbcmysql, mysql, ...) [jdbcmysql]: "
|
113
|
-
adapter = readl
|
114
|
-
adapter = (adapter == '') ? 'jdbcmysql' : adapter
|
137
|
+
adapter = readl('jdbcmysql')
|
115
138
|
|
116
139
|
|
117
140
|
db_config.set_adapter(adapter)
|
@@ -126,7 +149,7 @@ talia_config.site_name = readl
|
|
126
149
|
|
127
150
|
puts
|
128
151
|
print "Enter the URI for your site: "
|
129
|
-
site_url = readl(true)
|
152
|
+
site_url = readl(true, /\Ahttp:\/\/.+\/\Z/)
|
130
153
|
|
131
154
|
if(read_yn('Do you want to use the IIP image server?'))
|
132
155
|
init_file = File.join(rails_dir, 'config', 'initializers', 'talia.rb')
|
@@ -143,7 +166,7 @@ if(read_yn('Do you want to use the IIP image server?'))
|
|
143
166
|
end
|
144
167
|
puts
|
145
168
|
print "Enter the URL of your IIP server, or the port number (for default URL on localhost): "
|
146
|
-
iip_url = readl
|
169
|
+
iip_url = readl('', /\A\d{2,}\Z|\Ahttp:\/\/.*/)
|
147
170
|
|
148
171
|
# If only numerals, we'll create the URL
|
149
172
|
if(iip_url =~ /^\d*$/)
|
@@ -156,6 +179,17 @@ if(read_yn('Do you want to use the IIP image server?'))
|
|
156
179
|
puts
|
157
180
|
print "Enter the path to store the IIP image files (return for default): "
|
158
181
|
iip_directory = readl
|
182
|
+
|
183
|
+
vips_default_command = `which vips`.gsub("\n", '')
|
184
|
+
print "Enter the path to the vips command (default: #{vips_default_command.inspect}): "
|
185
|
+
vips_command = readl((vips_default_command == '') ? true : vips_default_command)
|
186
|
+
talia_config.vips_command = vips_command
|
187
|
+
|
188
|
+
convert_default_command = `which convert`.gsub("\n", '')
|
189
|
+
print "Enter the path to the convert command (default: #{convert_default_command.inspect}): "
|
190
|
+
convert_command = readl((convert_default_command == '') ? true : convert_default_command)
|
191
|
+
talia_config.convert_command = convert_command
|
192
|
+
|
159
193
|
end
|
160
194
|
|
161
195
|
puts
|
@@ -216,7 +250,7 @@ when 'http':
|
|
216
250
|
rdf_config[env]['user'] = user unless(user.blank?)
|
217
251
|
rdf_config[env]['pass'] = pass unless(pass.blank?)
|
218
252
|
print "Enter the URL for the '#{env}' environment: "
|
219
|
-
rdf_config[env]['url'] = readl(true)
|
253
|
+
rdf_config[env]['url'] = readl(true, /\Ahttp:\/\/.+\/\Z/)
|
220
254
|
end
|
221
255
|
else
|
222
256
|
puts "ERROR: ILLEGAL BACKEND #{backend} - you shouldn't see this..."
|
@@ -280,29 +314,6 @@ puts "Importing ontologies"
|
|
280
314
|
system('rake talia_core:rdf_import files=ontologies/*.owl rdf_syntax=rdfxml')
|
281
315
|
system('rake talia_core:owl_to_rdfs_update')
|
282
316
|
|
283
|
-
# print "Importing language files..."
|
284
|
-
# Dir[File.join(rails_dir, 'languages', '*_glob.csv')].each do |lang_file|
|
285
|
-
# language = File.basename(lang_file)[0..1] # first two chars are the lang code
|
286
|
-
# print " #{language}"
|
287
|
-
# raise("Error importing language #{language}") unless(system("rake discovery:import_language language=#{language} file=#{File.expand_path(lang_file)}"))
|
288
|
-
# end
|
289
|
-
# puts " ... done."
|
290
|
-
# puts
|
291
|
-
|
292
|
-
puts "Customize the start page. The following custom start pages are available:"
|
293
|
-
cust_pages = Dir[File.join(rails_dir, 'customization_files', 'start_page', '_start_page_*.html.erb')]
|
294
|
-
cust_pages.each do |cust_page|
|
295
|
-
# Get the descriptive name
|
296
|
-
md = /_start_page_(.*)\.html\.erb/.match(cust_page)
|
297
|
-
puts "#{cust_pages.index(cust_page)} - #{md[1]}"
|
298
|
-
end
|
299
|
-
|
300
|
-
if(read_yn('Do you want to build a war file now?'))
|
301
|
-
puts
|
302
|
-
puts "Building the war file"
|
303
|
-
system("warble")
|
304
|
-
end
|
305
|
-
|
306
317
|
puts
|
307
318
|
puts "Configuration complete"
|
308
319
|
puts
|