iqvoc_inflectionals 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile +4 -3
- data/Gemfile.lock +47 -48
- data/app/models/inflectional/base.rb +2 -2
- data/config/engine.rb +0 -2
- data/config/environments/development.rb +4 -50
- data/config/environments/production.rb +3 -59
- data/config/environments/test.rb +4 -41
- data/config/initializers/iqvoc.rb +1 -1
- data/iqvoc_inflectionals.gemspec +3 -3
- data/lib/iqvoc/inflectionals/label_extensions.rb +65 -13
- data/lib/iqvoc/inflectionals/version.rb +1 -1
- metadata +14 -15
- data/app/models/inflectional/label_extension.rb +0 -58
- /data/config/initializers/{engine_extensions.rb → label_extensions.rb} +0 -0
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,35 +1,34 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
actionmailer (3.1
|
5
|
-
actionpack (= 3.1
|
6
|
-
mail (~> 2.
|
7
|
-
actionpack (3.1
|
8
|
-
activemodel (= 3.1
|
9
|
-
activesupport (= 3.1
|
4
|
+
actionmailer (3.2.1)
|
5
|
+
actionpack (= 3.2.1)
|
6
|
+
mail (~> 2.4.0)
|
7
|
+
actionpack (3.2.1)
|
8
|
+
activemodel (= 3.2.1)
|
9
|
+
activesupport (= 3.2.1)
|
10
10
|
builder (~> 3.0.0)
|
11
11
|
erubis (~> 2.7.0)
|
12
|
-
|
13
|
-
rack (~> 1.
|
12
|
+
journey (~> 1.0.1)
|
13
|
+
rack (~> 1.4.0)
|
14
14
|
rack-cache (~> 1.1)
|
15
|
-
rack-mount (~> 0.8.2)
|
16
15
|
rack-test (~> 0.6.1)
|
17
|
-
sprockets (~> 2.
|
18
|
-
activemodel (3.1
|
19
|
-
activesupport (= 3.1
|
16
|
+
sprockets (~> 2.1.2)
|
17
|
+
activemodel (3.2.1)
|
18
|
+
activesupport (= 3.2.1)
|
20
19
|
builder (~> 3.0.0)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
arel (~> 2.2.1)
|
20
|
+
activerecord (3.2.1)
|
21
|
+
activemodel (= 3.2.1)
|
22
|
+
activesupport (= 3.2.1)
|
23
|
+
arel (~> 3.0.0)
|
26
24
|
tzinfo (~> 0.3.29)
|
27
|
-
activeresource (3.1
|
28
|
-
activemodel (= 3.1
|
29
|
-
activesupport (= 3.1
|
30
|
-
activesupport (3.1
|
25
|
+
activeresource (3.2.1)
|
26
|
+
activemodel (= 3.2.1)
|
27
|
+
activesupport (= 3.2.1)
|
28
|
+
activesupport (3.2.1)
|
29
|
+
i18n (~> 0.6)
|
31
30
|
multi_json (~> 1.0)
|
32
|
-
arel (
|
31
|
+
arel (3.0.0)
|
33
32
|
authlogic (3.1.0)
|
34
33
|
activerecord (>= 3.0.7)
|
35
34
|
activerecord (>= 3.0.7)
|
@@ -38,55 +37,54 @@ GEM
|
|
38
37
|
erubis (2.7.0)
|
39
38
|
hike (1.2.1)
|
40
39
|
i18n (0.6.0)
|
41
|
-
iq_rdf (0.1.
|
40
|
+
iq_rdf (0.1.2)
|
42
41
|
builder
|
43
42
|
bundler
|
44
|
-
iqvoc (3.
|
43
|
+
iqvoc (3.5.1)
|
45
44
|
authlogic
|
46
45
|
bundler
|
47
46
|
cancan
|
48
|
-
iq_rdf (~> 0.1.
|
47
|
+
iq_rdf (~> 0.1.2)
|
49
48
|
json
|
50
49
|
kaminari
|
51
|
-
rails (~> 3.1
|
50
|
+
rails (~> 3.2.1)
|
52
51
|
rails_autolink
|
53
|
-
iqvoc_skosxl (1.
|
52
|
+
iqvoc_skosxl (1.2.0)
|
54
53
|
bundler
|
55
|
-
iqvoc
|
54
|
+
iqvoc (~> 3.5.1)
|
55
|
+
journey (1.0.1)
|
56
56
|
json (1.6.5)
|
57
57
|
kaminari (0.13.0)
|
58
58
|
actionpack (>= 3.0.0)
|
59
59
|
activesupport (>= 3.0.0)
|
60
60
|
railties (>= 3.0.0)
|
61
|
-
mail (2.
|
61
|
+
mail (2.4.1)
|
62
62
|
i18n (>= 0.4.0)
|
63
63
|
mime-types (~> 1.16)
|
64
64
|
treetop (~> 1.4.8)
|
65
65
|
mime-types (1.17.2)
|
66
66
|
multi_json (1.0.4)
|
67
67
|
polyglot (0.3.3)
|
68
|
-
rack (1.
|
68
|
+
rack (1.4.1)
|
69
69
|
rack-cache (1.1)
|
70
70
|
rack (>= 0.4)
|
71
|
-
rack-mount (0.8.3)
|
72
|
-
rack (>= 1.0.0)
|
73
71
|
rack-ssl (1.3.2)
|
74
72
|
rack
|
75
73
|
rack-test (0.6.1)
|
76
74
|
rack (>= 1.0)
|
77
|
-
rails (3.1
|
78
|
-
actionmailer (= 3.1
|
79
|
-
actionpack (= 3.1
|
80
|
-
activerecord (= 3.1
|
81
|
-
activeresource (= 3.1
|
82
|
-
activesupport (= 3.1
|
75
|
+
rails (3.2.1)
|
76
|
+
actionmailer (= 3.2.1)
|
77
|
+
actionpack (= 3.2.1)
|
78
|
+
activerecord (= 3.2.1)
|
79
|
+
activeresource (= 3.2.1)
|
80
|
+
activesupport (= 3.2.1)
|
83
81
|
bundler (~> 1.0)
|
84
|
-
railties (= 3.1
|
85
|
-
rails_autolink (1.0.
|
86
|
-
rails (
|
87
|
-
railties (3.1
|
88
|
-
actionpack (= 3.1
|
89
|
-
activesupport (= 3.1
|
82
|
+
railties (= 3.2.1)
|
83
|
+
rails_autolink (1.0.5)
|
84
|
+
rails (~> 3.1)
|
85
|
+
railties (3.2.1)
|
86
|
+
actionpack (= 3.2.1)
|
87
|
+
activesupport (= 3.2.1)
|
90
88
|
rack-ssl (~> 1.3.2)
|
91
89
|
rake (>= 0.8.7)
|
92
90
|
rdoc (~> 3.4)
|
@@ -94,10 +92,10 @@ GEM
|
|
94
92
|
rake (0.9.2.2)
|
95
93
|
rdoc (3.12)
|
96
94
|
json (~> 1.4)
|
97
|
-
spork (0.9.0
|
95
|
+
spork (0.9.0)
|
98
96
|
spork-testunit (0.0.7)
|
99
97
|
spork (>= 0.6.0)
|
100
|
-
sprockets (2.
|
98
|
+
sprockets (2.1.2)
|
101
99
|
hike (~> 1.2)
|
102
100
|
rack (~> 1.0)
|
103
101
|
tilt (~> 1.1, != 1.3.0)
|
@@ -114,8 +112,9 @@ PLATFORMS
|
|
114
112
|
ruby
|
115
113
|
|
116
114
|
DEPENDENCIES
|
117
|
-
iqvoc (~> 3.
|
118
|
-
iqvoc_skosxl (~> 1.
|
115
|
+
iqvoc (~> 3.5.1)
|
116
|
+
iqvoc_skosxl (~> 1.2.0)
|
117
|
+
rails (~> 3.2.1)
|
119
118
|
spork (~> 0.9.0.rc)
|
120
119
|
spork-testunit
|
121
120
|
sqlite3
|
@@ -8,7 +8,7 @@ class Inflectional::Base < ActiveRecord::Base
|
|
8
8
|
self.rdf_namespace = 'umt'
|
9
9
|
self.rdf_predicate = 'inflectional'
|
10
10
|
|
11
|
-
|
11
|
+
self.table_name ='inflectionals'
|
12
12
|
|
13
13
|
validates :value, :presence => true
|
14
14
|
validates :label_id, :presence => true
|
@@ -310,7 +310,7 @@ class Inflectional::Base < ActiveRecord::Base
|
|
310
310
|
|
311
311
|
def self.referenced_by(label_class)
|
312
312
|
# To something with the label class
|
313
|
-
label_class.send(:include,
|
313
|
+
label_class.send(:include, Iqvoc::Inflectionals::LabelExtensions)
|
314
314
|
end
|
315
315
|
|
316
316
|
def self.deep_cloning_relations
|
data/config/engine.rb
CHANGED
@@ -1,55 +1,9 @@
|
|
1
|
+
require 'debug'
|
2
|
+
require 'iqvoc/environments/development'
|
3
|
+
|
1
4
|
if Iqvoc::Inflectionals.const_defined?(:Application)
|
2
5
|
Iqvoc::Inflectionals::Application.configure do
|
3
6
|
# Settings specified here will take precedence over those in config/environment.rb
|
4
|
-
|
5
|
-
# In the development environment your application's code is reloaded on
|
6
|
-
# every request. This slows down response time but is perfect for development
|
7
|
-
# since you don't have to restart the web server when you make code changes.
|
8
|
-
config.cache_classes = false
|
9
|
-
|
10
|
-
# Log error messages when you accidentally call methods on nil.
|
11
|
-
config.whiny_nils = true
|
12
|
-
|
13
|
-
# Show full error reports and disable caching
|
14
|
-
config.consider_all_requests_local = true
|
15
|
-
config.action_controller.perform_caching = false
|
16
|
-
|
17
|
-
# Don't care if the mailer can't send
|
18
|
-
config.action_mailer.raise_delivery_errors = false
|
19
|
-
|
20
|
-
# Print deprecation notices to the Rails logger
|
21
|
-
config.active_support.deprecation = :log
|
22
|
-
|
23
|
-
# Only use best-standards-support built into browsers
|
24
|
-
config.action_dispatch.best_standards_support = :builtin
|
25
|
-
|
26
|
-
# The default URI prefix for RDF data. This will be followed by a document-
|
27
|
-
# specific snippet like (specimenType) and the id.
|
28
|
-
|
29
|
-
# Do not compress assets
|
30
|
-
config.assets.compress = false
|
31
|
-
|
32
|
-
# Expands the lines which load the assets
|
33
|
-
config.assets.debug = true
|
34
|
-
|
35
|
-
# The JDBC driver URL for the connection to the virtuoso triple store.
|
36
|
-
# Login credentials have to be stored here too. See
|
37
|
-
# http://docs.openlinksw.com/virtuoso/VirtuosoDriverJDBC.html#jdbcurl4mat for
|
38
|
-
# more details.
|
39
|
-
# Example: "jdbc:virtuoso://localhost:1111/UID=dba/PWD=dba"
|
40
|
-
# Use nil to disable virtuoso triple synchronization
|
41
|
-
# Rails.application.config.virtuoso_jdbc_driver_url = "jdbc:virtuoso://virtuoso.dyndns.org:1111/UID=iqvoc/PWD=vocpass!/charset=UTF-8"
|
42
|
-
config.virtuoso_jdbc_driver_url = nil
|
43
|
-
|
44
|
-
# Set up the virtuoso synchronization (which is a triggered pull from the
|
45
|
-
# virtuoso server) to be run in a new thread.
|
46
|
-
# This is needed in environments where the web server only runs in a single
|
47
|
-
# process/thread (mostly in development environments).
|
48
|
-
# When a synchronization would be triggered e.g. from a running
|
49
|
-
# update action in the UPB, the update would trigger virtuoso to do a HTTP GET
|
50
|
-
# back to the UPB to fetch the RDF data. But the only process in the UPB would be
|
51
|
-
# blocked by the update... => Deadlock. You can avoid this by using the threaded
|
52
|
-
# mode.
|
53
|
-
config.virtuoso_sync_threaded = false
|
7
|
+
Iqvoc::Environments.setup_development(config)
|
54
8
|
end
|
55
9
|
end
|
@@ -1,64 +1,8 @@
|
|
1
|
+
require 'iqvoc/environments/production'
|
2
|
+
|
1
3
|
if Iqvoc::Inflectionals.const_defined?(:Application)
|
2
4
|
Iqvoc::Inflectionals::Application.configure do
|
3
5
|
# Settings specified here will take precedence over those in config/environment.rb
|
4
|
-
|
5
|
-
# The production environment is meant for finished, "live" apps.
|
6
|
-
# Code is not reloaded between requests
|
7
|
-
config.cache_classes = true
|
8
|
-
|
9
|
-
# Full error reports are disabled and caching is turned on
|
10
|
-
config.consider_all_requests_local = false
|
11
|
-
config.action_controller.perform_caching = true
|
12
|
-
|
13
|
-
# Specifies the header that your server uses for sending files
|
14
|
-
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
15
|
-
|
16
|
-
# For nginx:
|
17
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
18
|
-
|
19
|
-
# If you have no front-end server that supports something like X-Sendfile,
|
20
|
-
# just comment this out and Rails will serve the files
|
21
|
-
|
22
|
-
# See everything in the log (default is :info)
|
23
|
-
# config.log_level = :debug
|
24
|
-
|
25
|
-
# Use a different logger for distributed setups
|
26
|
-
# config.logger = SyslogLogger.new
|
27
|
-
|
28
|
-
# Use a different cache store in production
|
29
|
-
# config.cache_store = :mem_cache_store
|
30
|
-
|
31
|
-
# Disable Rails's static asset server
|
32
|
-
# In production, Apache or nginx will already do this
|
33
|
-
config.serve_static_assets = false
|
34
|
-
|
35
|
-
# Enable serving of images, stylesheets, and javascripts from an asset server
|
36
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
37
|
-
|
38
|
-
# Disable delivery errors, bad email addresses will be ignored
|
39
|
-
# config.action_mailer.raise_delivery_errors = false
|
40
|
-
|
41
|
-
# Enable threaded mode
|
42
|
-
# config.threadsafe!
|
43
|
-
|
44
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
45
|
-
# the I18n.default_locale when a translation can not be found)
|
46
|
-
config.i18n.fallbacks = true
|
47
|
-
|
48
|
-
# Send deprecation notices to registered listeners
|
49
|
-
config.active_support.deprecation = :notify
|
50
|
-
|
51
|
-
# Disable Rails's static asset server
|
52
|
-
# In production, Apache or nginx will already do this
|
53
|
-
config.serve_static_assets = false
|
54
|
-
|
55
|
-
# Compress JavaScripts and CSS
|
56
|
-
config.assets.compress = true
|
57
|
-
|
58
|
-
# Don't fallback to assets pipeline if a precompiled asset is missed
|
59
|
-
config.assets.compile = false
|
60
|
-
|
61
|
-
# Generate digests for assets URLs
|
62
|
-
config.assets.digest = true
|
6
|
+
Iqvoc::Environments.setup_production(config)
|
63
7
|
end
|
64
8
|
end
|
data/config/environments/test.rb
CHANGED
@@ -1,46 +1,9 @@
|
|
1
|
+
require 'debug'
|
2
|
+
require 'iqvoc/environments/test'
|
3
|
+
|
1
4
|
if Iqvoc::Inflectionals.const_defined?(:Application)
|
2
5
|
Iqvoc::Inflectionals::Application.configure do
|
3
6
|
# Settings specified here will take precedence over those in config/environment.rb
|
4
|
-
|
5
|
-
config.autoload_paths += [Rails.root.join("test")]
|
6
|
-
|
7
|
-
# The test environment is used exclusively to run your application's
|
8
|
-
# test suite. You never need to work with it otherwise. Remember that
|
9
|
-
# your test database is "scratch space" for the test suite and is wiped
|
10
|
-
# and recreated between test runs. Don't rely on the data there!
|
11
|
-
config.cache_classes = true
|
12
|
-
|
13
|
-
# Log error messages when you accidentally call methods on nil.
|
14
|
-
config.whiny_nils = true
|
15
|
-
|
16
|
-
# Show full error reports and disable caching
|
17
|
-
config.consider_all_requests_local = true
|
18
|
-
config.action_controller.perform_caching = false
|
19
|
-
|
20
|
-
# Raise exceptions instead of rendering exception templates
|
21
|
-
config.action_dispatch.show_exceptions = false
|
22
|
-
|
23
|
-
# Disable request forgery protection in test environment
|
24
|
-
config.action_controller.allow_forgery_protection = false
|
25
|
-
|
26
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
27
|
-
# The :test delivery method accumulates sent emails in the
|
28
|
-
# ActionMailer::Base.deliveries array.
|
29
|
-
config.action_mailer.delivery_method = :test
|
30
|
-
|
31
|
-
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
32
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
33
|
-
# like if you have constraints or database-specific column types
|
34
|
-
# config.active_record.schema_format = :sql
|
35
|
-
|
36
|
-
# Print deprecation notices to the stderr
|
37
|
-
config.active_support.deprecation = :stderr
|
38
|
-
|
39
|
-
# Configure static asset server for tests with Cache-Control for performance
|
40
|
-
config.serve_static_assets = true
|
41
|
-
config.static_cache_control = "public, max-age=3600"
|
42
|
-
|
43
|
-
# Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
|
44
|
-
config.assets.allow_debugging = true
|
7
|
+
Iqvoc::Environments.setup_test(config)
|
45
8
|
end
|
46
9
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'iqvoc/xllabel' # XXX: this basically duplicates iqvoc_skosxl's initializer - but is required to ensure correct loading order!?
|
4
4
|
|
5
|
-
Iqvoc.title
|
5
|
+
Iqvoc.config.register_setting("title", "iQvoc Inflectionals")
|
6
6
|
|
7
7
|
#Iqvoc.searchable_class_names << "Inflectional::Base" # XXX: application's responsibility!?
|
8
8
|
|
data/iqvoc_inflectionals.gemspec
CHANGED
@@ -15,9 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.rubyforge_project = "iqvoc_inflectionals"
|
17
17
|
|
18
|
-
s.add_dependency "rails", "~> 3.1
|
19
|
-
s.add_dependency "iqvoc"
|
20
|
-
s.add_dependency "iqvoc_skosxl"
|
18
|
+
s.add_dependency "rails", "~> 3.2.1"
|
19
|
+
s.add_dependency "iqvoc", "~> 3.5.1"
|
20
|
+
s.add_dependency "iqvoc_skosxl", "~> 1.2.0"
|
21
21
|
|
22
22
|
s.files = `git ls-files`.split("\n")
|
23
23
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
@@ -2,22 +2,74 @@
|
|
2
2
|
|
3
3
|
require "active_support/concern"
|
4
4
|
|
5
|
-
module Iqvoc
|
6
|
-
|
5
|
+
module Iqvoc
|
6
|
+
module Inflectionals
|
7
|
+
module LabelExtensions
|
8
|
+
extend ActiveSupport::Concern
|
7
9
|
|
8
|
-
|
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
|
10
20
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
21
|
+
has_many :inflectionals,
|
22
|
+
:class_name => "Inflectional::Base",
|
23
|
+
:foreign_key => "label_id",
|
24
|
+
:dependent => :destroy
|
15
25
|
end
|
16
|
-
|
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 = OriginMapping.replace_umlauts(value)
|
35
|
+
|
36
|
+
diff = OriginMapping.sanitize_for_base_form(converted_literal_form).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
|
17
52
|
|
18
|
-
|
19
|
-
:
|
20
|
-
|
21
|
-
|
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
|
22
74
|
end
|
23
75
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iqvoc_inflectionals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,41 +11,41 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-01
|
14
|
+
date: 2012-02-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &70349800951440 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 3.1
|
23
|
+
version: 3.2.1
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70349800951440
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: iqvoc
|
29
|
-
requirement: &
|
29
|
+
requirement: &70349800949700 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: 3.5.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70349800949700
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: iqvoc_skosxl
|
40
|
-
requirement: &
|
40
|
+
requirement: &70349800948360 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.2.0
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70349800948360
|
49
49
|
description: ''
|
50
50
|
email:
|
51
51
|
- robert.glaser@innoq.com
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- README.md
|
60
60
|
- Rakefile
|
61
61
|
- app/models/inflectional/base.rb
|
62
|
-
- app/models/inflectional/label_extension.rb
|
63
62
|
- app/views/partials/inflectional/_base.html.erb
|
64
63
|
- app/views/partials/inflectional/_edit_base.html.erb
|
65
64
|
- app/views/partials/inflectional/_search_result.html.erb
|
@@ -72,8 +71,8 @@ files:
|
|
72
71
|
- config/environments/development.rb
|
73
72
|
- config/environments/production.rb
|
74
73
|
- config/environments/test.rb
|
75
|
-
- config/initializers/engine_extensions.rb
|
76
74
|
- config/initializers/iqvoc.rb
|
75
|
+
- config/initializers/label_extensions.rb
|
77
76
|
- config/initializers/secret_token.rb.template
|
78
77
|
- config/initializers/session_store.rb
|
79
78
|
- config/locales/activerecord.de.yml
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
module Inflectional::LabelExtension
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
attr_reader :inflectionals_attributes
|
10
|
-
after_save :overwrite_inflectionals!
|
11
|
-
end
|
12
|
-
|
13
|
-
def endings
|
14
|
-
Inflectional::Base.for_language_and_code(language, inflectional_code)
|
15
|
-
end
|
16
|
-
|
17
|
-
def generate_inflectionals!
|
18
|
-
return send(Inflectional::Base.name.to_relation_name) if base_form.blank?
|
19
|
-
|
20
|
-
converted_literal_form = OriginMapping.replace_umlauts(value)
|
21
|
-
|
22
|
-
diff = OriginMapping.sanitize_for_base_form(converted_literal_form).size - base_form.size
|
23
|
-
|
24
|
-
unless base_form.blank?
|
25
|
-
new_base_form = converted_literal_form[0..(base_form.length-1)]
|
26
|
-
end
|
27
|
-
|
28
|
-
Rails.logger.debug "converted_literal_form => #{converted_literal_form} (#{converted_literal_form.size}) |
|
29
|
-
base_form => #{base_form} (#{base_form.size}) |
|
30
|
-
new_base_form => #{new_base_form} |
|
31
|
-
value => #{value} (#{value.size}) |
|
32
|
-
diff => #{diff}"
|
33
|
-
|
34
|
-
endings.each do |ending|
|
35
|
-
value = ending == "." ? new_base_form : (new_base_form + ending.downcase)
|
36
|
-
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
37
|
-
end
|
38
|
-
|
39
|
-
self.base_form = new_base_form
|
40
|
-
save(:validate => false)
|
41
|
-
|
42
|
-
send(Inflectional::Base.name.to_relation_name)
|
43
|
-
end
|
44
|
-
|
45
|
-
def inflectionals_attributes=(str)
|
46
|
-
@inflectionals_attributes = str.split("\r\n")
|
47
|
-
end
|
48
|
-
|
49
|
-
def overwrite_inflectionals!
|
50
|
-
return unless inflectionals_attributes
|
51
|
-
transaction do
|
52
|
-
send(Inflectional::Base.name.to_relation_name).delete_all
|
53
|
-
inflectionals_attributes.each do |value|
|
54
|
-
send(Inflectional::Base.name.to_relation_name).create!(:value => value)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
File without changes
|