iqvoc_inflectionals 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +14 -0
  3. data/Gemfile.lock +122 -0
  4. data/README.md +13 -0
  5. data/Rakefile +11 -0
  6. data/app/models/inflectional/base.rb +345 -0
  7. data/app/models/inflectional/label_extension.rb +58 -0
  8. data/app/views/partials/inflectional/_base.html.erb +22 -0
  9. data/app/views/partials/inflectional/_edit_base.html.erb +7 -0
  10. data/app/views/partials/inflectional/_search_result.html.erb +13 -0
  11. data/config/application.rb +56 -0
  12. data/config/boot.rb +13 -0
  13. data/config/database.template.yml +30 -0
  14. data/config/engine.rb +13 -0
  15. data/config/environment.rb +5 -0
  16. data/config/environments/development.rb +55 -0
  17. data/config/environments/production.rb +64 -0
  18. data/config/environments/test.rb +46 -0
  19. data/config/initializers/engine_extensions.rb +6 -0
  20. data/config/initializers/iqvoc.rb +11 -0
  21. data/config/initializers/secret_token.rb.template +16 -0
  22. data/config/initializers/session_store.rb +11 -0
  23. data/config/locales/activerecord.de.yml +6 -0
  24. data/config/locales/activerecord.en.yml +6 -0
  25. data/config/routes.rb +2 -0
  26. data/config.ru +4 -0
  27. data/db/migrate/20120109143704_create_inflectionals.rb +25 -0
  28. data/db/schema.rb +158 -0
  29. data/db/seeds.rb +0 -0
  30. data/iqvoc_inflectionals.gemspec +26 -0
  31. data/lib/engine_tasks/db.rake +19 -0
  32. data/lib/iqvoc/inflectionals/label_extensions.rb +23 -0
  33. data/lib/iqvoc/inflectionals/version.rb +5 -0
  34. data/lib/iqvoc_inflectionals.rb +15 -0
  35. data/public/.gitkeep +0 -0
  36. data/script/rails +6 -0
  37. data/test/test_helper.rb +10 -0
  38. data/test/unit/inflectional_test.rb +33 -0
  39. metadata +120 -0
@@ -0,0 +1,56 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require *Rails.groups(:assets => %w(development test))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module Iqvoc::Inflectionals
13
+ class Application < Rails::Application
14
+
15
+ # This has to be here because iqvoc_inflectionals.rb needs to know if it runs as app or as engine
16
+ require 'iqvoc_inflectionals'
17
+
18
+ # Settings in config/environments/* take precedence over those specified here.
19
+ # Application configuration should go into files in config/initializers
20
+ # -- all .rb files in that directory are automatically loaded.
21
+
22
+ # Custom directories with classes and modules you want to be autoloadable.
23
+ # config.autoload_paths += %W(#{config.root}/extras)
24
+
25
+ # Only load the plugins named here, in the order given (default is alphabetical).
26
+ # :all can be used as a placeholder for all plugins not explicitly named.
27
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
28
+
29
+ # Activate observers that should always be running.
30
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
31
+
32
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
33
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
34
+ # config.time_zone = 'Central Time (US & Canada)'
35
+
36
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
37
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
38
+ config.i18n.default_locale = :de
39
+ # config.i18n.available_locales = [:de, :en]
40
+
41
+ # JavaScript files you want as :defaults (application.js is always included).
42
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
43
+
44
+ # Configure the default encoding used in templates for Ruby 1.9.
45
+ config.encoding = "utf-8"
46
+
47
+ # Configure sensitive parameters which will be filtered from the log file.
48
+ config.filter_parameters += [:password, :password_confirmation]
49
+
50
+ # Enable the asset pipeline
51
+ config.assets.enabled = true
52
+
53
+ # Version of your assets, change this if you want to expire all your assets
54
+ config.assets.version = "1.0.0"
55
+ end
56
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,30 @@
1
+ <% socket = [
2
+ "/tmp/mysql.sock",
3
+ "/opt/local/var/run/mysql5/mysqld.sock",
4
+ "/tmp/mysqld.sock",
5
+ "/var/run/mysqld.sock"
6
+ ].detect { |socket| File.exist?(socket) } %>
7
+
8
+ defaults: &defaults
9
+ encoding: utf8
10
+
11
+ development:
12
+ <<: *defaults
13
+ adapter: sqlite3
14
+ database: db/dev.sqlite
15
+
16
+ # Warning: The database defined as 'test' will be erased and
17
+ # re-generated from your development database when you run 'rake'.
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *defaults
21
+ adapter: sqlite3
22
+ database: db/test.sqlite
23
+
24
+ production:
25
+ <<: *defaults
26
+ adapter: mysql2
27
+ socket: <%= socket %>
28
+ username:
29
+ password:
30
+ database: iqvoc_inflectionals
data/config/engine.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'rails'
2
+
3
+ module Iqvoc
4
+ module Inflectionals
5
+
6
+ class Engine < Rails::Engine
7
+
8
+ paths["lib/tasks"] << "lib/engine_tasks"
9
+
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ # Load the Rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application
5
+ Iqvoc::Inflectionals::Application.initialize!
@@ -0,0 +1,55 @@
1
+ if Iqvoc::Inflectionals.const_defined?(:Application)
2
+ Iqvoc::Inflectionals::Application.configure do
3
+ # 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
54
+ end
55
+ end
@@ -0,0 +1,64 @@
1
+ if Iqvoc::Inflectionals.const_defined?(:Application)
2
+ Iqvoc::Inflectionals::Application.configure do
3
+ # 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
63
+ end
64
+ end
@@ -0,0 +1,46 @@
1
+ if Iqvoc::Inflectionals.const_defined?(:Application)
2
+ Iqvoc::Inflectionals::Application.configure do
3
+ # 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
45
+ end
46
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+ require "iqvoc/inflectionals/label_extensions"
3
+
4
+ Rails.application.config.to_prepare do
5
+ Label::SKOSXL::Base.send(:include, Iqvoc::Inflectionals::LabelExtensions)
6
+ end
@@ -0,0 +1,11 @@
1
+ # initializer for both iqvoc and iqvoc_skosxl
2
+
3
+ require 'iqvoc/xllabel' # XXX: this basically duplicates iqvoc_skosxl's initializer - but is required to ensure correct loading order!?
4
+
5
+ Iqvoc.title = "iQvoc Inflectionals"
6
+
7
+ #Iqvoc.searchable_class_names << "Inflectional::Base" # XXX: application's responsibility!?
8
+
9
+ Iqvoc::XLLabel.additional_association_class_names.
10
+ merge!("Inflectional::Base" => "label_id")
11
+ Iqvoc::XLLabel.view_sections += ["inflectionals"]
@@ -0,0 +1,16 @@
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
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ if Iqvoc::Inflectionals.const_defined?(:Application)
4
+ Iqvoc::Inflectionals::Application.config.session_store :cookie_store,
5
+ :key => "_iqvoc_inflectionals_session"
6
+ end
7
+
8
+ # Use the database for sessions instead of the cookie-based default,
9
+ # which shouldn't be used to store highly confidential information
10
+ # (create the session table with "rake db:sessions:create")
11
+ # Iqvoc::Application.config.session_store :active_record_store
@@ -0,0 +1,6 @@
1
+ de:
2
+ activerecord:
3
+ models:
4
+ inflectional/base:
5
+ one: Schreibweise
6
+ other: Schreibweisen
@@ -0,0 +1,6 @@
1
+ en:
2
+ activerecord:
3
+ models:
4
+ inflectional/base:
5
+ one: Inflectional
6
+ other: Inflectionals
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end
data/config.ru ADDED
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Iqvoc::Inflectionals::Application
@@ -0,0 +1,25 @@
1
+ class CreateInflectionals < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ unless table_exists? :inflectionals
5
+ create_table :inflectionals, :force => false do |t|
6
+ t.timestamps
7
+ t.integer "label_id"
8
+ t.string "value", :limit => 4000
9
+ t.string "normal_hash"
10
+ end
11
+ end
12
+
13
+ unless index_exists?(:inflectionals, :label_id, :name => "ix_inflectionals_fk")
14
+ add_index :inflectionals, :label_id, :name => "ix_inflectionals_fk"
15
+ end
16
+ unless index_exists?(:inflectionals, :normal_hash, :name => "ix_inflectionals_normal_hash")
17
+ add_index :inflectionals, :normal_hash, :name => "ix_inflectionals_normal_hash"
18
+ end
19
+ end
20
+
21
+ def self.down
22
+ # we don't want to delete existing data
23
+ end
24
+
25
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,158 @@
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
data/db/seeds.rb ADDED
File without changes
@@ -0,0 +1,26 @@
1
+ # encoding: UTF-8
2
+
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+ require "iqvoc/inflectionals/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "iqvoc_inflectionals"
8
+ s.version = Iqvoc::Inflectionals::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Robert Glaser", "Till Schulte-Coerne", "Frederik Dohr"]
11
+ s.email = ["robert.glaser@innoq.com"]
12
+ s.homepage = "" # TODO
13
+ s.summary = "" # TODO
14
+ s.description = "" # TODO
15
+
16
+ s.rubyforge_project = "iqvoc_inflectionals"
17
+
18
+ s.add_dependency "rails", "~> 3.1.3"
19
+ s.add_dependency "iqvoc"
20
+ s.add_dependency "iqvoc_skosxl"
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: UTF-8
2
+
3
+ namespace :iqvoc_inflectionals do
4
+ namespace :db do
5
+
6
+ desc "Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
7
+ task :migrate => :environment do
8
+ ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
9
+ ActiveRecord::Migrator.migrate(Iqvoc::Inflectionals::Engine.find_root_with_flag("db").join('db/migrate'), ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
10
+ Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
11
+ end
12
+
13
+ desc "Load seeds (task is idempotent)"
14
+ task :seed => :environment do
15
+ Iqvoc::Inflectionals::Engine.load_seed
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # encoding: UTF-8
2
+
3
+ require "active_support/concern"
4
+
5
+ module Iqvoc::Inflectionals::LabelExtensions
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ include Inflectional::LabelExtension
10
+
11
+ after_save do |label|
12
+ # ensure a matching inflectional exists
13
+ if Inflectional::Base.where(:label_id => label.id, :value => label.value).none?
14
+ label.inflectionals.create(:value => label.value)
15
+ end
16
+ end
17
+
18
+ has_many :inflectionals,
19
+ :class_name => "Inflectional::Base",
20
+ :foreign_key => "label_id",
21
+ :dependent => :destroy
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module Iqvoc
2
+ module Inflectionals
3
+ VERSION = "1.0.1"
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'iqvoc/inflectionals/version'
4
+
5
+ module IqvocInflectionals
6
+
7
+ unless Iqvoc.const_defined?(:Inflectionals) && Iqvoc::Inflectionals.const_defined?(:Application)
8
+ require File.join(File.dirname(__FILE__), '../config/engine')
9
+ end
10
+
11
+ ActiveSupport.on_load(:after_iqvoc_config) do
12
+ require 'iqvoc'
13
+ end
14
+
15
+ end
data/public/.gitkeep ADDED
File without changes
data/script/rails ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'