iqvoc_similar_terms 0.8.0 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/.travis.yml +25 -13
- data/Gemfile +9 -8
- data/Gemfile.lock +340 -129
- data/README.md +4 -8
- data/app/controllers/similar_terms_controller.rb +21 -4
- data/app/views/similar_terms/show.html.erb +5 -5
- data/app/views/similar_terms/show.xml.builder +17 -0
- data/bin/rails +10 -0
- data/bin/rake +7 -0
- data/bin/spring +18 -0
- data/config/application.rb +0 -11
- 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/apipie.rb +5 -0
- data/config/initializers/iqvoc.rb +4 -3
- data/config/initializers/iqvoc_similiar_terms.rb +1 -0
- data/config/locales/de.yml +6 -0
- data/config/locales/en.yml +6 -0
- data/config/routes.rb +4 -7
- data/config/secrets.yml +8 -0
- data/db/migrate/.gitkeep +0 -0
- data/iqvoc_similar_terms.gemspec +1 -2
- data/lib/iqvoc/similar_terms.rb +30 -4
- data/lib/iqvoc/similar_terms/version.rb +1 -1
- data/lib/iqvoc_similar_terms.rb +13 -1
- data/test/compound_forms.nt +20 -0
- data/test/concept_test.nt +20 -0
- data/test/concept_test.ttl +26 -0
- data/test/{functional → controllers}/api_test.rb +9 -19
- data/test/controllers/onebox_test.rb +37 -0
- data/test/{unit → models}/entity_resolution_test.rb +6 -10
- data/test/models/results_test.rb +79 -0
- data/test/similar_terms.nt +14 -0
- data/test/similar_terms.ttl +19 -0
- data/test/test_helper.rb +4 -0
- metadata +45 -20
- data/config/initializers/secret_token.rb.template +0 -16
- data/script/ci/travis-before-build +0 -19
- data/script/ci/travis-build +0 -11
- data/test/unit/results_test.rb +0 -55
@@ -1,38 +1,22 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
4
|
-
require 'iqvoc/rdfapi' # XXX: only required with Zeus
|
5
4
|
|
6
5
|
class SimilarTermsTest < ActionController::TestCase
|
7
6
|
|
8
7
|
setup do
|
9
8
|
@controller = SimilarTermsController.new
|
10
|
-
|
11
|
-
|
12
|
-
Iqvoc::RDFAPI.devour(forest, "skos:prefLabel", '"forest"@en')
|
13
|
-
Iqvoc::RDFAPI.devour(forest, "skos:altLabel", '"woods"@en')
|
14
|
-
forest.save
|
15
|
-
|
16
|
-
car = Iqvoc::RDFAPI.devour("car", "a", "skos:Concept") # FIXME: should be ":car"; see above
|
17
|
-
Iqvoc::RDFAPI.devour(car, "skos:prefLabel", '"car"@en')
|
18
|
-
Iqvoc::RDFAPI.devour(car, "skos:altLabel", '"automobile"@en')
|
19
|
-
car.save
|
9
|
+
|
10
|
+
load_test_data
|
20
11
|
end
|
21
12
|
|
22
13
|
test "routing" do
|
23
|
-
assert_raises ActionController::RoutingError do
|
24
|
-
get :show
|
25
|
-
end
|
26
|
-
assert_raises ActionController::RoutingError do
|
27
|
-
get :show, :format => "ttl"
|
28
|
-
end
|
29
|
-
|
30
14
|
get :show, :lang => "en", :format => "ttl"
|
31
15
|
assert_response 400
|
32
16
|
|
33
17
|
get :show, :lang => "en", :format => "ttl", :terms => "foo"
|
34
18
|
assert_response 200
|
35
|
-
assert !@response.body.include?("
|
19
|
+
assert !@response.body.include?("skosxl:altLabel")
|
36
20
|
end
|
37
21
|
|
38
22
|
test "RDF representations" do
|
@@ -42,6 +26,9 @@ class SimilarTermsTest < ActionController::TestCase
|
|
42
26
|
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
|
43
27
|
EOS
|
44
28
|
assert @response.body.include?(<<-EOS)
|
29
|
+
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
|
30
|
+
EOS
|
31
|
+
assert @response.body.include?(<<-EOS)
|
45
32
|
@prefix query: <http://test.host/en/similar.ttl?terms=forest#>.
|
46
33
|
EOS
|
47
34
|
assert @response.body.include?(<<-EOS.strip)
|
@@ -55,6 +42,9 @@ query:top skos:altLabel "forest"@en;
|
|
55
42
|
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
|
56
43
|
EOS
|
57
44
|
assert @response.body.include?(<<-EOS)
|
45
|
+
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
|
46
|
+
EOS
|
47
|
+
assert @response.body.include?(<<-EOS)
|
58
48
|
@prefix query: <http://test.host/en/similar.ttl?terms=forest%2Cautomobile#>.
|
59
49
|
EOS
|
60
50
|
assert @response.body.include?(<<-EOS.strip)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
4
|
+
|
5
|
+
class OneBoxTest < ActionController::TestCase
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@controller = SimilarTermsController.new
|
9
|
+
|
10
|
+
load_test_data
|
11
|
+
end
|
12
|
+
|
13
|
+
test "XML representation" do
|
14
|
+
get :show, :lang => "en", :format => "xml", :terms => "foo"
|
15
|
+
assert_response 200
|
16
|
+
assert @response.body.starts_with?(<<-EOS.strip)
|
17
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
18
|
+
<OneBoxResults xmlns:xlink="http://www.w3.org/1999/xlink">
|
19
|
+
<resultCode>success</resultCode>
|
20
|
+
<totalResults>0</totalResults>
|
21
|
+
<urlText>Similar Terms</urlText>
|
22
|
+
<urlLink>http://test.host/en/similar.xml?terms=foo#</urlLink>
|
23
|
+
EOS
|
24
|
+
assert !@response.body.include?("<MODULE_RESULT>")
|
25
|
+
|
26
|
+
get :show, :lang => "en", :format => "xml", :terms => "forest"
|
27
|
+
assert_response 200
|
28
|
+
assert @response.body.include?("<totalResults>2</totalResults>")
|
29
|
+
assert @response.body.include?(<<-EOS.strip)
|
30
|
+
<MODULE_RESULT>
|
31
|
+
<title>similar terms for 'forest'</title>
|
32
|
+
EOS
|
33
|
+
assert @response.body.include? '<Field name="forest">forest</Field>'
|
34
|
+
assert @response.body.include? '<Field name="woods">woods</Field>'
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -1,24 +1,19 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
4
|
-
require 'iqvoc/rdfapi' # XXX: only required with Zeus
|
5
|
-
require 'iqvoc/similar_terms' # XXX: should not be necessary!?
|
6
4
|
|
7
5
|
class EntityResolutionTest < ActiveSupport::TestCase
|
8
6
|
|
9
7
|
setup do
|
10
|
-
|
11
|
-
Iqvoc::RDFAPI.devour(forest, "skos:prefLabel", '"forest"@en')
|
12
|
-
Iqvoc::RDFAPI.devour(forest, "skos:altLabel", '"woods"@en')
|
13
|
-
forest.save
|
8
|
+
load_test_data
|
14
9
|
end
|
15
10
|
|
16
11
|
test "concept resolution" do
|
17
|
-
concepts = Iqvoc::SimilarTerms.terms_to_concepts("en","forest")
|
12
|
+
concepts = Iqvoc::SimilarTerms.terms_to_concepts("en", "forest")
|
18
13
|
assert_equal 1, concepts.length
|
19
14
|
assert_equal Iqvoc::Concept.base_class, concepts[0].class
|
20
15
|
|
21
|
-
concepts = Iqvoc::SimilarTerms.terms_to_concepts("de","forest")
|
16
|
+
concepts = Iqvoc::SimilarTerms.terms_to_concepts("de", "forest")
|
22
17
|
assert_equal 0, concepts.count
|
23
18
|
|
24
19
|
concepts = Iqvoc::SimilarTerms.terms_to_concepts("en", "foo")
|
@@ -27,10 +22,11 @@ class EntityResolutionTest < ActiveSupport::TestCase
|
|
27
22
|
|
28
23
|
test "label resolution" do
|
29
24
|
labels = Iqvoc::SimilarTerms.terms_to_labels("en", "forest")
|
30
|
-
assert_equal ActiveRecord::Relation, labels.class
|
25
|
+
# assert_equal ActiveRecord::Relation, labels.class
|
31
26
|
labels = labels.all
|
27
|
+
|
32
28
|
assert_equal 1, labels.length
|
33
|
-
assert_equal Iqvoc::
|
29
|
+
assert_equal Iqvoc::XLLabel.base_class, labels[0].class
|
34
30
|
assert_equal "forest", labels[0].value
|
35
31
|
assert_equal "en", labels[0].language
|
36
32
|
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), '../test_helper')
|
4
|
+
|
5
|
+
class ResultsTest < ActiveSupport::TestCase
|
6
|
+
|
7
|
+
setup do
|
8
|
+
load_test_data
|
9
|
+
SkosImporter.new('test/concept_test.nt', 'http://localhost:3000/').run
|
10
|
+
end
|
11
|
+
|
12
|
+
test "ranked results" do
|
13
|
+
results = Iqvoc::SimilarTerms.ranked("en", "forest")
|
14
|
+
assert_equal 2, results.length
|
15
|
+
assert_equal Iqvoc::XLLabel.base_class, results[0][0].class
|
16
|
+
assert_equal "forest", results[0][0].value
|
17
|
+
assert_equal "forest", results[0][1].origin
|
18
|
+
assert_equal "woods", results[1][0].value
|
19
|
+
assert_equal "forest", results[1][1].origin
|
20
|
+
|
21
|
+
results = Iqvoc::SimilarTerms.ranked("en", "woods", "car")
|
22
|
+
assert_equal 4, results.length
|
23
|
+
assert_equal "forest", results[0][0].value
|
24
|
+
assert_equal "forest", results[0][1].origin
|
25
|
+
assert_equal "car", results[1][0].value
|
26
|
+
assert_equal "car", results[1][1].origin
|
27
|
+
assert_equal "woods", results[2][0].value
|
28
|
+
assert_equal "forest", results[2][1].origin
|
29
|
+
assert_equal "automobile", results[3][0].value
|
30
|
+
assert_equal "car", results[3][1].origin
|
31
|
+
assert_equal results[0].length, results[0].uniq.length
|
32
|
+
end
|
33
|
+
|
34
|
+
test "weighted results" do
|
35
|
+
results = Iqvoc::SimilarTerms.weighted("en", "forest")
|
36
|
+
assert_equal 2, results.keys.length
|
37
|
+
expected = { "forest" => 5, "woods" => 2 }
|
38
|
+
results.each do |label, data|
|
39
|
+
assert_equal Iqvoc::XLLabel.base_class, label.class
|
40
|
+
assert_equal 2, data.length
|
41
|
+
assert_equal expected[label.value], data[0]
|
42
|
+
assert_equal Iqvoc::Concept.base_class, data[1].class
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
test "inclusion of pref labels of sub concepts" do
|
47
|
+
results = Iqvoc::SimilarTerms.weighted("en", "water")
|
48
|
+
assert_equal 4, results.length
|
49
|
+
assert_equal "water", results.keys.first.value
|
50
|
+
assert_equal 5, results[results.keys.first][0]
|
51
|
+
assert_equal "used water", results.keys.second.value
|
52
|
+
assert_equal 0, results[results.keys.second][0]
|
53
|
+
assert_equal "new water", results.keys.third.value
|
54
|
+
assert_equal 0, results[results.keys.third][0]
|
55
|
+
assert_equal "real water", results.keys.fourth.value
|
56
|
+
assert_equal 2, results[results.keys.fourth][0]
|
57
|
+
end
|
58
|
+
|
59
|
+
test "no results" do
|
60
|
+
results = Iqvoc::SimilarTerms.weighted("de", "water")
|
61
|
+
assert_equal 0, results.length
|
62
|
+
end
|
63
|
+
|
64
|
+
test "compound returns" do
|
65
|
+
SkosImporter.new('test/compound_forms.nt', 'http://hobbies.com/').run
|
66
|
+
results = Iqvoc::SimilarTerms.weighted("de", "Computer")
|
67
|
+
assert_equal 1, results.length
|
68
|
+
assert_equal "Computer programming", results.keys.first.value
|
69
|
+
assert_equal 0, results[results.keys.first][0]
|
70
|
+
end
|
71
|
+
|
72
|
+
test "nothing unpublished" do
|
73
|
+
concept = Iqvoc::XLLabel.base_class.where(value: "forest").first.concepts.first
|
74
|
+
concept.update_attributes published_at: nil
|
75
|
+
results = Iqvoc::SimilarTerms.weighted("en", "forest")
|
76
|
+
assert_equal 0, results.length
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<http://localhost:3000/forest_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
|
2
|
+
<http://localhost:3000/forest_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "forest"@en .
|
3
|
+
<http://localhost:3000/woods_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
|
4
|
+
<http://localhost:3000/woods_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "woods"@en .
|
5
|
+
<http://localhost:3000/forest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
|
6
|
+
<http://localhost:3000/forest> <http://www.w3.org/2008/05/skos-xl#prefLabel> <http://localhost:3000/forest_label> .
|
7
|
+
<http://localhost:3000/forest> <http://www.w3.org/2008/05/skos-xl#altLabel> <http://localhost:3000/woods_label> .
|
8
|
+
<http://localhost:3000/car_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
|
9
|
+
<http://localhost:3000/car_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "car"@en .
|
10
|
+
<http://localhost:3000/auto_label> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2008/05/skos-xl#Label> .
|
11
|
+
<http://localhost:3000/auto_label> <http://www.w3.org/2008/05/skos-xl#literalForm> "automobile"@en .
|
12
|
+
<http://localhost:3000/car> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2004/02/skos/core#Concept> .
|
13
|
+
<http://localhost:3000/car> <http://www.w3.org/2008/05/skos-xl#prefLabel> <http://localhost:3000/car_label> .
|
14
|
+
<http://localhost:3000/car> <http://www.w3.org/2008/05/skos-xl#altLabel> <http://localhost:3000/auto_label> .
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@prefix : <http://localhost:3000/>.
|
2
|
+
@prefix skos: <http://www.w3.org/2004/02/skos/core#>.
|
3
|
+
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#>.
|
4
|
+
|
5
|
+
:forest_label a skosxl:Label;
|
6
|
+
skosxl:literalForm "forest"@en.
|
7
|
+
:woods_label a skosxl:Label;
|
8
|
+
skosxl:literalForm "woods"@en.
|
9
|
+
:forest a skos:Concept;
|
10
|
+
skosxl:prefLabel :forest_label;
|
11
|
+
skosxl:altLabel :woods_label.
|
12
|
+
|
13
|
+
:car_label a skosxl:Label;
|
14
|
+
skosxl:literalForm "car"@en.
|
15
|
+
:auto_label a skosxl:Label;
|
16
|
+
skosxl:literalForm "automobile"@en.
|
17
|
+
:car a skos:Concept;
|
18
|
+
skosxl:prefLabel :car_label;
|
19
|
+
skosxl:altLabel :auto_label.
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iqvoc_similar_terms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederik Dohr
|
@@ -10,22 +10,28 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: iqvoc
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 4.
|
21
|
+
version: 4.4.0
|
22
|
+
- - "~>"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '4.6'
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
25
28
|
requirements:
|
26
|
-
- -
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 4.4.0
|
32
|
+
- - "~>"
|
27
33
|
- !ruby/object:Gem::Version
|
28
|
-
version: 4.
|
34
|
+
version: '4.6'
|
29
35
|
description: ''
|
30
36
|
email:
|
31
37
|
- robert.glaser@innoq.com
|
@@ -33,8 +39,8 @@ executables: []
|
|
33
39
|
extensions: []
|
34
40
|
extra_rdoc_files: []
|
35
41
|
files:
|
36
|
-
- .gitignore
|
37
|
-
- .travis.yml
|
42
|
+
- ".gitignore"
|
43
|
+
- ".travis.yml"
|
38
44
|
- Gemfile
|
39
45
|
- Gemfile.lock
|
40
46
|
- README.md
|
@@ -42,6 +48,10 @@ files:
|
|
42
48
|
- app/controllers/similar_terms_controller.rb
|
43
49
|
- app/views/similar_terms/show.html.erb
|
44
50
|
- app/views/similar_terms/show.iqrdf
|
51
|
+
- app/views/similar_terms/show.xml.builder
|
52
|
+
- bin/rails
|
53
|
+
- bin/rake
|
54
|
+
- bin/spring
|
45
55
|
- config.ru
|
46
56
|
- config/application.rb
|
47
57
|
- config/boot.rb
|
@@ -52,24 +62,33 @@ files:
|
|
52
62
|
- config/environments/development.rb
|
53
63
|
- config/environments/production.rb
|
54
64
|
- config/environments/test.rb
|
65
|
+
- config/initializers/apipie.rb
|
55
66
|
- config/initializers/iqvoc.rb
|
56
|
-
- config/initializers/
|
67
|
+
- config/initializers/iqvoc_similiar_terms.rb
|
57
68
|
- config/initializers/session_store.rb
|
58
69
|
- config/initializers/wrap_parameters.rb
|
70
|
+
- config/locales/de.yml
|
71
|
+
- config/locales/en.yml
|
59
72
|
- config/routes.rb
|
73
|
+
- config/secrets.yml
|
60
74
|
- db/.gitkeep
|
75
|
+
- db/migrate/.gitkeep
|
61
76
|
- iqvoc_similar_terms.gemspec
|
62
77
|
- lib/iqvoc/similar_terms.rb
|
63
78
|
- lib/iqvoc/similar_terms/version.rb
|
64
79
|
- lib/iqvoc_similar_terms.rb
|
65
80
|
- public/.gitkeep
|
66
|
-
- script/ci/travis-before-build
|
67
|
-
- script/ci/travis-build
|
68
81
|
- script/rails
|
69
|
-
- test/
|
82
|
+
- test/compound_forms.nt
|
83
|
+
- test/concept_test.nt
|
84
|
+
- test/concept_test.ttl
|
85
|
+
- test/controllers/api_test.rb
|
86
|
+
- test/controllers/onebox_test.rb
|
87
|
+
- test/models/entity_resolution_test.rb
|
88
|
+
- test/models/results_test.rb
|
89
|
+
- test/similar_terms.nt
|
90
|
+
- test/similar_terms.ttl
|
70
91
|
- test/test_helper.rb
|
71
|
-
- test/unit/entity_resolution_test.rb
|
72
|
-
- test/unit/results_test.rb
|
73
92
|
homepage: ''
|
74
93
|
licenses: []
|
75
94
|
metadata: {}
|
@@ -79,22 +98,28 @@ require_paths:
|
|
79
98
|
- lib
|
80
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
100
|
requirements:
|
82
|
-
- -
|
101
|
+
- - ">="
|
83
102
|
- !ruby/object:Gem::Version
|
84
103
|
version: '0'
|
85
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
105
|
requirements:
|
87
|
-
- -
|
106
|
+
- - ">="
|
88
107
|
- !ruby/object:Gem::Version
|
89
108
|
version: '0'
|
90
109
|
requirements: []
|
91
110
|
rubyforge_project: iqvoc_similar_terms
|
92
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.4.5.1
|
93
112
|
signing_key:
|
94
113
|
specification_version: 4
|
95
114
|
summary: ''
|
96
115
|
test_files:
|
97
|
-
- test/
|
116
|
+
- test/compound_forms.nt
|
117
|
+
- test/concept_test.nt
|
118
|
+
- test/concept_test.ttl
|
119
|
+
- test/controllers/api_test.rb
|
120
|
+
- test/controllers/onebox_test.rb
|
121
|
+
- test/models/entity_resolution_test.rb
|
122
|
+
- test/models/results_test.rb
|
123
|
+
- test/similar_terms.nt
|
124
|
+
- test/similar_terms.ttl
|
98
125
|
- test/test_helper.rb
|
99
|
-
- test/unit/entity_resolution_test.rb
|
100
|
-
- test/unit/results_test.rb
|
@@ -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::SimilarTerms.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::SimilarTerms::Application.config.secret_token = "S-E-C-R-E-T"
|
15
|
-
|
16
|
-
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
|