iqvoc 3.5.5 → 3.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/Gemfile +5 -7
- data/Gemfile.lock +52 -56
- data/app/assets/javascripts/iqvoc/iqvoc.js +9 -6
- data/app/controllers/rdf_controller.rb +1 -1
- data/app/helpers/rdf_helper.rb +1 -1
- data/app/models/collection/base.rb +6 -6
- data/app/models/concept/base.rb +15 -9
- data/app/models/concept/relation/base.rb +14 -14
- data/app/models/concept/skos/base.rb +10 -3
- data/app/models/concept/skos/scheme.rb +4 -4
- data/app/models/label/base.rb +27 -25
- data/app/models/labeling/base.rb +12 -12
- data/app/models/labeling/skos/base.rb +2 -2
- data/app/models/note/base.rb +15 -11
- data/app/views/partials/concept/relation/_edit_base.html.erb +2 -1
- data/config/database.yml +1 -4
- data/config/initializers/iqvoc.rb +1 -0
- data/config/initializers/secret_token.rb +1 -1
- data/config/routes.rb +1 -1
- data/lib/iqvoc/controller_extensions.rb +6 -3
- data/lib/iqvoc/environments/development.rb +35 -0
- data/lib/iqvoc/environments/production.rb +20 -0
- data/lib/{maker.rb → iqvoc/maker.rb} +1 -3
- data/lib/iqvoc/origin.rb +148 -0
- data/lib/iqvoc/skos_importer.rb +1 -1
- data/lib/iqvoc/version.rb +1 -1
- data/lib/iqvoc/versioning.rb +51 -53
- data/test/integration/concept_scheme_test.rb +3 -3
- data/test/integration/tree_test.rb +2 -2
- data/test/integration_test_helper.rb +30 -4
- data/test/unit/hygiene_test.rb +25 -0
- data/test/unit/origin_test.rb +75 -0
- metadata +27 -26
- data/app/models/origin_mapping.rb +0 -58
- data/config/deploy.rb +0 -72
- data/test/unit/origin_mapping_test.rb +0 -66
@@ -1,58 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
# OriginMapping provides the _merge_ method to replace special chars etc in
|
18
|
-
# texts to generate a valid turtle compatible id (an url postfix).
|
19
|
-
class OriginMapping
|
20
|
-
|
21
|
-
def self.replace_umlauts(str)
|
22
|
-
str.to_s.
|
23
|
-
gsub(/Ö/, 'Oe').
|
24
|
-
gsub(/Ä/, 'Ae').
|
25
|
-
gsub(/Ü/, 'Ue').
|
26
|
-
gsub(/ö/, 'oe').
|
27
|
-
gsub(/ä/, 'ae').
|
28
|
-
gsub(/ü/, 'ue').
|
29
|
-
gsub(/ß/, 'ss')
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.replace_whitespace(str)
|
33
|
-
str.to_s.gsub(/\s([a-zA-Z])?/) do
|
34
|
-
$1.to_s.upcase
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.replace_special_chars(str)
|
39
|
-
str.to_s.gsub(/[(\[:]/, "--").gsub(/[)\]'""]/, "").gsub(/[,\.\/&;]/, '-')
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.handle_numbers_at_beginning(str)
|
43
|
-
str.to_s.gsub(/^[0-9].*$/) do |match|
|
44
|
-
"_#{match}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.merge(str)
|
49
|
-
handle_numbers_at_beginning(replace_umlauts(replace_whitespace(replace_special_chars(str))))
|
50
|
-
end
|
51
|
-
|
52
|
-
# TODO This should move to umt because it absolutely makes no sense here
|
53
|
-
|
54
|
-
def self.sanitize_for_base_form(str)
|
55
|
-
str.to_s.gsub(/[,\/\.\[\]]/, '')
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
data/config/deploy.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require "#{File.dirname(__FILE__)}/deploy/history"
|
18
|
-
load_history
|
19
|
-
|
20
|
-
load "#{File.dirname(__FILE__)}/deploy/common.rb"
|
21
|
-
|
22
|
-
set :default_stage, "innoq"
|
23
|
-
set :stages, %w(ec2 innoq bian)
|
24
|
-
require 'capistrano/ext/multistage'
|
25
|
-
|
26
|
-
# RVM bootstrap
|
27
|
-
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
|
28
|
-
require 'rvm/capistrano'
|
29
|
-
set :rvm_ruby_string, '1.9.3'
|
30
|
-
# set :rvm_type, :user
|
31
|
-
|
32
|
-
# bundler bootstrap
|
33
|
-
require 'bundler/capistrano'
|
34
|
-
|
35
|
-
# main details
|
36
|
-
set :application, "iqvoc"
|
37
|
-
|
38
|
-
# repo details
|
39
|
-
set :scm, :git
|
40
|
-
set :git_enable_submodules, 1
|
41
|
-
# set :scm_username, "passenger"
|
42
|
-
set :repository, "git@github.com:innoq/iqvoc.git"
|
43
|
-
@capistrano_history['last_branch'] = "master" if @capistrano_history['last_branch'].nil? || @capistrano_history['last_branch'] == ""
|
44
|
-
set :branch, Capistrano::CLI.ui.ask("Please enter the branch or tag we should use [#{@capistrano_history['last_branch']}]: ")
|
45
|
-
set :branch, @capistrano_history['last_branch'] if fetch(:branch) == ""
|
46
|
-
@capistrano_history['last_branch'] = fetch(:branch)
|
47
|
-
|
48
|
-
save_history
|
49
|
-
|
50
|
-
# tasks
|
51
|
-
namespace :deploy do
|
52
|
-
task :start, :roles => :app do
|
53
|
-
run "touch #{current_path}/tmp/restart.txt"
|
54
|
-
end
|
55
|
-
|
56
|
-
task :stop, :roles => :app do
|
57
|
-
# Do nothing.
|
58
|
-
end
|
59
|
-
|
60
|
-
desc "Restart Application"
|
61
|
-
task :restart, :roles => :app do
|
62
|
-
run "touch #{current_path}/tmp/restart.txt"
|
63
|
-
end
|
64
|
-
|
65
|
-
desc "Symlink shared resources on each release"
|
66
|
-
task :symlink_shared, :roles => :app do
|
67
|
-
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
68
|
-
run "ln -nfs #{shared_path}/config/initializers/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
after 'deploy:update_code', 'deploy:symlink_shared'
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# Copyright 2011 innoQ Deutschland GmbH
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
18
|
-
|
19
|
-
class OriginMappingTest < ActiveSupport::TestCase
|
20
|
-
|
21
|
-
def test_should_replace_umlauts
|
22
|
-
assert_equal "AeaeUeueOeoess", OriginMapping.merge("ÄäÜüÖöß")
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_should_camalize_string
|
26
|
-
assert_equal "AWeighting", OriginMapping.merge("'A' Weighting")
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_should_handle_numbers_at_the_beginning
|
30
|
-
assert_equal "_123", OriginMapping.merge("123")
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_should_handle_whitespaces_at_strange_positions
|
34
|
-
assert_equal "test12", OriginMapping.merge("test 12 ")
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_should_preserve_underlines
|
38
|
-
assert_equal "_test", OriginMapping.merge("_test")
|
39
|
-
assert_equal "a_Test", OriginMapping.merge("a_Test")
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_should_preserve_case
|
43
|
-
assert_equal "test", OriginMapping.merge("test")
|
44
|
-
assert_equal "Test", OriginMapping.merge("Test")
|
45
|
-
assert_equal "_5test", OriginMapping.merge("5test")
|
46
|
-
assert_equal "_5Test", OriginMapping.merge("5Test")
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_should_replace_brackets
|
50
|
-
assert_equal "--Energie-Ressource", OriginMapping.merge("[Energie/Ressource]")
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_should_replace_comma
|
54
|
-
assert_equal "-", OriginMapping.merge(",")
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_should_merge_all_together
|
58
|
-
assert_equal "--Energie-Ressource", OriginMapping.merge("[Energie - Ressource]")
|
59
|
-
assert_equal "--Hydrosphaere-WasserUndGewaesser", OriginMapping.merge("[Hydrosphäre - Wasser und Gewässer]")
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_sanitize_for_base_form
|
63
|
-
assert_equal "commaslashdotbracketbracket", OriginMapping.sanitize_for_base_form("comma,slash/dot.bracket[bracket]")
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|