uri_service 0.2.6 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 845187ba683b261e1633154472f1d014ec54427f
4
- data.tar.gz: 8796fb9f981396e0850b25f44b63807b74d58140
3
+ metadata.gz: 4e88fc708750cda7ebc12eb0754467e32747bb3c
4
+ data.tar.gz: 0fbd147af313299c53eb7fdbedb72c13983ec77f
5
5
  SHA512:
6
- metadata.gz: 373950826a7bd03c9ec44b0809d6ec777349da1271313fc9a87368381f9e5dae18bfb45240727b44eab24d1a5e87dbab82a2b090bdaf425e53c157a3a936da8a
7
- data.tar.gz: 6a5ae8b0ca6a7515465ffefd41271a9235b8694d7c5153f9cc18b982f5fd76bef028908d421e6dca7190aeabb82983588246e8c716841cf89e1928c3e7ba5c0a
6
+ metadata.gz: 245f1ac3e0fb6cd92c9e06e7c3e3daaaf8c2f0cf2aa403eb9b89946bda5ca463821647acfb28a4b3d58e78a2c77a401b1af94310a7052949c788bd552b94bb43
7
+ data.tar.gz: 6a043e455235a161b27c070000c0a1d0dcaa7f5a6463bc0f112b98094fb98927e76cd8c8f9de21dce07354ddef305cceb4f9c1a30f3a89c5b6405e08873774b6
@@ -0,0 +1,100 @@
1
+ require 'jettywrapper'
2
+ require 'solr_wrapper'
3
+ require 'uri_service'
4
+
5
+ namespace :uri_service do
6
+
7
+ begin
8
+ # This code is in a begin/rescue block so that the Rakefile is usable
9
+ # in an environment where RSpec is unavailable (i.e. production).
10
+ require 'rspec/core/rake_task'
11
+
12
+ RSpec::Core::RakeTask.new(:rspec) do |spec|
13
+ spec.pattern = FileList['spec/**/*_spec.rb']
14
+ spec.pattern += FileList['spec/*_spec.rb']
15
+ spec.rspec_opts = ['--backtrace'] if ENV['CI']
16
+ end
17
+
18
+ rescue LoadError => e
19
+ puts "[Warning] Exception creating rspec rake tasks. This message can be ignored in environments that intentionally do not pull in the RSpec gem (i.e. production)."
20
+ puts e
21
+ end
22
+
23
+ desc "CI build"
24
+ task :ci do
25
+ #Rake::Task["uri_service:ci_with_solr_5_wrapper"].invoke
26
+ Rake::Task["uri_service:ci_with_jetty_wrapper"].invoke
27
+ end
28
+
29
+ desc "Preparation steps for the CI run"
30
+ task :ci_prepare do
31
+ # Delete existing test database
32
+ uri_service_config = YAML.load(File.new('spec/fixtures/uri_service_test_config.yml'))['sqlite']
33
+ File.delete(uri_service_config['database']['database']) if File.exists?(uri_service_config['database']['database'])
34
+ FileUtils.mkdir_p(File.dirname(uri_service_config['database']['database']))
35
+ client = UriService::Client.new(uri_service_config)
36
+ client.create_required_tables
37
+ end
38
+
39
+ desc "CI build (using SolrWrapper and Solr 5)"
40
+ task :ci_with_solr_5_wrapper do
41
+ solr_version = '5.2.1'
42
+ instance_dir = File.join('tmp', "solr-#{solr_version}")
43
+ FileUtils.rm_rf(instance_dir)
44
+
45
+ puts "Unpacking and starting solr...\n"
46
+ SolrWrapper.wrap({
47
+ port: 9983,
48
+ version: solr_version,
49
+ verbose: false,
50
+ managed: true,
51
+ download_path: File.join('tmp', "solr-#{solr_version}.zip"),
52
+ instance_dir: File.join('tmp', "solr-#{solr_version}"),
53
+ }) do |solr_wrapper_instance|
54
+
55
+ # Create collection
56
+ solr_wrapper_instance.with_collection(name: 'uri_service_test', dir: File.join('spec/fixtures', 'uri_service_test_cores/uri_service_test-solr5-conf')) do |collection_name|
57
+ Rake::Task["uri_service:ci_prepare"].invoke
58
+ Rake::Task["uri_service:rspec"].invoke
59
+ end
60
+
61
+ puts 'Stopping solr...'
62
+ end
63
+ end
64
+
65
+ desc "CI build (using JettyWrapper)"
66
+ task :ci_with_jetty_wrapper do
67
+
68
+ Jettywrapper.url = "https://github.com/cul/hydra-jetty/archive/solr-only.zip"
69
+ Jettywrapper.jetty_dir = File.join('tmp', 'jetty-test')
70
+
71
+ unless File.exists?(Jettywrapper.jetty_dir)
72
+ puts "\n" + 'No test jetty found. Will download / unzip a copy now.' + "\n"
73
+ end
74
+
75
+ Rake::Task["jetty:clean"].invoke # Clear and recreate previous jetty directory
76
+
77
+ # Copy solr core fixture to new solr instance
78
+ FileUtils.cp_r('spec/fixtures/uri_service_test_cores/uri_service_test', File.join(Jettywrapper.jetty_dir, 'solr'))
79
+ # Update solr.xml configuration file so that it recognizes this code
80
+ solr_xml_data = File.read(File.join(Jettywrapper.jetty_dir, 'solr/solr.xml'))
81
+ solr_xml_data.gsub!('</cores>', ' <core name="uri_service_test" instanceDir="uri_service_test" />' + "\n" + ' </cores>')
82
+ File.open(File.join(Jettywrapper.jetty_dir, 'solr/solr.xml'), 'w') { |file| file.write(solr_xml_data) }
83
+
84
+ jetty_params = Jettywrapper.load_config.merge({
85
+ jetty_home: Jettywrapper.jetty_dir,
86
+ solr_home: 'solr',
87
+ startup_wait: 75,
88
+ jetty_port: 9983,
89
+ java_version: '>= 1.8',
90
+ java_opts: ["-XX:MaxPermSize=128m", "-Xmx256m"]
91
+ })
92
+ error = Jettywrapper.wrap(jetty_params) do
93
+ Rake::Task["uri_service:ci_prepare"].invoke
94
+ Rake::Task["uri_service:rspec"].invoke
95
+ end
96
+ raise "test failures: #{error}" if error
97
+
98
+ end
99
+
100
+ end
@@ -0,0 +1,20 @@
1
+ namespace :uri_service do
2
+ namespace :db do
3
+
4
+ if defined?(Rails)
5
+ desc "Setup"
6
+ task :setup => :environment do
7
+
8
+ if UriService.client.required_tables_exist?
9
+ puts 'The UriService required tables have already been created.'
10
+ next
11
+ end
12
+
13
+ puts 'Creating required tables...'
14
+ UriService.client.create_required_tables
15
+ puts 'Done.'
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ namespace :uri_service do
2
+ namespace :solr do
3
+
4
+ if defined?(Rails)
5
+ desc "Reindex all terms"
6
+ task :reindex_all_terms => :environment do
7
+ UriService.client.reindex_all_terms(true)
8
+ end
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ namespace :uri_service do
2
+
3
+ desc "Hello!"
4
+ task :hello do
5
+ puts 'Hello!'
6
+ end
7
+
8
+ end
@@ -1,6 +1,6 @@
1
1
  module UriService
2
2
 
3
- VERSION = '0.2.6'
3
+ VERSION = '0.2.7'
4
4
 
5
5
  def self.version
6
6
  VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric O'Hanlon
@@ -172,6 +172,10 @@ extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
174
  - README.md
175
+ - lib/tasks/uri_service.rake
176
+ - lib/tasks/uri_service/ci.rake
177
+ - lib/tasks/uri_service/db.rake
178
+ - lib/tasks/uri_service/solr.rake
175
179
  - lib/uri_service.rb
176
180
  - lib/uri_service/client.rb
177
181
  - lib/uri_service/railtie.rb
@@ -202,3 +206,4 @@ specification_version: 4
202
206
  summary: A service for registering local URIs and performing both local and remote
203
207
  URI lookups.
204
208
  test_files: []
209
+ has_rdoc: