iqvoc_inflectionals 2.1.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +25 -13
- data/Gemfile +6 -4
- data/Gemfile.lock +256 -100
- data/README.md +2 -5
- data/app/assets/stylesheets/manifest.css.scss +2 -0
- data/app/models/concerns/inflectionable.rb +67 -0
- data/app/models/inflectional/base.rb +24 -8
- data/app/views/partials/inflectional/_edit_base.html.erb +4 -7
- data/app/views/partials/inflectional/_search_result.html.erb +3 -1
- data/bin/rails +10 -0
- data/bin/rake +7 -0
- data/bin/spring +18 -0
- data/config/database.yml.mysql +3 -3
- data/config/engine.rb +1 -1
- data/config/environments/development.rb +0 -1
- data/config/environments/test.rb +0 -1
- data/config/initializers/iqvoc.rb +5 -2
- data/config/secrets.yml +11 -0
- data/iqvoc_inflectionals.gemspec +2 -3
- data/lib/iqvoc/inflectionals/version.rb +1 -1
- data/lib/tasks/inflectionals.rake +10 -0
- data/test/fixtures/hobbies.nt +11 -0
- data/test/test_helper.rb +1 -1
- data/test/unit/import_test.rb +32 -0
- data/test/unit/inflectional_test.rb +0 -4
- metadata +32 -21
- data/config/initializers/label_extensions.rb +0 -6
- data/config/initializers/secret_token.rb.template +0 -16
- data/db/schema.rb +0 -158
- data/lib/iqvoc/inflectionals/label_extensions.rb +0 -75
- data/script/ci/travis-before-build +0 -19
- data/script/ci/travis-build +0 -10
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# Be sure to restart your server when you modify this file.
|
4
|
-
|
5
|
-
if Iqvoc::Inflectionals.const_defined?(:Application)
|
6
|
-
|
7
|
-
# Your secret key for verifying the integrity of signed cookies.
|
8
|
-
# If you change this key, all old signed cookies will become invalid!
|
9
|
-
# Make sure the secret is at least 30 characters and all random,
|
10
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
11
|
-
|
12
|
-
# Run `rake secret` and uncomment the following line
|
13
|
-
# Replace the secret-placeholder with your generated token
|
14
|
-
Iqvoc::Inflectionals::Application.config.secret_token = "S-E-C-R-E-T"
|
15
|
-
|
16
|
-
end
|
data/db/schema.rb
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended to check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(:version => 20120109143704) do
|
15
|
-
|
16
|
-
create_table "collection_members", :force => true do |t|
|
17
|
-
t.integer "collection_id"
|
18
|
-
t.integer "target_id"
|
19
|
-
t.string "type"
|
20
|
-
end
|
21
|
-
|
22
|
-
add_index "collection_members", ["collection_id", "target_id", "type"], :name => "ix_collections_fk_type"
|
23
|
-
|
24
|
-
create_table "concept_relations", :force => true do |t|
|
25
|
-
t.string "type"
|
26
|
-
t.integer "owner_id"
|
27
|
-
t.integer "target_id"
|
28
|
-
t.datetime "created_at"
|
29
|
-
t.datetime "updated_at"
|
30
|
-
end
|
31
|
-
|
32
|
-
add_index "concept_relations", ["owner_id", "target_id"], :name => "ix_concept_relations_fk"
|
33
|
-
|
34
|
-
create_table "concepts", :force => true do |t|
|
35
|
-
t.string "type"
|
36
|
-
t.string "origin", :limit => 4000
|
37
|
-
t.integer "rev", :default => 1
|
38
|
-
t.date "published_at"
|
39
|
-
t.integer "published_version_id"
|
40
|
-
t.integer "locked_by"
|
41
|
-
t.date "expired_at"
|
42
|
-
t.date "follow_up"
|
43
|
-
t.boolean "to_review"
|
44
|
-
t.date "rdf_updated_at"
|
45
|
-
t.datetime "created_at"
|
46
|
-
t.datetime "updated_at"
|
47
|
-
end
|
48
|
-
|
49
|
-
add_index "concepts", ["origin"], :name => "ix_concepts_on_origin"
|
50
|
-
add_index "concepts", ["published_version_id"], :name => "ix_concepts_publ_version_id"
|
51
|
-
|
52
|
-
create_table "inflectionals", :force => true do |t|
|
53
|
-
t.datetime "created_at"
|
54
|
-
t.datetime "updated_at"
|
55
|
-
t.integer "label_id"
|
56
|
-
t.string "value", :limit => 4000
|
57
|
-
t.string "normal_hash"
|
58
|
-
end
|
59
|
-
|
60
|
-
add_index "inflectionals", ["label_id"], :name => "ix_inflectionals_fk"
|
61
|
-
add_index "inflectionals", ["normal_hash"], :name => "ix_inflectionals_normal_hash"
|
62
|
-
|
63
|
-
create_table "label_relations", :force => true do |t|
|
64
|
-
t.string "type"
|
65
|
-
t.integer "domain_id"
|
66
|
-
t.integer "range_id"
|
67
|
-
t.datetime "created_at"
|
68
|
-
t.datetime "updated_at"
|
69
|
-
end
|
70
|
-
|
71
|
-
add_index "label_relations", ["domain_id", "range_id", "type"], :name => "ix_label_rel_dom_rng_type"
|
72
|
-
add_index "label_relations", ["type"], :name => "ix_label_relations_on_type"
|
73
|
-
|
74
|
-
create_table "labelings", :force => true do |t|
|
75
|
-
t.string "type"
|
76
|
-
t.integer "owner_id"
|
77
|
-
t.integer "target_id"
|
78
|
-
t.datetime "created_at"
|
79
|
-
t.datetime "updated_at"
|
80
|
-
end
|
81
|
-
|
82
|
-
add_index "labelings", ["owner_id", "target_id", "type"], :name => "ix_labelings_fk_type"
|
83
|
-
add_index "labelings", ["type"], :name => "ix_labelings_on_type"
|
84
|
-
|
85
|
-
create_table "labels", :force => true do |t|
|
86
|
-
t.string "type"
|
87
|
-
t.string "origin", :limit => 4000
|
88
|
-
t.string "language"
|
89
|
-
t.string "value", :limit => 1024
|
90
|
-
t.datetime "created_at"
|
91
|
-
t.datetime "updated_at"
|
92
|
-
t.integer "rev", :default => 1
|
93
|
-
t.integer "published_version_id"
|
94
|
-
t.date "published_at"
|
95
|
-
t.integer "locked_by"
|
96
|
-
t.date "expired_at"
|
97
|
-
t.date "follow_up"
|
98
|
-
t.boolean "to_review"
|
99
|
-
t.date "rdf_updated_at"
|
100
|
-
end
|
101
|
-
|
102
|
-
add_index "labels", ["language"], :name => "ix_labels_on_language"
|
103
|
-
add_index "labels", ["origin"], :name => "ix_labels_on_origin"
|
104
|
-
add_index "labels", ["published_version_id"], :name => "ix_labels_on_published_v"
|
105
|
-
add_index "labels", ["value"], :name => "ix_labels_on_value"
|
106
|
-
|
107
|
-
create_table "matches", :force => true do |t|
|
108
|
-
t.integer "concept_id"
|
109
|
-
t.string "type"
|
110
|
-
t.string "value"
|
111
|
-
t.datetime "created_at"
|
112
|
-
t.datetime "updated_at"
|
113
|
-
end
|
114
|
-
|
115
|
-
add_index "matches", ["concept_id", "type"], :name => "ix_matches_fk_type"
|
116
|
-
add_index "matches", ["type"], :name => "ix_matches_on_type"
|
117
|
-
|
118
|
-
create_table "note_annotations", :force => true do |t|
|
119
|
-
t.integer "note_id"
|
120
|
-
t.string "predicate", :limit => 50
|
121
|
-
t.string "value", :limit => 1024
|
122
|
-
t.datetime "created_at"
|
123
|
-
t.datetime "updated_at"
|
124
|
-
t.string "namespace", :limit => 50
|
125
|
-
end
|
126
|
-
|
127
|
-
add_index "note_annotations", ["note_id"], :name => "ix_note_annotations_fk"
|
128
|
-
|
129
|
-
create_table "notes", :force => true do |t|
|
130
|
-
t.string "language", :limit => 2
|
131
|
-
t.string "value", :limit => 4000
|
132
|
-
t.string "type", :limit => 50
|
133
|
-
t.datetime "created_at"
|
134
|
-
t.datetime "updated_at"
|
135
|
-
t.integer "owner_id"
|
136
|
-
t.string "owner_type", :null => false
|
137
|
-
end
|
138
|
-
|
139
|
-
add_index "notes", ["language"], :name => "ix_notes_on_language"
|
140
|
-
add_index "notes", ["owner_id", "owner_type", "type"], :name => "ix_notes_fk_type"
|
141
|
-
add_index "notes", ["type"], :name => "ix_notes_on_type"
|
142
|
-
|
143
|
-
create_table "users", :force => true do |t|
|
144
|
-
t.string "forename"
|
145
|
-
t.string "surname"
|
146
|
-
t.string "email"
|
147
|
-
t.string "crypted_password"
|
148
|
-
t.boolean "active"
|
149
|
-
t.datetime "created_at"
|
150
|
-
t.datetime "updated_at"
|
151
|
-
t.string "password_salt"
|
152
|
-
t.string "persistence_token"
|
153
|
-
t.string "perishable_token"
|
154
|
-
t.string "role"
|
155
|
-
t.string "telephone_number"
|
156
|
-
end
|
157
|
-
|
158
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Iqvoc
|
6
|
-
module Inflectionals
|
7
|
-
module LabelExtensions
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
|
10
|
-
included do
|
11
|
-
attr_reader :inflectionals_attributes
|
12
|
-
after_save :overwrite_inflectionals!
|
13
|
-
|
14
|
-
after_save do |label|
|
15
|
-
# ensure a matching inflectional exists
|
16
|
-
if Inflectional::Base.where(:label_id => label.id, :value => label.value).none?
|
17
|
-
label.inflectionals.create(:value => label.value)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
has_many :inflectionals,
|
22
|
-
:class_name => "Inflectional::Base",
|
23
|
-
:foreign_key => "label_id",
|
24
|
-
:dependent => :destroy
|
25
|
-
end
|
26
|
-
|
27
|
-
def endings
|
28
|
-
Inflectional::Base.for_language_and_code(language, inflectional_code)
|
29
|
-
end
|
30
|
-
|
31
|
-
def generate_inflectionals!
|
32
|
-
return send(Inflectional::Base.name.to_relation_name) if base_form.blank?
|
33
|
-
|
34
|
-
converted_literal_form = Iqvoc::Origin.new(value).replace_umlauts.to_s
|
35
|
-
|
36
|
-
diff = Iqvoc::Origin.new(converted_literal_form).sanitize_base_form.to_s.size - base_form.size
|
37
|
-
|
38
|
-
unless base_form.blank?
|
39
|
-
new_base_form = converted_literal_form[0..(base_form.length-1)]
|
40
|
-
end
|
41
|
-
|
42
|
-
Rails.logger.debug "converted_literal_form => #{converted_literal_form} (#{converted_literal_form.size}) |
|
43
|
-
base_form => #{base_form} (#{base_form.size}) |
|
44
|
-
new_base_form => #{new_base_form} |
|
45
|
-
value => #{value} (#{value.size}) |
|
46
|
-
diff => #{diff}"
|
47
|
-
|
48
|
-
endings.each do |ending|
|
49
|
-
value = ending == "." ? new_base_form : (new_base_form + ending.downcase)
|
50
|
-
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
51
|
-
end
|
52
|
-
|
53
|
-
self.base_form = new_base_form
|
54
|
-
save(:validate => false)
|
55
|
-
|
56
|
-
send(Inflectional::Base.name.to_relation_name)
|
57
|
-
end
|
58
|
-
|
59
|
-
def inflectionals_attributes=(str)
|
60
|
-
@inflectionals_attributes = str.split("\r\n")
|
61
|
-
end
|
62
|
-
|
63
|
-
def overwrite_inflectionals!
|
64
|
-
return unless inflectionals_attributes
|
65
|
-
transaction do
|
66
|
-
send(Inflectional::Base.name.to_relation_name).delete_all
|
67
|
-
inflectionals_attributes.each do |value|
|
68
|
-
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Start virtual X frame buffer
|
4
|
-
system "sh -e /etc/init.d/xvfb start"
|
5
|
-
sleep 3
|
6
|
-
|
7
|
-
# Create a database.yml for the current database env
|
8
|
-
puts "Setting up database.yml for #{ENV["DB"]}"
|
9
|
-
system "cp config/database.yml.#{ENV["DB"]} config/database.yml"
|
10
|
-
|
11
|
-
# Generate and copy secret token initializer
|
12
|
-
secret = `bundle exec rake secret`.strip
|
13
|
-
path = File.join(File.dirname(__FILE__), '../../config/initializers/')
|
14
|
-
template = File.read(File.join(path, 'secret_token.rb.template'))
|
15
|
-
|
16
|
-
template.gsub!('S-E-C-R-E-T', secret)
|
17
|
-
File.open(File.join(path, 'secret_token.rb'), 'w') do |file|
|
18
|
-
file.puts template
|
19
|
-
end
|