talia_core 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. data/VERSION.yml +4 -0
  2. data/config/database.yml +19 -0
  3. data/config/database.yml.example +35 -0
  4. data/config/rdfstore.yml +13 -0
  5. data/config/rdfstore.yml.example +13 -0
  6. data/config/rdfstore.yml.rdflite_example +16 -0
  7. data/config/rdfstore.yml.redland_example +46 -0
  8. data/config/talia_core.yml +14 -0
  9. data/config/talia_core.yml.example +42 -0
  10. data/generators/generator_helpers.rb +49 -0
  11. data/generators/talia_admin/USAGE +1 -0
  12. data/generators/talia_admin/talia_admin_generator.rb +19 -0
  13. data/generators/talia_admin/templates/controllers/admin/background_controller.rb +50 -0
  14. data/generators/talia_admin/templates/controllers/admin/custom_templates_controller.rb +25 -0
  15. data/generators/talia_admin/templates/controllers/admin/locales_controller.rb +15 -0
  16. data/generators/talia_admin/templates/controllers/admin/sources_controller.rb +71 -0
  17. data/generators/talia_admin/templates/controllers/admin/translations_controller.rb +61 -0
  18. data/generators/talia_admin/templates/controllers/admin/users_controller.rb +48 -0
  19. data/generators/talia_admin/templates/controllers/admin_controller.rb +7 -0
  20. data/generators/talia_admin/templates/helpers/admin/background_helper.rb +60 -0
  21. data/generators/talia_admin/templates/helpers/admin/custom_templates_helper.rb +5 -0
  22. data/generators/talia_admin/templates/helpers/admin/locales_helper.rb +2 -0
  23. data/generators/talia_admin/templates/helpers/admin/sources_helper.rb +65 -0
  24. data/generators/talia_admin/templates/helpers/admin/translations_helper.rb +51 -0
  25. data/generators/talia_admin/templates/helpers/admin/users_helper.rb +2 -0
  26. data/generators/talia_admin/templates/helpers/admin_helper.rb +11 -0
  27. data/generators/talia_admin/templates/public/images/backend/body_bg.gif +0 -0
  28. data/generators/talia_admin/templates/public/images/backend/footer_bg.gif +0 -0
  29. data/generators/talia_admin/templates/public/images/backend/header.jpg +0 -0
  30. data/generators/talia_admin/templates/public/images/backend/header_bg.gif +0 -0
  31. data/generators/talia_admin/templates/public/images/backend/menu.jpg +0 -0
  32. data/generators/talia_admin/templates/public/images/backend/menu_bg.gif +0 -0
  33. data/generators/talia_admin/templates/public/images/backend/opednid.gif +0 -0
  34. data/generators/talia_admin/templates/public/images/backend/page_bg.jpg +0 -0
  35. data/generators/talia_admin/templates/public/images/backend/triangolino.gif +0 -0
  36. data/generators/talia_admin/templates/public/images/backend/triangolino_full.gif +0 -0
  37. data/generators/talia_admin/templates/public/javascripts/backend.js +24 -0
  38. data/generators/talia_admin/templates/public/javascripts/lowpro.js +321 -0
  39. data/generators/talia_admin/templates/public/stylesheets/backend.css +466 -0
  40. data/generators/talia_admin/templates/test/fixtures/users.yml +32 -0
  41. data/generators/talia_admin/templates/test/functional/admin/custom_templates_controller_test.rb +8 -0
  42. data/generators/talia_admin/templates/test/functional/admin/locales_controller_test.rb +35 -0
  43. data/generators/talia_admin/templates/test/functional/admin/sources_controller_test.rb +109 -0
  44. data/generators/talia_admin/templates/test/functional/admin/translations_controller_test.rb +93 -0
  45. data/generators/talia_admin/templates/test/functional/admin/users_controller_test.rb +67 -0
  46. data/generators/talia_admin/templates/test/functional/admin_controller_test.rb +15 -0
  47. data/generators/talia_admin/templates/test/unit/user_test.rb +134 -0
  48. data/generators/talia_admin/templates/views/admin/background/_finished.html.erb +9 -0
  49. data/generators/talia_admin/templates/views/admin/background/_pending.html.erb +1 -0
  50. data/generators/talia_admin/templates/views/admin/background/_progress.html.erb +15 -0
  51. data/generators/talia_admin/templates/views/admin/background/_running.html.erb +11 -0
  52. data/generators/talia_admin/templates/views/admin/background/environment.html.erb +12 -0
  53. data/generators/talia_admin/templates/views/admin/background/show.html.erb +17 -0
  54. data/generators/talia_admin/templates/views/admin/background/stderr.html.erb +6 -0
  55. data/generators/talia_admin/templates/views/admin/background/stdin.html.erb +6 -0
  56. data/generators/talia_admin/templates/views/admin/background/stdout.html.erb +6 -0
  57. data/generators/talia_admin/templates/views/admin/custom_templates/_content_form_column.rhtml +2 -0
  58. data/generators/talia_admin/templates/views/admin/custom_templates/_template_type_form_column.rhtml +2 -0
  59. data/generators/talia_admin/templates/views/admin/index.html.erb +5 -0
  60. data/generators/talia_admin/templates/views/admin/locales/new.html.erb +9 -0
  61. data/generators/talia_admin/templates/views/admin/sources/_data.html.erb +6 -0
  62. data/generators/talia_admin/templates/views/admin/sources/_data_form.html.erb +15 -0
  63. data/generators/talia_admin/templates/views/admin/sources/_form.html.erb +7 -0
  64. data/generators/talia_admin/templates/views/admin/sources/_list.html.erb +3 -0
  65. data/generators/talia_admin/templates/views/admin/sources/_notice.html.erb +1 -0
  66. data/generators/talia_admin/templates/views/admin/sources/_predicate.html.erb +22 -0
  67. data/generators/talia_admin/templates/views/admin/sources/_predicates.html.erb +15 -0
  68. data/generators/talia_admin/templates/views/admin/sources/_sources.html.erb +17 -0
  69. data/generators/talia_admin/templates/views/admin/sources/_upload.html.erb +6 -0
  70. data/generators/talia_admin/templates/views/admin/sources/edit.html.erb +6 -0
  71. data/generators/talia_admin/templates/views/admin/sources/index.html.erb +5 -0
  72. data/generators/talia_admin/templates/views/admin/translations/_new_translation.html.erb +7 -0
  73. data/generators/talia_admin/templates/views/admin/translations/_translation.html.erb +10 -0
  74. data/generators/talia_admin/templates/views/admin/translations/edit.html.erb +16 -0
  75. data/generators/talia_admin/templates/views/admin/users/_form.html.erb +10 -0
  76. data/generators/talia_admin/templates/views/admin/users/_form_roles.html.erb +8 -0
  77. data/generators/talia_admin/templates/views/admin/users/edit.html.erb +12 -0
  78. data/generators/talia_admin/templates/views/admin/users/index.html.erb +22 -0
  79. data/generators/talia_admin/templates/views/admin/users/new.html.erb +5 -0
  80. data/generators/talia_admin/templates/views/admin/users/show.html.erb +6 -0
  81. data/generators/talia_admin/templates/views/layouts/admin.html.erb +56 -0
  82. data/generators/talia_base/USAGE +5 -0
  83. data/generators/talia_base/talia_base_generator.rb +62 -0
  84. data/generators/talia_base/templates/app/controllers/custom_templates_controller.rb +27 -0
  85. data/generators/talia_base/templates/app/controllers/ontologies_controller.rb +13 -0
  86. data/generators/talia_base/templates/app/controllers/sessions_controller.rb +90 -0
  87. data/generators/talia_base/templates/app/controllers/source_data/show.html.erb +2 -0
  88. data/generators/talia_base/templates/app/controllers/source_data_controller.rb +43 -0
  89. data/generators/talia_base/templates/app/controllers/sources_controller.rb +62 -0
  90. data/generators/talia_base/templates/app/controllers/types_controller.rb +23 -0
  91. data/generators/talia_base/templates/app/helpers/custom_templates_helper.rb +2 -0
  92. data/generators/talia_base/templates/app/helpers/ontologies_helper.rb +2 -0
  93. data/generators/talia_base/templates/app/helpers/sessions_helper.rb +2 -0
  94. data/generators/talia_base/templates/app/helpers/source_data/show.html.erb +2 -0
  95. data/generators/talia_base/templates/app/helpers/source_data_helper.rb +2 -0
  96. data/generators/talia_base/templates/app/helpers/sources_helper.rb +39 -0
  97. data/generators/talia_base/templates/app/helpers/types_helper.rb +2 -0
  98. data/generators/talia_base/templates/app/views/ontologies/index.builder +10 -0
  99. data/generators/talia_base/templates/app/views/ontologies/show.builder +7 -0
  100. data/generators/talia_base/templates/app/views/sessions/new.html.erb +33 -0
  101. data/generators/talia_base/templates/app/views/source_data/show.html.erb +2 -0
  102. data/generators/talia_base/templates/app/views/sources/_form.html.erb +15 -0
  103. data/generators/talia_base/templates/app/views/sources/edit.html.erb +9 -0
  104. data/generators/talia_base/templates/app/views/sources/index.html.erb +2 -0
  105. data/generators/talia_base/templates/app/views/sources/new.html.erb +8 -0
  106. data/generators/talia_base/templates/app/views/sources/show.html.erb +19 -0
  107. data/generators/talia_base/templates/app/views/types/index.html.erb +4 -0
  108. data/generators/talia_base/templates/app/views/types/show.html.erb +3 -0
  109. data/generators/talia_base/templates/config/routes.rb +83 -0
  110. data/generators/talia_base/templates/config/talia_initializer.rb +8 -0
  111. data/generators/talia_base/templates/migrations/bj_migration.rb +10 -0
  112. data/generators/talia_base/templates/migrations/constraint_migration.rb +24 -0
  113. data/generators/talia_base/templates/migrations/create_active_sources.rb +15 -0
  114. data/generators/talia_base/templates/migrations/create_custom_templates.rb +17 -0
  115. data/generators/talia_base/templates/migrations/create_data_records.rb +27 -0
  116. data/generators/talia_base/templates/migrations/create_open_id.rb +26 -0
  117. data/generators/talia_base/templates/migrations/create_progress_jobs.rb +18 -0
  118. data/generators/talia_base/templates/migrations/create_roles.rb +20 -0
  119. data/generators/talia_base/templates/migrations/create_semantic_properties.rb +14 -0
  120. data/generators/talia_base/templates/migrations/create_semantic_relations.rb +17 -0
  121. data/generators/talia_base/templates/migrations/create_sessions.rb +16 -0
  122. data/generators/talia_base/templates/migrations/create_users.rb +20 -0
  123. data/generators/talia_base/templates/migrations/create_workflows.rb +28 -0
  124. data/generators/talia_base/templates/migrations/populate_users.rb +11 -0
  125. data/generators/talia_base/templates/migrations/upgrade_relations.rb +12 -0
  126. data/generators/talia_base/templates/ontologies/hyper_ontology.owl +1462 -0
  127. data/generators/talia_base/templates/ontologies/hyper_ontology.pprj +9351 -0
  128. data/generators/talia_base/templates/ontologies/hyper_ontology.repository +6 -0
  129. data/generators/talia_base/templates/ontologies/scholar_0.1.owl +109 -0
  130. data/generators/talia_base/templates/script/configure_talia +292 -0
  131. data/generators/talia_base/templates/script/prepare_images +100 -0
  132. data/generators/talia_base/templates/talia.sh +51 -0
  133. data/generators/talia_base/templates/tasks/talia_core.rk +1 -0
  134. data/lib/loader_helper.rb +9 -0
  135. data/lib/talia_core.rb +0 -2
  136. data/lib/talia_dependencies.rb +5 -0
  137. data/lib/talia_util/rake_tasks.rb +223 -0
  138. data/tasks/talia_core_tasks.rake +2 -0
  139. metadata +138 -13
@@ -0,0 +1,6 @@
1
+ [Dublin Core DL Redirect]
2
+ http://purl.org/dc/elements/1.1/
3
+ http://purl.org/dc/terms/
4
+ http://www.w3.org/2004/02/skos/core
5
+ http://xmlns.com/foaf/0.1/
6
+ http://purl.org/dc/terms/
@@ -0,0 +1,109 @@
1
+ <?xml version="1.0"?>
2
+ <rdf:RDF
3
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
4
+ xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
7
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
8
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
9
+ xmlns="http://discovery-project.eu/ontologies/scholar/0.1/"
10
+ xml:base="http://discovery-project.eu/ontologies/scholar/0.1/">
11
+ <owl:Ontology rdf:about=""/>
12
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Object">
13
+ <rdfs:subClassOf>
14
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
15
+ </rdfs:subClassOf>
16
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
17
+ >A material, concrete object.</rdfs:comment>
18
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
19
+ >Object</rdfs:label>
20
+ </rdfs:Class>
21
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Source">
22
+ <rdfs:comment xml:lang="en">An artifact or document that is matter of study.</rdfs:comment>
23
+ <rdfs:label xml:lang="en">Source</rdfs:label>
24
+ </rdfs:Class>
25
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Event">
26
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
27
+ >Event</rdfs:label>
28
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
29
+ >An event in time.</rdfs:comment>
30
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
31
+ </rdfs:Class>
32
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/PrimarySource">
33
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
34
+ >Primary Source</rdfs:label>
35
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
36
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
37
+ >An artifact taht is considered to be a primary material in a given domain (e.g. wrote by the author(s) that is(are) matter of study).</rdfs:comment>
38
+ </rdfs:Class>
39
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Person">
40
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
41
+ >Person</rdfs:label>
42
+ <rdfs:comment xml:lang="en">A human beeing.</rdfs:comment>
43
+ </rdfs:Class>
44
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Concept">
45
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
46
+ <rdfs:comment xml:lang="en">A concept, often an abstract thing, that is matter of philosophical studies. Rather than precisely define the concept, instances of this classes and of its subclasses are intended as 'topics', e.g. identifying generic aspects or areas in philosophical studies..</rdfs:comment>
47
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
48
+ >Concept</rdfs:label>
49
+ </rdfs:Class>
50
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/Place">
51
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
52
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
53
+ >A place, something that has a precised and fixed geographical position (a city, a building, etc.)</rdfs:comment>
54
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
55
+ >Place</rdfs:label>
56
+ </rdfs:Class>
57
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/SecondarySource">
58
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
59
+ >Secondary Source</rdfs:label>
60
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
61
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
62
+ >An artifact that is considered to be secondary in a given domain (e.g. a commentary of a primary source wrote by a scholar).</rdfs:comment>
63
+ </rdfs:Class>
64
+ <rdfs:Class rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/FictionalEntity">
65
+ <rdfs:subClassOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
66
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
67
+ >Fictional Entity</rdfs:label>
68
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
69
+ >Something that exists within a story, a literary work or a artwork in general. It can be a character of a movie (e.g. Batman), a place (e.g. Gotham City), a phisical object (e.g. the Bat-Mobile), etc.</rdfs:comment>
70
+ </rdfs:Class>
71
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/hasAuthor">
72
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
73
+ >The author of a Source is the human being (Person) who produced it.</rdfs:comment>
74
+ <rdfs:range rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Person"/>
75
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
76
+ >has author</rdfs:label>
77
+ <rdfs:domain rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
78
+ </owl:ObjectProperty>
79
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/hasSubject">
80
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
81
+ >has subject</rdfs:label>
82
+ <rdfs:domain rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
83
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
84
+ >The subject of a Source can be a Concept, a Person, a Place or whatever the Source talks about or mentions.</rdfs:comment>
85
+ </owl:ObjectProperty>
86
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/hasPart">
87
+ <rdfs:domain rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
88
+ <owl:inverseOf>
89
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/isPartOf"/>
90
+ </owl:inverseOf>
91
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
92
+ >has part</rdfs:label>
93
+ <rdfs:range rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
94
+ </owl:ObjectProperty>
95
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/isPartOf">
96
+ <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
97
+ >A source is part of an other source when it is a component of it. For example a chapter can be part of a book, a sentence can be part of an essay, a picture can be part of a page, etc.</rdfs:comment>
98
+ <rdfs:domain rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
99
+ <owl:inverseOf rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/hasPart"/>
100
+ <rdfs:range rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Source"/>
101
+ <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string"
102
+ >is part of</rdfs:label>
103
+ </owl:ObjectProperty>
104
+ <owl:ObjectProperty rdf:about="http://discovery-project.eu/ontologies/scholar/0.1/isRelatedTo">
105
+ <rdfs:domain rdf:resource="http://discovery-project.eu/ontologies/scholar/0.1/Subject"/>
106
+ </owl:ObjectProperty>
107
+ </rdf:RDF>
108
+
109
+ <!-- Created with Protege (with OWL Plugin 3.4, Build 125) http://protege.stanford.edu -->
@@ -0,0 +1,292 @@
1
+ #!/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ gem 'activerecord'
5
+ require 'active_record'
6
+ require 'fileutils'
7
+ require 'rubygems'
8
+
9
+ rails_dir = File.join(File.dirname(__FILE__), '..')
10
+ plugin_path = File.join(rails_dir, 'vendor', 'plugins', 'talia_core')
11
+ from_gem = true
12
+ if(File.exist?(plugin_path))
13
+ from_gem = false
14
+ $: << File.join(plugin_path, 'lib')
15
+ end
16
+ require 'talia_core'
17
+ talia_dir = TALIA_CODE_ROOT
18
+
19
+ config_dir = File.join(rails_dir, 'config')
20
+ config_template_dir = File.join(talia_dir, 'config')
21
+
22
+ def readl(required = false)
23
+ result = gets.chomp.strip
24
+ while(result == '' && required)
25
+ print 'Must enter a value, retry: '
26
+ result = gets.chomp.strip
27
+ end
28
+ result
29
+ end
30
+
31
+ def read_yn(question)
32
+ question = question + " (yn) "
33
+ print question
34
+ while(!(result = readl) || result == '')
35
+ print question
36
+ end
37
+ (result[0..0].downcase == 'y')
38
+ end
39
+
40
+ puts
41
+ puts "Talia Configuration"
42
+ puts
43
+ puts "This script will assist you in the basic setup of Talia"
44
+ puts
45
+
46
+ puts "Enter the location of the mysql sock file."
47
+ puts "For the self-installed mySQL version on MacOS enter /tmp/mysql.sock"
48
+ puts "Keep the default if you use the builtin mySQL of MacOS X Server."
49
+ puts "For Linux this depends on your distribution."
50
+ print "MySQL sock file (/var/mysql/mysql.sock): "
51
+ sock_file = readl
52
+ sock_file = '/var/mysql/mysql.sock' if(sock_file == '')
53
+ puts
54
+
55
+ mysql_setup = TaliaUtil::Configuration::MysqlDatabaseSetup.new
56
+ mysql_setup.host = 'localhost'
57
+ mysql_setup.app_name = 'talia'
58
+ mysql_setup.sock = sock_file
59
+
60
+ print "Enter the mySQL root pasword: "
61
+ root_pw = readl
62
+ mysql_setup.root_credentials('root', root_pw)
63
+ if(root_pw == '')
64
+ puts
65
+ puts "Your root password is empty. This is not good."
66
+ if(read_yn("Do you want to set a new one?"))
67
+ print "Enter new root password: "
68
+ new_root_pw = readl
69
+ if(mysql_setup.assign_root_pw(new_root_pw))
70
+ puts "... password successfully changed."
71
+ else
72
+ puts "... seems there was a problem changing the password."
73
+ exit 1
74
+ end
75
+ end
76
+ end
77
+
78
+ puts
79
+ puts "Enter the mySQL username for your application. This account will be created automatically."
80
+ print "mySQL account for the application: "
81
+ while((rails_user = readl(true)).size > 16)
82
+ puts "User name cannot have more than 16 characters"
83
+ print "mySQL account for the application: "
84
+ end
85
+ print "Enter the password for this account: "
86
+ rails_pw = readl(true)
87
+
88
+ puts
89
+ print "Enter a database prefix (if you have more than one installation): "
90
+ db_prefix = readl
91
+
92
+ mysql_setup.rails_credentials(rails_user, rails_pw)
93
+ mysql_setup.db_prefix = db_prefix
94
+
95
+ puts
96
+ if(read_yn("Do you want to create the databases now?"))
97
+ puts
98
+ print "Creating databases..."
99
+ mysql_setup.create_default_databases
100
+ mysql_setup.execute
101
+ puts " done."
102
+ end
103
+
104
+ print "Loading the configuration templates..."
105
+ db_config = TaliaUtil::Configuration::DatabaseConfig.new(File.join(config_template_dir, 'database.yml.example'))
106
+ rdf_config = TaliaUtil::Configuration::ConfigFile.new(File.join(config_template_dir, 'rdfstore.yml.example'))
107
+ talia_config = TaliaUtil::Configuration::ConfigFile.new(File.join(config_template_dir, 'talia_core.yml.example'))
108
+ talia_test_config = TaliaUtil::Configuration::ConfigFile.new(File.join(talia_dir, 'test', 'config', 'talia_core.yml_example')) unless(from_gem)
109
+ puts " done."
110
+
111
+ puts
112
+ print "Enter the sql driver you want to use (e.g. jdbcmysql, mysql, ...) [jdbcmysql]: "
113
+ adapter = readl
114
+ adapter = (adapter == '') ? 'jdbcmysql' : adapter
115
+
116
+
117
+ db_config.set_adapter(adapter)
118
+ db_config.set_credentials(rails_user, rails_pw)
119
+ db_config.set_database_names("#{db_prefix}talia")
120
+ # Don't set socket for jdbcmysql
121
+ # db_config.set_socket(sock_file)
122
+
123
+ puts
124
+ print "Enter the site name (it will appear in the window title): "
125
+ talia_config.site_name = readl
126
+
127
+ puts
128
+ print "Enter the URI for your site: "
129
+ site_url = readl(true)
130
+
131
+ if(read_yn('Do you want to use the IIP image server?'))
132
+ puts
133
+ print "Enter the URL of your IIP server, or the port number (for default URL on localhost): "
134
+ iip_url = readl
135
+
136
+ # If only numerals, we'll create the URL
137
+ if(iip_url =~ /^\d*$/)
138
+ iip_url = "http://localhost:#{iip_url}/fcgi-bin/iipsrv.fcgi"
139
+ end
140
+ puts "Setting IIP URL to: #{iip_url}"
141
+
142
+ talia_config.iip_server_uri = iip_url
143
+
144
+ puts
145
+ print "Enter the path to store the IIP image files (return for default): "
146
+ iip_directory = readl
147
+ end
148
+
149
+ puts
150
+ puts "Configuring the Sesame RDF store (change the config by hand for stores other than Sesame)"
151
+ puts
152
+ backends = %w(native memory rdbms http)
153
+ print "Enter the sesame backend to use (#{backends.join('|')}): "
154
+ while(!(backends.include?(backend = readl)))
155
+ puts "#{backend} is not a valid backend"
156
+ print "Enter the backend (#{backends.join('|')}: )"
157
+ end
158
+
159
+ %w(production test development).each do |env|
160
+ rdf_config[env]['type'] = 'sesame'
161
+ rdf_config[env]['backend'] = backend
162
+ end
163
+
164
+ case backend
165
+ when 'native':
166
+ print "Enter the directory to store the Sesame RDF databases (return for default): "
167
+ sesame_directory = readl
168
+ sesame_directory = '.' if(sesame_directory == '')
169
+ %w(production test development).each do |env|
170
+ rdf_config[env]['location'] = File.join(sesame_directory, "sesame_#{env}.db")
171
+ end
172
+ when 'memory':
173
+ puts "Memory backend configured. WARNING: Data will be lost on each restart of the runtime"
174
+ when 'rdbms':
175
+ print "Enter the JDBC driver you want to use for the database connection: "
176
+ driver = readl(true)
177
+ print "Enter the username for the connection: "
178
+ user = readl
179
+ pass = ''
180
+ if(user != '')
181
+ print "Enter the password for the connection: "
182
+ pass = readl
183
+ end
184
+ %(production test development).each do |env|
185
+ rdf_config[env]['driver'] = driver
186
+ rdf_config[env]['user'] = user
187
+ rdf_config[env]['pass'] = pass
188
+ print "Enter the JDBC URL for the '#{env}' environment: "
189
+ rdf_config[env]['url'] = readl(true)
190
+ end
191
+ when 'http':
192
+ print "Enter the username for the connection: "
193
+ user = readl
194
+ pass = ''
195
+ if(user != '')
196
+ print "Enter the password for the connection: "
197
+ pass = readl
198
+ end
199
+ %(production test development).each do |env|
200
+ rdf_config[env]['driver'] = driver
201
+ rdf_config[env]['user'] = user
202
+ rdf_config[env]['pass'] = pass
203
+ print "Enter the URL for the '#{env}' environment: "
204
+ rdf_config[env]['url'] = readl(true)
205
+ end
206
+ else
207
+ puts "ERROR: ILLEGAL BACKEND #{backend} - you shouldn't see this..."
208
+ end
209
+
210
+ if(iip_directory != '')
211
+ talia_config.iip_root_directory_location = iip_directory
212
+ end
213
+
214
+ print "Enter the path to store the data files (return for default): "
215
+ data_directory = readl
216
+
217
+ if(data_directory != '')
218
+ talia_config.data_directory_location = data_directory
219
+ end
220
+
221
+ puts
222
+ print "Enter the prefix/URL where static pages will be loaded (return for internal handler): "
223
+ static_prefix = readl
224
+ talia_config.static_data_prefix = static_prefix if(static_prefix != '')
225
+
226
+ talia_config.local_uri = site_url
227
+
228
+ # These are the locations containing config files
229
+ locations = [ config_dir ]
230
+ locations += [ File.join(talia_dir, 'config'), File.join(talia_dir, 'test', 'config') ] unless(from_gem)
231
+
232
+ if(read_yn("Do you want to write the configuration now? (Overwrites the existing config!)"))
233
+ print "Writing config files..."
234
+ # Writing database and rdf config to all locations
235
+ locations.each do |dir|
236
+ db_config.write(File.join(dir, 'database.yml'))
237
+ rdf_config.write(File.join(dir, 'rdfstore.yml'))
238
+ end
239
+ # Write the talia configurations
240
+ talia_config.write(File.join(config_dir, 'talia_core.yml'))
241
+ unless(from_gem)
242
+ talia_config.write(File.join(talia_dir, 'config', 'talia_core.yml'))
243
+ talia_test_config.rdf_connection = nil
244
+ talia_test_config.rdf_connection_file = 'rdfstore'
245
+ talia_test_config.write(File.join(talia_dir, 'test', 'config', 'talia_core.yml'))
246
+ end
247
+ puts " done."
248
+ else
249
+ puts "Writing config samples to config dir."
250
+ talia_config.write(File.join(config_dir, 'talia_core_auto.yml'))
251
+ rdf_config.write(File.join(config_dir, 'rdfstore_auto.yml'))
252
+ db_config.write(File.join(config_dir, 'database_auto.yml'))
253
+ end
254
+
255
+ puts
256
+ puts "Now migrating the databases"
257
+ %w(test development production).each do |env|
258
+ raise("Error migrating #{env}") unless(system("rake db:migrate RAILS_ENV=#{env}"))
259
+ # raise("Error creating globalize tables in #{env}") unless(system("rake globalize:setup RAILS_ENV=#{env}"))
260
+ puts "Migrated #{env}"
261
+ end
262
+
263
+ puts "Importing ontologies"
264
+ system('rake talia_core:rdf_import files=ontologies/*.owl rdf_syntax=rdfxml')
265
+ system('rake talia_core:owl_to_rdfs_update')
266
+
267
+ # print "Importing language files..."
268
+ # Dir[File.join(rails_dir, 'languages', '*_glob.csv')].each do |lang_file|
269
+ # language = File.basename(lang_file)[0..1] # first two chars are the lang code
270
+ # print " #{language}"
271
+ # raise("Error importing language #{language}") unless(system("rake discovery:import_language language=#{language} file=#{File.expand_path(lang_file)}"))
272
+ # end
273
+ # puts " ... done."
274
+ # puts
275
+
276
+ puts "Customize the start page. The following custom start pages are available:"
277
+ cust_pages = Dir[File.join(rails_dir, 'customization_files', 'start_page', '_start_page_*.html.erb')]
278
+ cust_pages.each do |cust_page|
279
+ # Get the descriptive name
280
+ md = /_start_page_(.*)\.html\.erb/.match(cust_page)
281
+ puts "#{cust_pages.index(cust_page)} - #{md[1]}"
282
+ end
283
+
284
+ if(read_yn('Do you want to build a war file now?'))
285
+ puts
286
+ puts "Building the war file"
287
+ system("warble")
288
+ end
289
+
290
+ puts
291
+ puts "Configuration complete"
292
+ puts
@@ -0,0 +1,100 @@
1
+ #!/bin/env ruby
2
+
3
+ # Image conversion tools and options
4
+ VIPS_COMMAND='/opt/local/bin/vips'
5
+ CONVERT_COMMAND='/opt/local/bin/convert'
6
+ THUMB_OPTIONS = { 'width' => '80', 'height' => '120' }
7
+
8
+ $: << File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'plugins', 'talia_core', 'lib')
9
+ require 'fileutils'
10
+ require 'progressbar'
11
+ require File.join('talia_util', 'image_conversions')
12
+
13
+ begin
14
+ require 'optiflag'
15
+ rescue LoadError
16
+ require 'rubygems'
17
+ gem 'optiflag'
18
+ require 'optiflag'
19
+ end
20
+
21
+ module CommandLineFlags extend OptiFlagSet
22
+
23
+ flag 'input' do
24
+ alternate_forms 'i'
25
+ description 'Input Directory'
26
+ end
27
+
28
+ optional_flag 'output' do
29
+ alternate_forms 'o'
30
+ description 'Output Directory - default: "iip_staging" inside the input dir'
31
+ end
32
+
33
+ optional_switch_flag 'force' do
34
+ description 'Force overwriting of existing files'
35
+ end
36
+
37
+ and_process!
38
+ end
39
+
40
+ # Create the thumbnail by running the configured creation command.
41
+ def create_thumb(source, destination, force = false)
42
+ return if(File.exists?(destination) && !force)
43
+ TaliaUtil::ImageConversions.create_thumb(source, destination)
44
+ end
45
+
46
+ # Creates the pyramid image for IIP by running the configured system
47
+ # command. This automatically creates the file in the correct location
48
+ # (IIP root)
49
+ def create_pyramid(source, destination, force = false)
50
+ return if(File.exists?(destination) && !force)
51
+ TaliaUtil::ImageConversions.create_pyramid(source, destination)
52
+ end
53
+
54
+ # Creates the original image file. If the source file is already a JPG or PNG
55
+ # file, the original is just copied. Otherwise it will be converted into a
56
+ # PNG file.
57
+ def create_original(source, destination, force = false)
58
+ return if(File.exists?(destination) && !force)
59
+ ext = File.extname(source).downcase
60
+ if((ext == '.jpg') || (ext == '.jpeg') || (ext == '.png'))
61
+ # Call the copy as an external command. This is to work around the
62
+ # crashes that occurred using the builtin copy
63
+ from_file = File.expand_path(source)
64
+ to_file = File.expand_path(destination)
65
+ system_success = system("cp #{from_file} #{to_file}")
66
+ raise(IOError, "copy error #{from_file} #{to_file}") unless system_success
67
+ else
68
+ destination = File.join(File.dirname(destination), File.basename(destination, File.extname(destination)))
69
+ TaliaUtil::ImageConversions.to_png(source, destination)
70
+ end
71
+ end
72
+
73
+ flags = CommandLineFlags.flags
74
+
75
+ source_dir = flags.input
76
+ destination = flags.output ? File.expand_path(flags.output) : File.join(source_dir, 'iip_staging')
77
+
78
+ files = Dir["#{source_dir}/*.{jpg,JPG,gif,GIF,png,PNG,tif,TIF,jpeg,JPEG}"]
79
+
80
+ puts "Will process #{files.size} files."
81
+
82
+ progress = ProgressBar.new('Processing', files.size)
83
+ # create data directory path
84
+ FileUtils.mkdir_p(destination)
85
+ FileUtils.mkdir_p(File.join(destination, 'pyramids'))
86
+ FileUtils.mkdir_p(File.join(destination, 'thumbs'))
87
+ FileUtils.mkdir_p(File.join(destination, 'originals'))
88
+
89
+
90
+ files.each do |file|
91
+ file_base = File.basename(file, File.extname(file))
92
+ create_original(file, File.join(destination, 'originals', File.basename(file)), flags.force)
93
+ create_thumb(file, File.join(destination, 'thumbs', "#{file_base}.gif"), flags.force)
94
+ create_pyramid(file, File.join(destination, 'pyramids', "#{file_base}.tif"), flags.force)
95
+ progress.inc
96
+ end
97
+
98
+ progress.finish
99
+ puts "Finished"
100
+
@@ -0,0 +1,51 @@
1
+ #!/bin/sh
2
+
3
+ # First parameter: shell or start, depending on if you want the shell or the server
4
+ # Second parameter: Optional, may give a jruby version if multiple installed in vendor/
5
+
6
+ pd=`dirname "$0"`
7
+ prog_dir=`cd $pd && pwd`
8
+
9
+ if test -n "$2"; then
10
+ JRUBY_VERSION=$2
11
+ fi
12
+
13
+ if test -n "$JRUBY_VERSION"; then
14
+ jruby_special_version=-$JRUBY_VERSION
15
+ else
16
+ jruby_special_version=''
17
+ fi
18
+
19
+ jruby_dir=vendor/jruby$jruby_special_version
20
+
21
+ # We start the shell that the user is currently running
22
+ shell=$SHELL
23
+
24
+ if test -z $SHELL ; then
25
+ # Fall back to bash
26
+ shellbq='/bin/bash'
27
+ fi
28
+
29
+ export PATH=$prog_dir/$jruby_dir/bin:$prog_dir/$jruby_dir/lib/ruby/gems/1.8/bin:$PATH
30
+ export PATH=$prog_dir/lib/scripts:$PATH
31
+ export PATH=$prog_dir/vendor/plugins/talia_core/bin:$PATH
32
+ export PS1="talia-bash \w >> "
33
+
34
+ case $1 in
35
+ shell)
36
+ echo ;
37
+ echo "Opening JRuby environment for Talia (using $shell and jruby from $jruby_dir)..."
38
+ export TALIA_SHELL=true
39
+ $shell -i
40
+ ;;
41
+ start)
42
+ jruby script/server
43
+ ;;
44
+ plugins)
45
+ jruby script/plugin install git://github.com/activescaffold/active_scaffold.git
46
+ jruby script/plugin install git://github.com/timcharper/role_requirement.git
47
+ ;;
48
+ *)
49
+ echo "Usage: $0 [start|shell|plugins]"
50
+ ;;
51
+ esac
@@ -0,0 +1 @@
1
+ require 'talia_util/rake_tasks'
data/lib/loader_helper.rb CHANGED
@@ -45,6 +45,15 @@ module TLoad
45
45
  ActiveSupport::Dependencies.load_paths << TLoad.start_dir unless(ActiveSupport::Dependencies.load_paths.include?(TLoad.start_dir))
46
46
  end
47
47
 
48
+ # Sets up the ActiveSupport autoload path
49
+ def self.setup_load_path
50
+ # set up the load path to talia
51
+ root_dir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
52
+ Kernel.const_set(:TALIA_CODE_ROOT, root_dir) unless(defined?(TALIA_CODE_ROOT))
53
+ lib_dir = File.join(root_dir, 'lib')
54
+ ActiveSupport::Dependencies.load_paths << lib_dir unless(ActiveSupport::Dependencies.load_paths.include?(lib_dir))
55
+ end
56
+
48
57
  private
49
58
 
50
59
  def self.load_from_gem(gem_name, local_name, gem_version)
data/lib/talia_core.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # TaliaCore loader
2
2
  require File.dirname(__FILE__) + '/talia_dependencies'
3
3
 
4
- TLoad::force_rails_parts unless(defined?(ActiveRecord))
5
-
6
4
  # Load local things
7
5
  require 'talia_core/errors'
8
6
  require 'talia_core/rails_ext'
@@ -9,4 +9,9 @@ TLoad::require_module("assit", "assit", "/../../assit") unless(defined?(assit))
9
9
  TLoad::require_module("activerdf_net7", "active_rdf", "/../../ActiveRDF")
10
10
  TLoad::require_module("semantic_naming", "semantic_naming", "/../../semantic_naming")
11
11
 
12
+ # Rails parts
13
+ TLoad::force_rails_parts unless(defined?(ActiveRecord))
14
+ TLoad::setup_load_path
15
+
16
+
12
17
  require 'version'