talia_core 0.5.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/config/talia_core.yml.example +37 -35
- data/generators/talia_admin/templates/app/models/fake_source.rb +93 -0
- data/generators/talia_admin/templates/app/models/talia_collection.rb +13 -37
- data/generators/talia_base/talia_base_generator.rb +0 -1
- data/generators/talia_base/templates/app/controllers/custom_templates_controller.rb +2 -1
- data/generators/talia_base/templates/app/controllers/sources_controller.rb +1 -1
- data/generators/talia_base/templates/script/configure_talia +56 -73
- data/generators/talia_swicky/talia_swicky_generator.rb +18 -0
- data/generators/talia_swicky/templates/app/controllers/swicky_notebooks_controller.rb +111 -0
- data/generators/talia_swicky/templates/app/helpers/swicky_notebooks_helper.rb +29 -0
- data/generators/talia_swicky/templates/app/views/swicky_notebooks/index.builder +6 -0
- data/generators/talia_swicky/templates/app/views/swicky_notebooks/index.html.erb +10 -0
- data/generators/talia_swicky/templates/app/views/swicky_notebooks/show.html.erb +11 -0
- data/generators/talia_swicky/templates/test/fixtures/notebook.rdf +862 -0
- data/generators/talia_swicky/templates/test/functional/swicky_notebooks_controller_test.rb +44 -0
- data/lib/core_ext/boolean.rb +23 -0
- data/lib/core_ext/jdbc_rake_monkeypatch.rb +22 -0
- data/lib/core_ext/nil_class.rb +11 -0
- data/lib/core_ext/object.rb +34 -0
- data/lib/core_ext/string.rb +15 -0
- data/lib/custom_template.rb +3 -1
- data/lib/loader_helper.rb +16 -3
- data/lib/mysql.rb +7 -7
- data/lib/progressbar.rb +2 -2
- data/lib/swicky/exhibit_json/item.rb +129 -0
- data/lib/swicky/exhibit_json/item_collection.rb +129 -0
- data/lib/swicky/fragment.rb +0 -0
- data/lib/swicky/note.rb +7 -0
- data/lib/swicky/notebook.rb +78 -12
- data/lib/talia_core/active_source.rb +45 -13
- data/lib/talia_core/active_source_parts/class_methods.rb +154 -26
- data/lib/talia_core/active_source_parts/finders.rb +49 -26
- data/lib/talia_core/active_source_parts/predicate_handler.rb +71 -23
- data/lib/talia_core/active_source_parts/rdf/ntriples_reader.rb +13 -0
- data/lib/talia_core/active_source_parts/rdf/rdf_reader.rb +99 -0
- data/lib/talia_core/active_source_parts/rdf/rdfxml_reader.rb +12 -0
- data/lib/talia_core/active_source_parts/{rdf.rb → rdf_handler.rb} +52 -19
- data/lib/talia_core/active_source_parts/xml/generic_reader.rb +151 -260
- data/lib/talia_core/active_source_parts/xml/generic_reader_add_statements.rb +97 -0
- data/lib/talia_core/active_source_parts/xml/generic_reader_helpers.rb +88 -0
- data/lib/talia_core/active_source_parts/xml/generic_reader_import_statements.rb +239 -0
- data/lib/talia_core/active_source_parts/xml/rdf_builder.rb +14 -7
- data/lib/talia_core/active_source_parts/xml/source_builder.rb +7 -3
- data/lib/talia_core/active_source_parts/xml/source_reader.rb +17 -2
- data/lib/talia_core/collection.rb +192 -1
- data/lib/talia_core/data_types/data_loader.rb +88 -18
- data/lib/talia_core/data_types/data_record.rb +24 -2
- data/lib/talia_core/data_types/delayed_copier.rb +13 -3
- data/lib/talia_core/data_types/file_record.rb +24 -13
- data/lib/talia_core/data_types/file_store.rb +111 -94
- data/lib/talia_core/data_types/iip_data.rb +104 -23
- data/lib/talia_core/data_types/iip_loader.rb +102 -56
- data/lib/talia_core/data_types/image_data.rb +3 -1
- data/lib/talia_core/data_types/media_link.rb +4 -1
- data/lib/talia_core/data_types/mime_mapping.rb +65 -38
- data/lib/talia_core/data_types/path_helpers.rb +23 -17
- data/lib/talia_core/data_types/pdf_data.rb +9 -6
- data/lib/talia_core/data_types/simple_text.rb +5 -4
- data/lib/talia_core/data_types/xml_data.rb +53 -25
- data/lib/talia_core/dummy_handler.rb +3 -2
- data/lib/talia_core/errors.rb +13 -27
- data/lib/talia_core/initializer.rb +44 -4
- data/lib/talia_core/oai/active_source_model.rb +13 -6
- data/lib/talia_core/oai/active_source_oai_adapter.rb +13 -12
- data/lib/talia_core/rdf_import.rb +1 -1
- data/lib/talia_core/rdf_resource.rb +2 -1
- data/lib/talia_core/semantic_collection_wrapper.rb +143 -151
- data/lib/talia_core/semantic_property.rb +4 -0
- data/lib/talia_core/semantic_relation.rb +84 -33
- data/lib/talia_core/source.rb +45 -25
- data/lib/talia_core/source_fragment.rb +7 -0
- data/lib/talia_core/source_transfer_object.rb +3 -1
- data/lib/talia_core/source_types/agent.rb +16 -0
- data/lib/talia_core/source_types/dc_resource.rb +3 -3
- data/lib/talia_core/source_types/marcont_resource.rb +15 -0
- data/lib/talia_core/source_types/skos_concept.rb +17 -0
- data/lib/talia_dependencies.rb +1 -1
- data/lib/talia_util.rb +1 -1
- data/lib/talia_util/bar_progressor.rb +1 -1
- data/lib/talia_util/image_conversions.rb +8 -2
- data/lib/talia_util/import_job_helper.rb +40 -3
- data/lib/talia_util/io_helper.rb +15 -4
- data/lib/talia_util/progressable.rb +50 -1
- data/lib/talia_util/rake_tasks.rb +3 -21
- data/lib/talia_util/test_helpers.rb +6 -1
- data/lib/talia_util/util.rb +108 -27
- data/lib/talia_util/xml/base_builder.rb +28 -1
- data/lib/talia_util/xml/rdf_builder.rb +81 -5
- data/lib/tasks/talia_core_tasks.rake +2 -0
- data/test/core_ext/boolean_test.rb +26 -0
- data/test/core_ext/nil_class_test.rb +14 -0
- data/test/core_ext/object_test.rb +26 -0
- data/test/core_ext/string_test.rb +11 -0
- data/test/swicky/json_encoder_test.rb +51 -42
- data/test/swicky/notebook_test.rb +13 -6
- data/test/talia_core/active_source_finder_interface_test.rb +30 -0
- data/test/talia_core/active_source_test.rb +445 -34
- data/test/talia_core/collection_test.rb +332 -0
- data/test/talia_core/data_types/file_record_test.rb +2 -23
- data/test/talia_core/ntriples_reader_test.rb +49 -0
- data/test/talia_core/rdfxml_reader_test.rb +51 -0
- data/test/talia_core/source_test.rb +12 -0
- data/test/talia_util/import_job_helper_test.rb +19 -12
- metadata +190 -90
- data/config/database.yml +0 -19
- data/config/rdfstore.yml +0 -13
- data/config/talia_core.yml +0 -24
- data/generators/talia_base/templates/migrations/bj_migration.rb +0 -10
- data/lib/JXslt/jxslt.rb +0 -60
- data/lib/swicky/json_encoder.rb +0 -179
- data/lib/talia_core/agent.rb +0 -14
- data/lib/talia_core/background_jobs/job.rb +0 -82
- data/lib/talia_core/background_jobs/progress_job.rb +0 -68
- data/lib/talia_core/data_types/temp_file_handling.rb +0 -85
- data/lib/talia_core/ordered_source.rb +0 -228
- data/lib/talia_core/semantic_collection_item.rb +0 -94
- data/lib/talia_core/source_types/collection.rb +0 -15
- data/lib/talia_util/progressbar.rb +0 -236
- data/tasks/talia_core_tasks.rake +0 -2
- data/test/talia_core/ordered_source_test.rb +0 -394
- data/test/talia_core/semantic_collection_item_test.rb +0 -125
data/VERSION.yml
CHANGED
@@ -1,49 +1,51 @@
|
|
1
|
+
sindice: false
|
1
2
|
# TaliaCore configuration file
|
2
|
-
|
3
3
|
# The domain URI that is the "local" domain of this installation
|
4
4
|
local_uri: "http://test.dummy/"
|
5
5
|
# The domain URI that is used as a default if no namespace is given
|
6
6
|
default_namespace_uri: "http://default.dummy/"
|
7
|
-
|
8
7
|
# The RDF store configuration can be read from a file
|
9
8
|
rdf_connection_file: rdfstore
|
10
|
-
# RDF configuration can also be given as a hash here
|
11
|
-
# rdf_connection:
|
12
|
-
|
13
9
|
# Set the logging level for ActiveRDF
|
14
10
|
ardf_log_level: 0
|
15
|
-
|
16
11
|
# If standalone_db is set, ActiveRecord will be configured for use
|
17
12
|
# without the Rails environment
|
18
13
|
standalone_db: true
|
19
14
|
db_file: database
|
20
|
-
# Database configuration can also be given as a hash here
|
21
|
-
# db_connection:
|
22
|
-
# If unset, the databse log will end up in the default log directory
|
23
|
-
# db_log: database.log
|
24
|
-
|
25
|
-
# The location for data files (only set if you need to change
|
26
|
-
# the default location)
|
27
|
-
# data_directory_location: "/var/www/talia_data/"
|
28
|
-
|
29
|
-
# Configure the namespaces for use with RDF
|
30
15
|
namespaces:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
16
|
+
hyper: "http://www.hypernietzsche.org/ontology/"
|
17
|
+
foaf: "http://xmlns.com/foaf/0.1/"
|
18
|
+
skos: "http://www.w3.org/2004/02/skos/core#"
|
19
|
+
dct: "http://purl.org/dc/terms/"
|
20
|
+
dcmit: "http://purl.org/dc/dcmitype/"
|
21
|
+
dcns: "http://purl.org/dc/elements/1.1/"
|
22
|
+
luccadom: "http://trac.talia.discovery-project.eu/wiki/LuccaOntology#"
|
23
|
+
talias: "http://trac.talia.discovery-project.eu/wiki/StructuralOntology#"
|
24
|
+
taliadom: "http://trac.talia.discovery-project.eu/wiki/SampleDomainOntology#"
|
25
|
+
sesame: "http://www.openrdf.org/schema/sesame#"
|
26
|
+
swicky: "http://discovery-project.eu/ontologies/philoSpace/"
|
27
|
+
discovery: "http://discovery-project.eu/ontologies/scholar/0.1/"
|
28
|
+
marcont: "http://www.marcont.org/ontology/2.1/"
|
29
|
+
wordnet: "http://xmlns.com/wordnet/1.6/"
|
30
|
+
geo: "http://www.w3.org/2003/01/geo/wgs84_pos#"
|
31
|
+
demo: "http://ontologies.muruca.org/demo3#"
|
32
|
+
gnames: "http://www.geonames.org/ontology#"
|
33
|
+
frbr: "http://purl.org/vocab/frbr/core#"
|
34
|
+
site_name: "Talia Tutorial Application"
|
35
|
+
iip_root_directory_location:
|
36
|
+
data_directory_location:
|
37
|
+
iip_server_uri:
|
38
|
+
vips_command:
|
39
|
+
convert_command:
|
40
|
+
googlemap_key: "ABQIAAAAOY6Zv9NunttIT5fALwpiRhSPtRO-56uzZJvIGXQxlGNVk-r4kxRE8NIB3lUS5Sog8714vby5L9bupQ"
|
41
|
+
oai:
|
42
|
+
prefix: "oai:talia"
|
43
|
+
repository_name: "Talia OAI Interface"
|
44
|
+
shown_tabs:
|
45
|
+
- users
|
46
|
+
- talia_sources
|
47
|
+
|
48
|
+
thumb_options:
|
49
|
+
height: "400"
|
50
|
+
width: "400"
|
51
|
+
admin_email: "admin@example.com"
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Methods for "fake" source classes that let Hobo play (somewhat)
|
2
|
+
# together with the classes from TaliaCore::*
|
3
|
+
module FakeSource
|
4
|
+
|
5
|
+
# Class methods for fake sources
|
6
|
+
module ClassMethods
|
7
|
+
|
8
|
+
def real_class
|
9
|
+
@real_class ||= TaliaCore::Source
|
10
|
+
end
|
11
|
+
|
12
|
+
def has_real_class(klass)
|
13
|
+
@real_class = klass
|
14
|
+
end
|
15
|
+
|
16
|
+
def find(*args)
|
17
|
+
result = real_class.find(*args)
|
18
|
+
if(result.is_a?(Array))
|
19
|
+
result.collect { |s| from_real_source(s) }
|
20
|
+
else
|
21
|
+
result.nil? ? result : from_real_source(result)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def count(*args)
|
26
|
+
real_class.count(*args)
|
27
|
+
end
|
28
|
+
|
29
|
+
def new(*args)
|
30
|
+
new_thing = super(*args)
|
31
|
+
new_thing[:type] = real_class.name
|
32
|
+
new_thing.real_source = real_class.new("http://#{rand Time.now.to_i}.x")
|
33
|
+
new_thing.real_source.add_additional_rdf_types
|
34
|
+
new_thing
|
35
|
+
end
|
36
|
+
|
37
|
+
def from_real_source(real_source)
|
38
|
+
result = self.send(:instantiate, real_source.attributes)
|
39
|
+
result.real_source = real_source
|
40
|
+
result
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
attr_writer :real_source
|
46
|
+
|
47
|
+
def real_class
|
48
|
+
self.class.real_class
|
49
|
+
end
|
50
|
+
|
51
|
+
def name
|
52
|
+
real_source.respond_to?(:label) ? real_source.label : to_uri.to_name_s
|
53
|
+
end
|
54
|
+
|
55
|
+
def short_type
|
56
|
+
self.type ? self.type.gsub('TaliaCore::', '') : 'ActiveSource'
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_uri
|
60
|
+
self.uri.to_uri
|
61
|
+
end
|
62
|
+
|
63
|
+
def real_source
|
64
|
+
@real_source ||= if(new_record?)
|
65
|
+
real_class.new
|
66
|
+
else
|
67
|
+
TaliaCore::ActiveSource.find(self.id, :prefetch_relations => true)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def rdf_mode
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
|
75
|
+
# Save the real source stuff, if it exists
|
76
|
+
def save!
|
77
|
+
save_real_source(true)
|
78
|
+
end
|
79
|
+
|
80
|
+
def save
|
81
|
+
save_real_source(false)
|
82
|
+
end
|
83
|
+
|
84
|
+
def save_real_source(throws)
|
85
|
+
real_source[:uri] = self[:uri]
|
86
|
+
was_new = self.new_record?
|
87
|
+
result = (throws ? real_source.save! : real_source.save)
|
88
|
+
self.id = real_source.id
|
89
|
+
self.instance_variable_set(:@new_record, false) if(was_new)
|
90
|
+
result
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
class TaliaCollection < ActiveRecord::Base
|
2
2
|
hobo_model # Don't put anything above this
|
3
3
|
|
4
|
+
include FakeSource
|
5
|
+
extend FakeSource::ClassMethods
|
6
|
+
|
7
|
+
has_real_class TaliaCore::Collection
|
8
|
+
|
4
9
|
self.inheritance_column = 'foo'
|
5
10
|
|
6
11
|
fields do
|
@@ -8,49 +13,20 @@ class TaliaCollection < ActiveRecord::Base
|
|
8
13
|
end
|
9
14
|
|
10
15
|
set_table_name "active_sources"
|
11
|
-
|
12
|
-
|
13
|
-
|
16
|
+
|
14
17
|
def create_permitted?
|
15
18
|
acting_user.administrator?
|
16
19
|
end
|
17
|
-
|
20
|
+
|
18
21
|
def update_permitted?
|
19
22
|
acting_user.administrator?
|
20
23
|
end
|
21
|
-
|
24
|
+
|
25
|
+
def destroy_permitted?
|
26
|
+
acting_user.administrator?
|
27
|
+
end
|
28
|
+
|
22
29
|
def view_permitted?(field)
|
23
30
|
true
|
24
31
|
end
|
25
|
-
|
26
|
-
def self.new(*args)
|
27
|
-
new_thing = super(*args)
|
28
|
-
new_thing[:type] = "TaliaCore::Collection"
|
29
|
-
new_thing
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.find(*args)
|
33
|
-
puts args.inspect
|
34
|
-
result = TaliaCore::Collection.find(*args)
|
35
|
-
if(result.is_a?(Array))
|
36
|
-
result.collect { |s| from_real_collection(s) }
|
37
|
-
else
|
38
|
-
from_real_collection(result)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.count(*args)
|
43
|
-
TaliaCore::Collection.count(*args)
|
44
|
-
end
|
45
|
-
|
46
|
-
def name
|
47
|
-
N::URI.new(self.uri).to_name_s
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def self.from_real_collection(real_collection)
|
53
|
-
TaliaCollection.send(:instantiate, real_collection.attributes)
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
32
|
+
end
|
@@ -132,7 +132,7 @@ class SourcesController < ApplicationController
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
template = template_map[source.class.name.demodulize]
|
135
|
-
template
|
135
|
+
template || File.join(template_path, 'default', 'default')
|
136
136
|
end
|
137
137
|
|
138
138
|
def template_map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
gem 'activerecord'
|
@@ -19,35 +19,11 @@ 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
|
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)
|
22
|
+
def readl(required = false)
|
31
23
|
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)
|
48
24
|
while(result == '' && required)
|
49
25
|
print 'Must enter a value, retry: '
|
50
|
-
result =
|
26
|
+
result = gets.chomp.strip
|
51
27
|
end
|
52
28
|
result
|
53
29
|
end
|
@@ -81,7 +57,7 @@ mysql_setup.host = 'localhost'
|
|
81
57
|
mysql_setup.app_name = 'talia'
|
82
58
|
mysql_setup.sock = sock_file
|
83
59
|
|
84
|
-
print "Enter the mySQL root
|
60
|
+
print "Enter the mySQL root password: "
|
85
61
|
root_pw = readl
|
86
62
|
mysql_setup.root_credentials('root', root_pw)
|
87
63
|
if(root_pw == '')
|
@@ -127,15 +103,15 @@ end
|
|
127
103
|
|
128
104
|
print "Loading the configuration templates..."
|
129
105
|
db_config = TaliaUtil::Configuration::DatabaseConfig.new(File.join(config_template_dir, 'database.yml.example'))
|
130
|
-
rdf_config = TaliaUtil::Configuration::ConfigFile.new(File.join(config_template_dir, 'rdfstore.yml.example'))
|
106
|
+
rdf_config = TaliaUtil::Configuration::ConfigFile.new(File.join(config_template_dir, 'rdfstore.yml.example'))
|
131
107
|
talia_config = TaliaUtil::Configuration::ConfigFile.new(File.join(config_template_dir, 'talia_core.yml.example'))
|
132
108
|
talia_test_config = TaliaUtil::Configuration::ConfigFile.new(File.join(talia_dir, 'test', 'config', 'talia_core.yml_example')) unless(from_gem)
|
133
109
|
puts " done."
|
134
110
|
|
135
111
|
puts
|
136
112
|
print "Enter the sql driver you want to use (e.g. jdbcmysql, mysql, ...) [jdbcmysql]: "
|
137
|
-
adapter = readl
|
138
|
-
|
113
|
+
adapter = readl
|
114
|
+
adapter = (adapter == '') ? 'jdbcmysql' : adapter
|
139
115
|
|
140
116
|
db_config.set_adapter(adapter)
|
141
117
|
db_config.set_credentials(rails_user, rails_pw)
|
@@ -148,29 +124,17 @@ print "Enter the site name (it will appear in the window title): "
|
|
148
124
|
talia_config.site_name = readl
|
149
125
|
|
150
126
|
puts
|
151
|
-
print "Enter the URI for your site: "
|
152
|
-
site_url = readl(true
|
127
|
+
print "Enter the URI for your site. The URI requires a final \"/\": "
|
128
|
+
site_url = readl(true)
|
153
129
|
|
154
130
|
if(read_yn('Do you want to use the IIP image server?'))
|
155
|
-
init_file = File.join(rails_dir, 'config', 'initializers', 'talia.rb')
|
156
|
-
if(File.exist?(init_file))
|
157
|
-
puts "Adding the creation handler to your talia_initializer. Note that you will need 'vips' installed."
|
158
|
-
File.open(init_file, 'a') do |io|
|
159
|
-
io.puts ''
|
160
|
-
io.puts '# IIP creation handlers, added automatically'
|
161
|
-
%w(jpeg tiff png gif bmp).each { |t| io.puts "TaliaCore::DataTypes::MimeMapping.add_mapping(:#{t}, TaliaCore::DataTypes::ImageData, :create_iip)" }
|
162
|
-
io.puts ''
|
163
|
-
end
|
164
|
-
else
|
165
|
-
puts "WARNING: Initializer file for Talia not found. You will need to add the image handler for the MIME types manually."
|
166
|
-
end
|
167
131
|
puts
|
168
132
|
print "Enter the URL of your IIP server, or the port number (for default URL on localhost): "
|
169
|
-
iip_url = readl
|
170
|
-
|
133
|
+
iip_url = readl
|
171
134
|
# If only numerals, we'll create the URL
|
172
|
-
if
|
173
|
-
iip_url = "
|
135
|
+
if iip_url =~ /^\d*$/
|
136
|
+
iip_url = ":#{iip_url}" if iip_url != ''
|
137
|
+
iip_url = "http://localhost#{iip_url}/fcgi-bin/iipsrv.fcgi"
|
174
138
|
end
|
175
139
|
puts "Setting IIP URL to: #{iip_url}"
|
176
140
|
|
@@ -179,31 +143,27 @@ if(read_yn('Do you want to use the IIP image server?'))
|
|
179
143
|
puts
|
180
144
|
print "Enter the path to store the IIP image files (return for default): "
|
181
145
|
iip_directory = readl
|
182
|
-
|
146
|
+
|
183
147
|
vips_default_command = `which vips`.gsub("\n", '')
|
184
148
|
print "Enter the path to the vips command (default: #{vips_default_command.inspect}): "
|
185
|
-
vips_command = readl
|
186
|
-
talia_config.vips_command = vips_command
|
187
|
-
|
149
|
+
vips_command = readl
|
150
|
+
talia_config.vips_command = vips_command == '' ? vips_default_command : vips_command
|
151
|
+
|
152
|
+
|
188
153
|
convert_default_command = `which convert`.gsub("\n", '')
|
189
154
|
print "Enter the path to the convert command (default: #{convert_default_command.inspect}): "
|
190
|
-
convert_command = readl
|
191
|
-
talia_config.convert_command = convert_command
|
192
|
-
|
155
|
+
convert_command = readl
|
156
|
+
talia_config.convert_command = convert_command == '' ? convert_default_command : convert_command
|
193
157
|
end
|
194
158
|
|
195
159
|
puts
|
196
160
|
puts "Configuring the Sesame RDF store (change the config by hand for stores other than Sesame)"
|
197
161
|
puts
|
198
162
|
backends = %w(native memory rdbms http)
|
199
|
-
print "Enter the sesame backend to use (#{backends.join('|')})
|
200
|
-
backend = readl
|
201
|
-
backend = 'native' if(backend.blank?)
|
202
|
-
while(!(backends.include?(backend)))
|
163
|
+
print "Enter the sesame backend to use (#{backends.join('|')}): "
|
164
|
+
while(!(backends.include?(backend = readl)))
|
203
165
|
puts "#{backend} is not a valid backend"
|
204
166
|
print "Enter the backend (#{backends.join('|')}: )"
|
205
|
-
backend = readl
|
206
|
-
backend = 'native' if(backend.blank?)
|
207
167
|
end
|
208
168
|
|
209
169
|
%w(production test development).each do |env|
|
@@ -231,7 +191,7 @@ when 'rdbms':
|
|
231
191
|
print "Enter the password for the connection: "
|
232
192
|
pass = readl
|
233
193
|
end
|
234
|
-
%
|
194
|
+
%(production test development).each do |env|
|
235
195
|
rdf_config[env]['driver'] = driver
|
236
196
|
rdf_config[env]['user'] = user
|
237
197
|
rdf_config[env]['pass'] = pass
|
@@ -247,10 +207,11 @@ when 'http':
|
|
247
207
|
pass = readl
|
248
208
|
end
|
249
209
|
%w(production test development).each do |env|
|
250
|
-
rdf_config[env]['
|
251
|
-
rdf_config[env]['
|
210
|
+
rdf_config[env]['driver'] = driver
|
211
|
+
rdf_config[env]['user'] = user
|
212
|
+
rdf_config[env]['pass'] = pass
|
252
213
|
print "Enter the URL for the '#{env}' environment: "
|
253
|
-
rdf_config[env]['url'] = readl(true
|
214
|
+
rdf_config[env]['url'] = readl(true)
|
254
215
|
end
|
255
216
|
else
|
256
217
|
puts "ERROR: ILLEGAL BACKEND #{backend} - you shouldn't see this..."
|
@@ -260,8 +221,7 @@ if(iip_directory != '')
|
|
260
221
|
talia_config.iip_root_directory_location = iip_directory
|
261
222
|
end
|
262
223
|
|
263
|
-
|
264
|
-
print "Enter the path to store general data files (return for default): "
|
224
|
+
print "Enter the path to store the data files (return for default): "
|
265
225
|
data_directory = readl
|
266
226
|
|
267
227
|
if(data_directory != '')
|
@@ -305,15 +265,38 @@ end
|
|
305
265
|
puts
|
306
266
|
puts "Now migrating the databases"
|
307
267
|
%w(test development production).each do |env|
|
308
|
-
puts "Init database for #{env}"
|
309
268
|
raise("Error migrating #{env}") unless(system("rake db:migrate RAILS_ENV=#{env}"))
|
310
269
|
# raise("Error creating globalize tables in #{env}") unless(system("rake globalize:setup RAILS_ENV=#{env}"))
|
311
|
-
puts "Importing ontologies for #{env}"
|
312
|
-
system("rake talia_core:rdf_import files=ontologies/*.owl rdf_syntax=rdfxml RAILS_ENV=#{env}")
|
313
|
-
system("rake talia_core:owl_to_rdfs_update RAILS_ENV=#{env}")
|
314
270
|
puts "Migrated #{env}"
|
315
271
|
end
|
316
272
|
|
273
|
+
puts "Importing ontologies"
|
274
|
+
system('rake talia_core:rdf_import files=ontologies/*.owl rdf_syntax=rdfxml')
|
275
|
+
system('rake talia_core:owl_to_rdfs_update')
|
276
|
+
|
277
|
+
# print "Importing language files..."
|
278
|
+
# Dir[File.join(rails_dir, 'languages', '*_glob.csv')].each do |lang_file|
|
279
|
+
# language = File.basename(lang_file)[0..1] # first two chars are the lang code
|
280
|
+
# print " #{language}"
|
281
|
+
# raise("Error importing language #{language}") unless(system("rake discovery:import_language language=#{language} file=#{File.expand_path(lang_file)}"))
|
282
|
+
# end
|
283
|
+
# puts " ... done."
|
284
|
+
# puts
|
285
|
+
|
286
|
+
puts "Customize the start page. The following custom start pages are available:"
|
287
|
+
cust_pages = Dir[File.join(rails_dir, 'customization_files', 'start_page', '_start_page_*.html.erb')]
|
288
|
+
cust_pages.each do |cust_page|
|
289
|
+
# Get the descriptive name
|
290
|
+
md = /_start_page_(.*)\.html\.erb/.match(cust_page)
|
291
|
+
puts "#{cust_pages.index(cust_page)} - #{md[1]}"
|
292
|
+
end
|
293
|
+
|
294
|
+
if(read_yn('Do you want to build a war file now?'))
|
295
|
+
puts
|
296
|
+
puts "Building the war file"
|
297
|
+
system("warble")
|
298
|
+
end
|
299
|
+
|
317
300
|
puts
|
318
301
|
puts "Configuration complete"
|
319
|
-
puts
|
302
|
+
puts
|