hydra-ezid 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CONTRIBUTORS.md +1 -0
- data/Gemfile +0 -13
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.md +38 -19
- data/Rakefile +15 -5
- data/config/ezid.yml +13 -0
- data/config/ezid_override.yml +6 -0
- data/config/jetty.yml +6 -0
- data/hydra-ezid.gemspec +7 -8
- data/lib/hydra/ezid.rb +15 -4
- data/lib/hydra/ezid/identifiable.rb +75 -0
- data/lib/hydra/ezid/mint_error.rb +6 -0
- data/lib/hydra/ezid/version.rb +1 -1
- data/spec/spec_helper.rb +3 -27
- data/spec/units/ezid_spec.rb +105 -0
- metadata +26 -64
- data/.gitmodules +0 -4
- data/app/assets/images/hydra_ezid/.keep +0 -0
- data/app/assets/javascripts/hydra_ezid/.keep +0 -0
- data/app/assets/stylesheets/hydra_ezid/.keep +0 -0
- data/app/controllers/.keep +0 -0
- data/app/controllers/ezid_controller.rb +0 -3
- data/app/helpers/.keep +0 -0
- data/app/helpers/ezid_helper.rb +0 -3
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
- data/app/views/ezid/_button_to_mint_ezid.html.erb +0 -1
- data/config/routes.rb +0 -3
- data/fedora_conf/conf/development/fedora.fcfg +0 -946
- data/fedora_conf/conf/test/fedora.fcfg +0 -946
- data/gemfiles/rails3.gemfile +0 -6
- data/gemfiles/rails4.gemfile +0 -6
- data/lib/hydra-ezid.rb +0 -6
- data/lib/hydra/ezid/controller_behavior.rb +0 -27
- data/lib/hydra/ezid/model_methods.rb +0 -10
- data/solr_conf/conf/schema.xml +0 -372
- data/solr_conf/conf/solrconfig.xml +0 -164
- data/solr_conf/solr.xml +0 -35
- data/spec/controllers/ezid_controller_spec.rb +0 -4
- data/spec/factories.rb +0 -3
- data/spec/factories/.keep +0 -0
- data/spec/helpers/ezid_helper_spec.rb +0 -6
- data/spec/models/ezid_spec.rb +0 -4
- data/spec/support/app/models/sample.rb +0 -36
- data/spec/support/app/views/catalog/_sort_and_per_page.html.erb +0 -10
- data/spec/support/db/migrate/20111101221803_create_searches.rb +0 -16
- data/spec/support/lib/generators/test_app_generator.rb +0 -56
- data/spec/support/lib/tasks/rspec.rake +0 -8
- data/tasks/hydra-ezid-dev.rake +0 -68
- data/tasks/jetty.rake +0 -40
data/solr_conf/solr.xml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<!--
|
3
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
-
contributor license agreements. See the NOTICE file distributed with
|
5
|
-
this work for additional information regarding copyright ownership.
|
6
|
-
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
-
(the "License"); you may not use this file except in compliance with
|
8
|
-
the License. You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
-->
|
18
|
-
|
19
|
-
<!--
|
20
|
-
All (relative) paths are relative to the installation path
|
21
|
-
|
22
|
-
persistent: Save changes made via the API to this file
|
23
|
-
sharedLib: path to a lib directory that will be shared across all cores
|
24
|
-
-->
|
25
|
-
<solr persistent="false" sharedLib="lib">
|
26
|
-
|
27
|
-
<!--
|
28
|
-
adminPath: RequestHandler path to manage cores.
|
29
|
-
If 'null' (or absent), cores will not be manageable via REST
|
30
|
-
-->
|
31
|
-
<cores adminPath="/admin/cores" defaultCoreName="development">
|
32
|
-
<core name="development" instanceDir="development-core" />
|
33
|
-
<core name="test" instanceDir="test-core" />
|
34
|
-
</cores>
|
35
|
-
</solr>
|
data/spec/factories.rb
DELETED
data/spec/factories/.keep
DELETED
File without changes
|
data/spec/models/ezid_spec.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
class Sample
|
2
|
-
# This is a stub model for testing.
|
3
|
-
|
4
|
-
cattr_accessor :objects
|
5
|
-
self.objects = {}
|
6
|
-
|
7
|
-
def self.create(params={})
|
8
|
-
obj = Sample.new
|
9
|
-
obj.save
|
10
|
-
obj
|
11
|
-
end
|
12
|
-
|
13
|
-
def save()
|
14
|
-
@pid ||= "sample:#{(rand * 1000).to_i}"
|
15
|
-
self.class.objects[@pid] = self
|
16
|
-
end
|
17
|
-
|
18
|
-
def update_attributes(attributes)
|
19
|
-
attributes.each do |k, v|
|
20
|
-
instance_variable_set "@#{k.to_s}".to_sym, v
|
21
|
-
self.class.send :attr_accessor, k
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.find(pid)
|
26
|
-
objects[pid]
|
27
|
-
end
|
28
|
-
|
29
|
-
def pid
|
30
|
-
@pid
|
31
|
-
end
|
32
|
-
|
33
|
-
def destroy
|
34
|
-
self.class.objects.delete(@pid)
|
35
|
-
end
|
36
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
class CreateSearches < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
create_table :searches do |t|
|
5
|
-
t.text :query_params
|
6
|
-
t.integer :user_id
|
7
|
-
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
add_index :searches, :user_id
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.down
|
14
|
-
drop_table :searches
|
15
|
-
end
|
16
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
class TestAppGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path("../../../../support", __FILE__)
|
5
|
-
|
6
|
-
def run_blacklight_generator
|
7
|
-
say_status("warning", "GENERATING BL", :yellow)
|
8
|
-
|
9
|
-
generate 'blacklight', '--devise'
|
10
|
-
end
|
11
|
-
|
12
|
-
def run_hydra_head_generator
|
13
|
-
say_status("warning", "GENERATING HH", :yellow)
|
14
|
-
|
15
|
-
generate 'hydra:head', '-f'
|
16
|
-
end
|
17
|
-
|
18
|
-
def run_migrations
|
19
|
-
rake("db:migrate")
|
20
|
-
end
|
21
|
-
|
22
|
-
# Inject call to Hydra::Ezid.add_routes in config/routes.rb
|
23
|
-
def inject_routes
|
24
|
-
insert_into_file "config/routes.rb", :after => '.draw do' do
|
25
|
-
"\n # Add Collections routes."
|
26
|
-
"\n mount Hydra::Ezid::Engine => '/'"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def copy_rspec_rake_task
|
31
|
-
copy_file "lib/tasks/rspec.rake"
|
32
|
-
end
|
33
|
-
|
34
|
-
def delete_generated_noise
|
35
|
-
remove_file("public/index.html")
|
36
|
-
remove_file("spec/models/user_spec.rb")
|
37
|
-
end
|
38
|
-
|
39
|
-
def copy_view_overrides
|
40
|
-
directory("app/views/catalog")
|
41
|
-
end
|
42
|
-
|
43
|
-
# Inject javascript into application.js
|
44
|
-
def inject_javascript
|
45
|
-
insert_into_file "app/assets/javascripts/application.js", :after => '//= require_tree .' do
|
46
|
-
"\n //include javascript for ezid\n//= require hydra_ezid"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Inject javascript into application.js
|
51
|
-
def inject_css
|
52
|
-
insert_into_file "app/assets/stylesheets/application.css", :after => '*= require_tree .' do
|
53
|
-
"\n *= require hydra_ezid"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
require 'rspec/core/rake_task'
|
2
|
-
desc "run the hydra-ezid gem spec"
|
3
|
-
gem_home = File.expand_path('../../../../..', __FILE__)
|
4
|
-
RSpec::Core::RakeTask.new(:myspec) do |t|
|
5
|
-
t.pattern = gem_home + '/spec/**/*_spec.rb'
|
6
|
-
t.rspec_opts = "--colour"
|
7
|
-
t.ruby_opts = "-I#{gem_home}/spec"
|
8
|
-
end
|
data/tasks/hydra-ezid-dev.rake
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
require 'rspec/core'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
APP_ROOT="." # for jettywrapper
|
4
|
-
require 'jettywrapper'
|
5
|
-
ENV["RAILS_ROOT"] ||= 'spec/internal'
|
6
|
-
|
7
|
-
desc 'Spin up hydra-jetty and run specs'
|
8
|
-
task :ci => ['jetty:config'] do
|
9
|
-
puts 'running continuous integration'
|
10
|
-
jetty_params = Jettywrapper.load_config
|
11
|
-
error = Jettywrapper.wrap(jetty_params) do
|
12
|
-
Rake::Task['spec'].invoke
|
13
|
-
end
|
14
|
-
raise "test failures: #{error}" if error
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Run specs"
|
18
|
-
# Note: this is _not_ an RSpec::Core::RakeTask.
|
19
|
-
# It's a regular rake task that calls the RSpec RakeTask that's defined in spec/support/lib/tasks/rspec.rake
|
20
|
-
task :spec => [:generate] do |t|
|
21
|
-
focused_spec = ENV['SPEC'] ? " SPEC=#{File.join(GEM_ROOT, ENV['SPEC'])}" : ''
|
22
|
-
Bundler.with_clean_env do
|
23
|
-
within_test_app do
|
24
|
-
system "rake myspec#{focused_spec}"
|
25
|
-
abort "Error running hydra-ezid" unless $?.success?
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "Create the test rails app"
|
31
|
-
task :generate do
|
32
|
-
unless File.exists?('spec/internal/Rakefile')
|
33
|
-
puts "Generating rails app"
|
34
|
-
`rails new spec/internal`
|
35
|
-
puts "Updating gemfile"
|
36
|
-
|
37
|
-
`echo "gem 'hydra-ezid', :path=>'../../../hydra-ezid'
|
38
|
-
gem 'factory_girl_rails'
|
39
|
-
" >> spec/internal/Gemfile`
|
40
|
-
puts "Copying generator"
|
41
|
-
`cp -r spec/support/lib/generators spec/internal/lib`
|
42
|
-
Bundler.with_clean_env do
|
43
|
-
within_test_app do
|
44
|
-
puts "Bundle install"
|
45
|
-
`bundle install`
|
46
|
-
puts "running test_app_generator"
|
47
|
-
system "rails generate test_app"
|
48
|
-
# These factories are autogenerated and conflict with our factories
|
49
|
-
system 'rm test/factories/users.rb'
|
50
|
-
puts "running migrations"
|
51
|
-
puts `rake db:migrate db:test:prepare`
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
puts "Done generating test app"
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "Clean out the test rails app"
|
59
|
-
task :clean do
|
60
|
-
puts "Removing sample rails app"
|
61
|
-
`rm -rf spec/internal`
|
62
|
-
end
|
63
|
-
|
64
|
-
def within_test_app
|
65
|
-
FileUtils.cd('spec/internal')
|
66
|
-
yield
|
67
|
-
FileUtils.cd('../..')
|
68
|
-
end
|
data/tasks/jetty.rake
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
namespace :jetty do
|
2
|
-
desc "Copies the default Solr & Fedora configs into the bundled Hydra Testing Server"
|
3
|
-
task :config do
|
4
|
-
Rake::Task["jetty:config_fedora"].invoke
|
5
|
-
Rake::Task["jetty:config_solr"].invoke
|
6
|
-
end
|
7
|
-
|
8
|
-
desc "Copies the contents of solr_conf into the Solr development-core and test-core of Testing Server"
|
9
|
-
task :config_solr do
|
10
|
-
FileList['solr_conf/conf/*'].each do |f|
|
11
|
-
cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
|
12
|
-
cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Copies a custom fedora config for the bundled Hydra Testing Server"
|
17
|
-
task :config_fedora do
|
18
|
-
# load a custom fedora.fcfg -
|
19
|
-
if defined?(Rails.root)
|
20
|
-
app_root = Rails.root
|
21
|
-
else
|
22
|
-
app_root = File.join(File.dirname(__FILE__),"..")
|
23
|
-
end
|
24
|
-
|
25
|
-
fcfg = File.join(app_root,"fedora_conf","conf","development","fedora.fcfg")
|
26
|
-
if File.exists?(fcfg)
|
27
|
-
puts "copying over development/fedora.fcfg"
|
28
|
-
cp("#{fcfg}", 'jetty/fedora/default/server/config/', :verbose => true)
|
29
|
-
else
|
30
|
-
puts "#{fcfg} file not found -- skipping fedora config"
|
31
|
-
end
|
32
|
-
fcfg = File.join(app_root,"fedora_conf","conf","test","fedora.fcfg")
|
33
|
-
if File.exists?(fcfg)
|
34
|
-
puts "copying over test/fedora.fcfg"
|
35
|
-
cp("#{fcfg}", 'jetty/fedora/test/server/config/', :verbose => true)
|
36
|
-
else
|
37
|
-
puts "#{fcfg} file not found -- skipping fedora config"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|