active-fedora 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +3 -5
- data/active-fedora.gemspec +1 -0
- data/lib/active_fedora.rb +9 -7
- data/lib/active_fedora/railtie.rb +10 -0
- data/lib/active_fedora/version.rb +1 -1
- data/spec/fixtures/rails_root/config/fedora.yml +16 -0
- data/spec/fixtures/rails_root/config/predicate_mappings.yml +47 -0
- data/spec/fixtures/rails_root/config/solr_mappings.yml +16 -0
- data/spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml +9 -0
- data/spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml +17 -0
- data/spec/rails3_test_app/.gitignore +4 -0
- data/spec/rails3_test_app/.rspec +1 -0
- data/spec/rails3_test_app/.rvmrc +34 -0
- data/spec/rails3_test_app/Gemfile +40 -0
- data/spec/rails3_test_app/Gemfile.lock +146 -0
- data/spec/rails3_test_app/Rakefile +7 -0
- data/spec/rails3_test_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails3_test_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails3_test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/rails3_test_app/config.ru +4 -0
- data/spec/rails3_test_app/config/application.rb +42 -0
- data/spec/rails3_test_app/config/boot.rb +6 -0
- data/spec/rails3_test_app/config/database.yml +22 -0
- data/spec/rails3_test_app/config/environment.rb +5 -0
- data/spec/rails3_test_app/config/environments/development.rb +26 -0
- data/spec/rails3_test_app/config/environments/production.rb +49 -0
- data/spec/rails3_test_app/config/environments/test.rb +35 -0
- data/spec/rails3_test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails3_test_app/config/initializers/inflections.rb +10 -0
- data/spec/rails3_test_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails3_test_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails3_test_app/config/initializers/session_store.rb +8 -0
- data/spec/rails3_test_app/config/locales/en.yml +5 -0
- data/spec/rails3_test_app/config/routes.rb +58 -0
- data/spec/rails3_test_app/db/seeds.rb +7 -0
- data/spec/rails3_test_app/run_tests +3 -0
- data/spec/rails3_test_app/script/rails +6 -0
- data/spec/rails3_test_app/spec/spec_helper.rb +27 -0
- data/spec/rails3_test_app/spec/unit/rails_3_init.rb +15 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/active_fedora_spec.rb +67 -8
- metadata +73 -4
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
active-fedora (2.2.0)
|
|
5
|
-
RedCloth
|
|
4
|
+
active-fedora (2.2.0.rails3pre1)
|
|
6
5
|
active-fedora
|
|
7
6
|
activeresource
|
|
8
7
|
equivalent-xml
|
|
@@ -12,11 +11,9 @@ PATH
|
|
|
12
11
|
multipart-post
|
|
13
12
|
nokogiri
|
|
14
13
|
om (>= 1.0)
|
|
15
|
-
rcov
|
|
16
14
|
solr-ruby (>= 0.0.6)
|
|
17
15
|
solrizer (> 1.0.0)
|
|
18
16
|
xml-simple (>= 1.0.12)
|
|
19
|
-
yard
|
|
20
17
|
|
|
21
18
|
GEM
|
|
22
19
|
remote: http://rubygems.org/
|
|
@@ -64,8 +61,8 @@ GEM
|
|
|
64
61
|
nokogiri
|
|
65
62
|
nokogiri
|
|
66
63
|
nokogiri
|
|
67
|
-
om (>= 1.0.0)
|
|
68
64
|
om
|
|
65
|
+
om (>= 1.0.0)
|
|
69
66
|
stomp
|
|
70
67
|
xml-simple
|
|
71
68
|
solrizer-fedora (1.0.2)
|
|
@@ -88,5 +85,6 @@ DEPENDENCIES
|
|
|
88
85
|
rcov
|
|
89
86
|
rspec (< 2.0.0)
|
|
90
87
|
ruby-debug
|
|
88
|
+
solrizer
|
|
91
89
|
solrizer-fedora
|
|
92
90
|
yard
|
data/active-fedora.gemspec
CHANGED
data/lib/active_fedora.rb
CHANGED
|
@@ -23,6 +23,8 @@ require 'active_fedora/rels_ext_datastream.rb'
|
|
|
23
23
|
require 'active_fedora/semantic_node.rb'
|
|
24
24
|
require 'active_fedora/version.rb'
|
|
25
25
|
|
|
26
|
+
require 'active_fedora/railtie' if defined?(Rails) && Rails.version >= "3.0"
|
|
27
|
+
|
|
26
28
|
SOLR_DOCUMENT_ID = ActiveFedora::SolrService.id_field unless defined?(SOLR_DOCUMENT_ID)
|
|
27
29
|
ENABLE_SOLR_UPDATES = true unless defined?(ENABLE_SOLR_UPDATES)
|
|
28
30
|
|
|
@@ -39,23 +41,23 @@ module ActiveFedora #:nodoc:
|
|
|
39
41
|
# Initializes ActiveFedora's connection to Fedora and Solr based on the info in fedora.yml
|
|
40
42
|
# If RAILS_ENV is set, it will use that environment. Defaults to "development".
|
|
41
43
|
# @param [String] config_path (optional) the path to fedora.yml
|
|
42
|
-
# If config_path is not provided and
|
|
44
|
+
# If config_path is not provided and Rails.root is set, it will look in RAILS_ENV/config/fedora.yml. Otherwise, it will look in your config/fedora.yml. Failing that, it will use localhost urls.
|
|
43
45
|
def self.init( config_path=nil )
|
|
44
46
|
|
|
45
47
|
config_env = defined?(RAILS_ENV) ? RAILS_ENV : "development"
|
|
46
48
|
|
|
47
49
|
if config_path.nil?
|
|
48
|
-
if defined?(
|
|
49
|
-
config_path = "#{
|
|
50
|
+
if defined?(Rails.root)
|
|
51
|
+
config_path = "#{Rails.root}/config/fedora.yml"
|
|
50
52
|
else
|
|
51
53
|
config_path = File.join("config","fedora.yml")
|
|
52
|
-
unless File.exist?(config_path)
|
|
53
|
-
config_path = File.join(File.dirname(__FILE__), "..", "config", "fedora.yml")
|
|
54
|
-
logger.info "Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml as an argument to ActiveFedora.init or set RAILS_ROOT and put fedora.yml into \#{RAILS_ROOT}/config."
|
|
55
|
-
end
|
|
56
54
|
end
|
|
57
55
|
end
|
|
58
56
|
|
|
57
|
+
unless File.exist?(config_path)
|
|
58
|
+
config_path = File.join(File.dirname(__FILE__), "..", "config", "fedora.yml")
|
|
59
|
+
logger.info "Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml as an argument to ActiveFedora.init or set Rails.root and put fedora.yml into \#{Rails.root}/config."
|
|
60
|
+
end
|
|
59
61
|
|
|
60
62
|
logger.info("FEDORA: loading ActiveFedora config from #{File.expand_path(config_path)}")
|
|
61
63
|
fedora_config = YAML::load(File.open(config_path))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
development:
|
|
2
|
+
fedora:
|
|
3
|
+
url: http://fedoraAdmin:fedoraAdmin@testhost.com:8983/fedora
|
|
4
|
+
solr:
|
|
5
|
+
url: http://testhost.com:8983/solr/development
|
|
6
|
+
test:
|
|
7
|
+
fedora:
|
|
8
|
+
url: http://fedoraAdmin:fedoraAdmin@testhost.com:8983/fedora
|
|
9
|
+
solr:
|
|
10
|
+
url: http://testhost.com:8983/solr/development
|
|
11
|
+
production:
|
|
12
|
+
fedora:
|
|
13
|
+
url: http://fedoraAdmin:fedoraAdmin@testhost.com:8080/fedora
|
|
14
|
+
solr:
|
|
15
|
+
url: http://testhost.com:8080/solr
|
|
16
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# The default namespace maps to the default namespace for generating rels_ext from solr
|
|
2
|
+
:default_namespace: info:fedora/fedora-system:def/relations-external#
|
|
3
|
+
|
|
4
|
+
# namespace mappings---
|
|
5
|
+
# you can add specific mappings for your institution by providing the following:
|
|
6
|
+
# namespace_uri:
|
|
7
|
+
# :relationship_symbol: relationship_identifier
|
|
8
|
+
#
|
|
9
|
+
# For example, if you have the following element in your rels_ext:
|
|
10
|
+
#
|
|
11
|
+
# <oai:itemID>oai:example.edu:changeme:500</oai:itemID>
|
|
12
|
+
#
|
|
13
|
+
# With the last two lines of this file uncommented, the relationships hash of your object will include:
|
|
14
|
+
# :oai_item_id => ["info:fedora/oai:example.edu:changeme:500"]
|
|
15
|
+
#
|
|
16
|
+
# With the last two lines of this file commented out, the relationships hash of your object will include:
|
|
17
|
+
# "oai_itemID" => ["info:fedora/oai:example.edu:changeme:500"]
|
|
18
|
+
#
|
|
19
|
+
:predicate_mapping:
|
|
20
|
+
info:fedora/fedora-system:def/relations-external#:
|
|
21
|
+
:is_derivation_of: isDerivationOf
|
|
22
|
+
:is_metadata_for: isMetadataFor
|
|
23
|
+
:is_member_of_collection: isMemberOfCollection
|
|
24
|
+
:has_derivation: hasDerivation
|
|
25
|
+
:is_annotation_of: isAnnotationOf
|
|
26
|
+
:is_constituent_of: isConstituentOf
|
|
27
|
+
:is_dependent_of: isDependentOf
|
|
28
|
+
:has_collection_member: hasCollectionMember
|
|
29
|
+
:has_annotation: hasAnnotation
|
|
30
|
+
:has_constituent: hasConstituent
|
|
31
|
+
:has_dependent: hasDependent
|
|
32
|
+
:is_part_of: isPartOf
|
|
33
|
+
:has_equivalent: hasEquivalent
|
|
34
|
+
:is_subset_of: isSubsetOf
|
|
35
|
+
:is_description_of: isDescriptionOf
|
|
36
|
+
:is_member_of: isMemberOf
|
|
37
|
+
:has_model: hasModel
|
|
38
|
+
:conforms_to: conformsTo
|
|
39
|
+
:has_metadata: hasMetadata
|
|
40
|
+
:has_subset: hasSubset
|
|
41
|
+
:has_description: hasDescription
|
|
42
|
+
:has_part: hasPart
|
|
43
|
+
:has_member: hasMember
|
|
44
|
+
info:fedora/fedora-system:def/model#:
|
|
45
|
+
:has_model: hasModel
|
|
46
|
+
# http://www.openarchives.org/OAI/2.0/:
|
|
47
|
+
# :oai_item_id: itemID
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
id: id
|
|
2
|
+
default: searchable
|
|
3
|
+
searchable:
|
|
4
|
+
date: _dt
|
|
5
|
+
string: _t
|
|
6
|
+
text: _t
|
|
7
|
+
symbol: _s
|
|
8
|
+
integer: _i
|
|
9
|
+
long: _l
|
|
10
|
+
boolean: _b
|
|
11
|
+
float: _f
|
|
12
|
+
double: _d
|
|
13
|
+
displayable: _display
|
|
14
|
+
facetable: _facet
|
|
15
|
+
sortable: _sort
|
|
16
|
+
unstemmed_searchable: _unstem_search
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
id: id
|
|
2
|
+
default: searchable
|
|
3
|
+
searchable:
|
|
4
|
+
id: id
|
|
5
|
+
date: _dt
|
|
6
|
+
string: _t
|
|
7
|
+
text: _t
|
|
8
|
+
symbol: _s
|
|
9
|
+
integer: _i
|
|
10
|
+
long: _l
|
|
11
|
+
boolean: _b
|
|
12
|
+
float: _f
|
|
13
|
+
double: _d
|
|
14
|
+
displayable: _display
|
|
15
|
+
facetable: _facet
|
|
16
|
+
sortable: _sort
|
|
17
|
+
unstemmed_searchable: _unstem_search
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--colour
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# This is an RVM Project .rvmrc file, used to automatically load the ruby
|
|
4
|
+
# development environment upon cd'ing into the directory
|
|
5
|
+
|
|
6
|
+
ruby_string="ree-1.8.7"
|
|
7
|
+
gemset_name="active_fedora_rails3"
|
|
8
|
+
|
|
9
|
+
# Install rubies when used instead of only displaying a warning and exiting
|
|
10
|
+
rvm_install_on_use_flag=1
|
|
11
|
+
|
|
12
|
+
# Specify our desired <ruby>[@<gemset>], the @gemset name is optional.
|
|
13
|
+
environment_id="${ruby_string}@${gemset_name}"
|
|
14
|
+
|
|
15
|
+
# First, attempt to load the desired environment directly from the environment
|
|
16
|
+
# file. This is very fast and efficient compared to running through the entire
|
|
17
|
+
# CLI and selector. If you want feedback on which environment was used then
|
|
18
|
+
# insert the word 'use' after --create as this triggers verbose mode.
|
|
19
|
+
#
|
|
20
|
+
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
|
|
21
|
+
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
|
|
22
|
+
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
|
|
23
|
+
else
|
|
24
|
+
# If the environment file has not yet been created, use the RVM CLI to select.
|
|
25
|
+
rvm --create "$environment_id"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Ensure that Bundler is installed, install it if it is not.
|
|
29
|
+
if ! (command -v bundle > /dev/null) ; then
|
|
30
|
+
printf "The rubygem 'bundler' is not installed, installing it now.\n"
|
|
31
|
+
gem install bundler
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'rails', '3.0.7'
|
|
4
|
+
|
|
5
|
+
# Bundle edge Rails instead:
|
|
6
|
+
# gem 'rails', :git => 'git://github.com/rails/rails.git'
|
|
7
|
+
|
|
8
|
+
gem 'sqlite3'
|
|
9
|
+
gem 'active-fedora', '2.2.0.rails3pre1'
|
|
10
|
+
gem 'solrizer-fedora', '1.0.3.rails3pre1'
|
|
11
|
+
gem 'solrizer', '1.0.4.rails3pre1'
|
|
12
|
+
gem 'ruby-debug'
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
group :development, :test do
|
|
17
|
+
gem 'rspec-rails'
|
|
18
|
+
end
|
|
19
|
+
# Use unicorn as the web server
|
|
20
|
+
# gem 'unicorn'
|
|
21
|
+
|
|
22
|
+
# Deploy with Capistrano
|
|
23
|
+
# gem 'capistrano'
|
|
24
|
+
|
|
25
|
+
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
|
|
26
|
+
# gem 'ruby-debug'
|
|
27
|
+
# gem 'ruby-debug19', :require => 'ruby-debug'
|
|
28
|
+
|
|
29
|
+
# Bundle the extra gems:
|
|
30
|
+
# gem 'bj'
|
|
31
|
+
# gem 'nokogiri'
|
|
32
|
+
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
|
33
|
+
# gem 'aws-s3', :require => 'aws/s3'
|
|
34
|
+
|
|
35
|
+
# Bundle gems for the local environment. Make sure to
|
|
36
|
+
# put test-only gems in this group so their generators
|
|
37
|
+
# and rake tasks are available in development mode:
|
|
38
|
+
# group :development, :test do
|
|
39
|
+
# gem 'webrat'
|
|
40
|
+
# end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
abstract (1.0.0)
|
|
5
|
+
actionmailer (3.0.7)
|
|
6
|
+
actionpack (= 3.0.7)
|
|
7
|
+
mail (~> 2.2.15)
|
|
8
|
+
actionpack (3.0.7)
|
|
9
|
+
activemodel (= 3.0.7)
|
|
10
|
+
activesupport (= 3.0.7)
|
|
11
|
+
builder (~> 2.1.2)
|
|
12
|
+
erubis (~> 2.6.6)
|
|
13
|
+
i18n (~> 0.5.0)
|
|
14
|
+
rack (~> 1.2.1)
|
|
15
|
+
rack-mount (~> 0.6.14)
|
|
16
|
+
rack-test (~> 0.5.7)
|
|
17
|
+
tzinfo (~> 0.3.23)
|
|
18
|
+
active-fedora (2.2.0.rails3pre1)
|
|
19
|
+
active-fedora
|
|
20
|
+
activeresource
|
|
21
|
+
equivalent-xml
|
|
22
|
+
facets
|
|
23
|
+
mediashelf-loggable
|
|
24
|
+
mime-types (>= 1.16)
|
|
25
|
+
multipart-post
|
|
26
|
+
nokogiri
|
|
27
|
+
om (>= 1.0)
|
|
28
|
+
solr-ruby (>= 0.0.6)
|
|
29
|
+
solrizer (> 1.0.0)
|
|
30
|
+
xml-simple (>= 1.0.12)
|
|
31
|
+
activemodel (3.0.7)
|
|
32
|
+
activesupport (= 3.0.7)
|
|
33
|
+
builder (~> 2.1.2)
|
|
34
|
+
i18n (~> 0.5.0)
|
|
35
|
+
activerecord (3.0.7)
|
|
36
|
+
activemodel (= 3.0.7)
|
|
37
|
+
activesupport (= 3.0.7)
|
|
38
|
+
arel (~> 2.0.2)
|
|
39
|
+
tzinfo (~> 0.3.23)
|
|
40
|
+
activeresource (3.0.7)
|
|
41
|
+
activemodel (= 3.0.7)
|
|
42
|
+
activesupport (= 3.0.7)
|
|
43
|
+
activesupport (3.0.7)
|
|
44
|
+
arel (2.0.10)
|
|
45
|
+
builder (2.1.2)
|
|
46
|
+
columnize (0.3.2)
|
|
47
|
+
daemons (1.1.3)
|
|
48
|
+
diff-lcs (1.1.2)
|
|
49
|
+
equivalent-xml (0.2.6)
|
|
50
|
+
nokogiri (>= 1.4.3)
|
|
51
|
+
erubis (2.6.6)
|
|
52
|
+
abstract (>= 1.0.0)
|
|
53
|
+
facets (2.9.1)
|
|
54
|
+
fastercsv (1.5.4)
|
|
55
|
+
i18n (0.5.0)
|
|
56
|
+
linecache (0.43)
|
|
57
|
+
mail (2.2.19)
|
|
58
|
+
activesupport (>= 2.3.6)
|
|
59
|
+
i18n (>= 0.4.0)
|
|
60
|
+
mime-types (~> 1.16)
|
|
61
|
+
treetop (~> 1.4.8)
|
|
62
|
+
mediashelf-loggable (0.4.2)
|
|
63
|
+
mime-types (1.16)
|
|
64
|
+
multipart-post (1.1.1)
|
|
65
|
+
nokogiri (1.4.4)
|
|
66
|
+
om (1.2.4)
|
|
67
|
+
nokogiri (>= 1.4.2)
|
|
68
|
+
om
|
|
69
|
+
polyglot (0.3.1)
|
|
70
|
+
rack (1.2.3)
|
|
71
|
+
rack-mount (0.6.14)
|
|
72
|
+
rack (>= 1.0.0)
|
|
73
|
+
rack-test (0.5.7)
|
|
74
|
+
rack (>= 1.0)
|
|
75
|
+
rails (3.0.7)
|
|
76
|
+
actionmailer (= 3.0.7)
|
|
77
|
+
actionpack (= 3.0.7)
|
|
78
|
+
activerecord (= 3.0.7)
|
|
79
|
+
activeresource (= 3.0.7)
|
|
80
|
+
activesupport (= 3.0.7)
|
|
81
|
+
bundler (~> 1.0)
|
|
82
|
+
railties (= 3.0.7)
|
|
83
|
+
railties (3.0.7)
|
|
84
|
+
actionpack (= 3.0.7)
|
|
85
|
+
activesupport (= 3.0.7)
|
|
86
|
+
rake (>= 0.8.7)
|
|
87
|
+
thor (~> 0.14.4)
|
|
88
|
+
rake (0.9.0)
|
|
89
|
+
rsolr (1.0.0)
|
|
90
|
+
builder (>= 2.1.2)
|
|
91
|
+
rspec (2.6.0)
|
|
92
|
+
rspec-core (~> 2.6.0)
|
|
93
|
+
rspec-expectations (~> 2.6.0)
|
|
94
|
+
rspec-mocks (~> 2.6.0)
|
|
95
|
+
rspec-core (2.6.2)
|
|
96
|
+
rspec-expectations (2.6.0)
|
|
97
|
+
diff-lcs (~> 1.1.2)
|
|
98
|
+
rspec-mocks (2.6.0)
|
|
99
|
+
rspec-rails (2.6.0)
|
|
100
|
+
actionpack (~> 3.0)
|
|
101
|
+
activesupport (~> 3.0)
|
|
102
|
+
railties (~> 3.0)
|
|
103
|
+
rspec (~> 2.6.0)
|
|
104
|
+
ruby-debug (0.10.4)
|
|
105
|
+
columnize (>= 0.1)
|
|
106
|
+
ruby-debug-base (~> 0.10.4.0)
|
|
107
|
+
ruby-debug-base (0.10.4)
|
|
108
|
+
linecache (>= 0.3)
|
|
109
|
+
solr-ruby (0.0.8)
|
|
110
|
+
solrizer (1.0.4.rails3pre1)
|
|
111
|
+
daemons
|
|
112
|
+
mediashelf-loggable
|
|
113
|
+
mediashelf-loggable
|
|
114
|
+
nokogiri
|
|
115
|
+
nokogiri
|
|
116
|
+
nokogiri
|
|
117
|
+
om
|
|
118
|
+
om (>= 1.0.0)
|
|
119
|
+
stomp
|
|
120
|
+
xml-simple
|
|
121
|
+
solrizer-fedora (1.0.3.rails3pre1)
|
|
122
|
+
active-fedora (= 2.2.0.rails3pre1)
|
|
123
|
+
fastercsv
|
|
124
|
+
rsolr
|
|
125
|
+
solr-ruby (>= 0.0.6)
|
|
126
|
+
solrizer (>= 1.0.0)
|
|
127
|
+
solrizer-fedora
|
|
128
|
+
sqlite3 (1.3.3)
|
|
129
|
+
stomp (1.1.8)
|
|
130
|
+
thor (0.14.6)
|
|
131
|
+
treetop (1.4.9)
|
|
132
|
+
polyglot (>= 0.3.1)
|
|
133
|
+
tzinfo (0.3.27)
|
|
134
|
+
xml-simple (1.0.15)
|
|
135
|
+
|
|
136
|
+
PLATFORMS
|
|
137
|
+
ruby
|
|
138
|
+
|
|
139
|
+
DEPENDENCIES
|
|
140
|
+
active-fedora (= 2.2.0.rails3pre1)
|
|
141
|
+
rails (= 3.0.7)
|
|
142
|
+
rspec-rails
|
|
143
|
+
ruby-debug
|
|
144
|
+
solrizer (= 1.0.4.rails3pre1)
|
|
145
|
+
solrizer-fedora (= 1.0.3.rails3pre1)
|
|
146
|
+
sqlite3
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
|
3
|
+
|
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
|
5
|
+
require 'rake'
|
|
6
|
+
|
|
7
|
+
TestApp::Application.load_tasks
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require 'rails/all'
|
|
4
|
+
|
|
5
|
+
# If you have a Gemfile, require the gems listed there, including any gems
|
|
6
|
+
# you've limited to :test, :development, or :production.
|
|
7
|
+
Bundler.require(:default, Rails.env) if defined?(Bundler)
|
|
8
|
+
|
|
9
|
+
module TestApp
|
|
10
|
+
class Application < Rails::Application
|
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
12
|
+
# Application configuration should go into files in config/initializers
|
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
14
|
+
|
|
15
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
16
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
17
|
+
|
|
18
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
19
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
20
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
21
|
+
|
|
22
|
+
# Activate observers that should always be running.
|
|
23
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
24
|
+
|
|
25
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
26
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
27
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
28
|
+
|
|
29
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
30
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
31
|
+
# config.i18n.default_locale = :de
|
|
32
|
+
|
|
33
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
|
34
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
|
35
|
+
|
|
36
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
|
37
|
+
config.encoding = "utf-8"
|
|
38
|
+
|
|
39
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
|
40
|
+
config.filter_parameters += [:password]
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
development:
|
|
4
|
+
adapter: sqlite3
|
|
5
|
+
database: db/development.sqlite3
|
|
6
|
+
pool: 5
|
|
7
|
+
timeout: 5000
|
|
8
|
+
|
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
|
10
|
+
# re-generated from your development database when you run "rake".
|
|
11
|
+
# Do not set this db to the same as development or production.
|
|
12
|
+
test:
|
|
13
|
+
adapter: sqlite3
|
|
14
|
+
database: db/test.sqlite3
|
|
15
|
+
pool: 5
|
|
16
|
+
timeout: 5000
|
|
17
|
+
|
|
18
|
+
production:
|
|
19
|
+
adapter: sqlite3
|
|
20
|
+
database: db/production.sqlite3
|
|
21
|
+
pool: 5
|
|
22
|
+
timeout: 5000
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
TestApp::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# In the development environment your application's code is reloaded on
|
|
5
|
+
# every request. This slows down response time but is perfect for development
|
|
6
|
+
# since you don't have to restart the webserver when you make code changes.
|
|
7
|
+
config.cache_classes = false
|
|
8
|
+
|
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
|
10
|
+
config.whiny_nils = true
|
|
11
|
+
|
|
12
|
+
# Show full error reports and disable caching
|
|
13
|
+
config.consider_all_requests_local = true
|
|
14
|
+
config.action_view.debug_rjs = 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
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
TestApp::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
|
5
|
+
# Code is not reloaded between requests
|
|
6
|
+
config.cache_classes = true
|
|
7
|
+
|
|
8
|
+
# Full error reports are disabled and caching is turned on
|
|
9
|
+
config.consider_all_requests_local = false
|
|
10
|
+
config.action_controller.perform_caching = true
|
|
11
|
+
|
|
12
|
+
# Specifies the header that your server uses for sending files
|
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
|
14
|
+
|
|
15
|
+
# For nginx:
|
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
|
17
|
+
|
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
|
19
|
+
# just comment this out and Rails will serve the files
|
|
20
|
+
|
|
21
|
+
# See everything in the log (default is :info)
|
|
22
|
+
# config.log_level = :debug
|
|
23
|
+
|
|
24
|
+
# Use a different logger for distributed setups
|
|
25
|
+
# config.logger = SyslogLogger.new
|
|
26
|
+
|
|
27
|
+
# Use a different cache store in production
|
|
28
|
+
# config.cache_store = :mem_cache_store
|
|
29
|
+
|
|
30
|
+
# Disable Rails's static asset server
|
|
31
|
+
# In production, Apache or nginx will already do this
|
|
32
|
+
config.serve_static_assets = false
|
|
33
|
+
|
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
36
|
+
|
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
39
|
+
|
|
40
|
+
# Enable threaded mode
|
|
41
|
+
# config.threadsafe!
|
|
42
|
+
|
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
|
45
|
+
config.i18n.fallbacks = true
|
|
46
|
+
|
|
47
|
+
# Send deprecation notices to registered listeners
|
|
48
|
+
config.active_support.deprecation = :notify
|
|
49
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
TestApp::Application.configure do
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
|
3
|
+
|
|
4
|
+
# The test environment is used exclusively to run your application's
|
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
|
8
|
+
config.cache_classes = true
|
|
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
|
+
# Raise exceptions instead of rendering exception templates
|
|
18
|
+
config.action_dispatch.show_exceptions = false
|
|
19
|
+
|
|
20
|
+
# Disable request forgery protection in test environment
|
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
|
22
|
+
|
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
|
25
|
+
# ActionMailer::Base.deliveries array.
|
|
26
|
+
config.action_mailer.delivery_method = :test
|
|
27
|
+
|
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
30
|
+
# like if you have constraints or database-specific column types
|
|
31
|
+
# config.active_record.schema_format = :sql
|
|
32
|
+
|
|
33
|
+
# Print deprecation notices to the stderr
|
|
34
|
+
config.active_support.deprecation = :stderr
|
|
35
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
|
5
|
+
|
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Add new inflection rules using the following format
|
|
4
|
+
# (all these examples are active by default):
|
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
|
8
|
+
# inflect.irregular 'person', 'people'
|
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
|
10
|
+
# end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key for verifying the integrity of signed cookies.
|
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
|
7
|
+
TestApp::Application.config.secret_token = '1c1a9058fbe5cb97c50cfb96a4d4b20ad42a128603eac6d7f6deba4722b9ab2a6c7160b5a35a29de887b7ef41c22b000235eaa08d6c99ec8046c44376e92a80f'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
TestApp::Application.config.session_store :cookie_store, :key => '_test_app_session'
|
|
4
|
+
|
|
5
|
+
# Use the database for sessions instead of the cookie-based default,
|
|
6
|
+
# which shouldn't be used to store highly confidential information
|
|
7
|
+
# (create the session table with "rails generate session_migration")
|
|
8
|
+
# TestApp::Application.config.session_store :active_record_store
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
TestApp::Application.routes.draw do
|
|
2
|
+
# The priority is based upon order of creation:
|
|
3
|
+
# first created -> highest priority.
|
|
4
|
+
|
|
5
|
+
# Sample of regular route:
|
|
6
|
+
# match 'products/:id' => 'catalog#view'
|
|
7
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
8
|
+
|
|
9
|
+
# Sample of named route:
|
|
10
|
+
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
|
|
11
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
12
|
+
|
|
13
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
|
14
|
+
# resources :products
|
|
15
|
+
|
|
16
|
+
# Sample resource route with options:
|
|
17
|
+
# resources :products do
|
|
18
|
+
# member do
|
|
19
|
+
# get 'short'
|
|
20
|
+
# post 'toggle'
|
|
21
|
+
# end
|
|
22
|
+
#
|
|
23
|
+
# collection do
|
|
24
|
+
# get 'sold'
|
|
25
|
+
# end
|
|
26
|
+
# end
|
|
27
|
+
|
|
28
|
+
# Sample resource route with sub-resources:
|
|
29
|
+
# resources :products do
|
|
30
|
+
# resources :comments, :sales
|
|
31
|
+
# resource :seller
|
|
32
|
+
# end
|
|
33
|
+
|
|
34
|
+
# Sample resource route with more complex sub-resources
|
|
35
|
+
# resources :products do
|
|
36
|
+
# resources :comments
|
|
37
|
+
# resources :sales do
|
|
38
|
+
# get 'recent', :on => :collection
|
|
39
|
+
# end
|
|
40
|
+
# end
|
|
41
|
+
|
|
42
|
+
# Sample resource route within a namespace:
|
|
43
|
+
# namespace :admin do
|
|
44
|
+
# # Directs /admin/products/* to Admin::ProductsController
|
|
45
|
+
# # (app/controllers/admin/products_controller.rb)
|
|
46
|
+
# resources :products
|
|
47
|
+
# end
|
|
48
|
+
|
|
49
|
+
# You can have the root of your site routed with "root"
|
|
50
|
+
# just remember to delete public/index.html.
|
|
51
|
+
# root :to => "welcome#index"
|
|
52
|
+
|
|
53
|
+
# See how all your routes lay out with "rake routes"
|
|
54
|
+
|
|
55
|
+
# This is a legacy wild controller route that's not recommended for RESTful applications.
|
|
56
|
+
# Note: This route will make all actions in every controller accessible via GET requests.
|
|
57
|
+
# match ':controller(/:action(/:id(.:format)))'
|
|
58
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
|
3
|
+
#
|
|
4
|
+
# Examples:
|
|
5
|
+
#
|
|
6
|
+
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
|
@@ -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'
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
|
2
|
+
ENV["RAILS_ENV"] ||= 'test'
|
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
|
4
|
+
require 'rspec/rails'
|
|
5
|
+
|
|
6
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
7
|
+
# in spec/support/ and its subdirectories.
|
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
|
9
|
+
|
|
10
|
+
RSpec.configure do |config|
|
|
11
|
+
# == Mock Framework
|
|
12
|
+
#
|
|
13
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
14
|
+
#
|
|
15
|
+
# config.mock_with :mocha
|
|
16
|
+
# config.mock_with :flexmock
|
|
17
|
+
# config.mock_with :rr
|
|
18
|
+
config.mock_with :rspec
|
|
19
|
+
|
|
20
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
22
|
+
|
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
24
|
+
# examples within a transaction, remove the following line or assign false
|
|
25
|
+
# instead of true.
|
|
26
|
+
config.use_transactional_fixtures = true
|
|
27
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "initializing active-fedora in a rails 3 app" do
|
|
4
|
+
it "should include ActiveFedora::Railtie" do
|
|
5
|
+
begin
|
|
6
|
+
ActiveFedora::Railtie
|
|
7
|
+
railtie_loaded = true
|
|
8
|
+
rescue NameError
|
|
9
|
+
railtie_loaded = false
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
railtie_loaded.should be_true
|
|
13
|
+
|
|
14
|
+
end
|
|
15
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -15,7 +15,7 @@ ENV["RAILS_ENV"] ||= 'test'
|
|
|
15
15
|
RAILS_ENV = ENV["RAILS_ENV"]
|
|
16
16
|
|
|
17
17
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
|
18
|
-
Dir[File.join(File.dirname(__FILE__)+'/../lib/')+'**/*.rb'].each{|x| require x}
|
|
18
|
+
Dir[File.join(File.dirname(__FILE__)+'/../lib/')+'**/*.rb'].each{|x| require x unless x.match(/railtie.rb$/)}
|
|
19
19
|
$VERBOSE=nil
|
|
20
20
|
|
|
21
21
|
# This loads the Fedora and Solr config info from /config/fedora.yml
|
|
@@ -52,29 +52,88 @@ describe ActiveFedora do
|
|
|
52
52
|
ActiveFedora.send(:valid_predicate_mapping?,default_predicate_mapping_file).should be_true
|
|
53
53
|
end
|
|
54
54
|
it "should return false if the mapping is missing the :default_namespace" do
|
|
55
|
-
mock_yaml({:default_namespace0=>"my_namespace",:predicate_mapping=>{:key0=>"value0", :key1=>"value1"}})
|
|
55
|
+
mock_yaml({:default_namespace0=>"my_namespace",:predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
|
|
56
56
|
ActiveFedora.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
|
57
57
|
end
|
|
58
58
|
it "should return false if the :default_namespace is not a string" do
|
|
59
|
-
mock_yaml({:default_namespace=>{:foo=>"bar"}, :predicate_mapping=>{:key0=>"value0", :key1=>"value1"}})
|
|
59
|
+
mock_yaml({:default_namespace=>{:foo=>"bar"}, :predicate_mapping=>{:key0=>"value0", :key1=>"value1"}},"/path/to/predicate_mappings.yml")
|
|
60
60
|
ActiveFedora.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
|
61
61
|
end
|
|
62
62
|
it "should return false if the :predicate_mappings key is missing" do
|
|
63
|
-
mock_yaml({:default_namespace=>"a string"})
|
|
63
|
+
mock_yaml({:default_namespace=>"a string"},"/path/to/predicate_mappings.yml")
|
|
64
64
|
ActiveFedora.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
|
65
65
|
end
|
|
66
66
|
it "should return false if the :predicate_mappings key is not a hash" do
|
|
67
|
-
mock_yaml({:default_namespace=>"a string",:predicate_mapping=>"another string"})
|
|
67
|
+
mock_yaml({:default_namespace=>"a string",:predicate_mapping=>"another string"},"/path/to/predicate_mappings.yml")
|
|
68
68
|
ActiveFedora.send(:valid_predicate_mapping?,"/path/to/predicate_mappings.yml").should be_false
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
end
|
|
72
|
-
end
|
|
73
72
|
|
|
73
|
+
describe ".init" do
|
|
74
|
+
|
|
75
|
+
describe "outside of rails" do
|
|
76
|
+
it "should load the default packaged config/fedora.yml file if no explicit config path is passed" do
|
|
77
|
+
ActiveFedora.init()
|
|
78
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora"
|
|
79
|
+
end
|
|
80
|
+
it "should load the passed config if explicit config passed in" do
|
|
81
|
+
ActiveFedora.init('./spec/fixtures/rails_root/config/fedora.yml')
|
|
82
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@testhost.com:8983/fedora"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
describe "within rails" do
|
|
87
|
+
|
|
88
|
+
before(:all) do
|
|
89
|
+
Object.const_set("Rails",String)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
after(:all) do
|
|
93
|
+
if Rails == String
|
|
94
|
+
Object.send(:remove_const,:Rails)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
describe "versions prior to 3.0" do
|
|
99
|
+
describe "with explicit config path passed in" do
|
|
100
|
+
it "should load the specified config path" do
|
|
101
|
+
config_hash={"test"=>{"fedora"=>{"url"=>"http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora"},"solr"=>{"url"=>"http://127.0.0.1:8983/solr/test/"}}}
|
|
102
|
+
config_path = File.expand_path(File.join(File.dirname(__FILE__),"config"))
|
|
103
|
+
mock_yaml(config_hash,File.join(config_path,"fedora.yml"))
|
|
104
|
+
File.expects(:exist?).with(File.join(config_path,"predicate_mappings.yml")).returns(true)
|
|
105
|
+
ActiveFedora.expects(:valid_predicate_mapping?).returns(true)
|
|
106
|
+
ActiveFedora.init(File.join(config_path,"fedora.yml"))
|
|
107
|
+
ActiveFedora.solr.class.should == ActiveFedora::SolrService
|
|
108
|
+
ActiveFedora.fedora.class.should == Fedora::Repository
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
describe "with no explicit config path" do
|
|
113
|
+
it "should look for the file in the path defined at Rails.root" do
|
|
114
|
+
Rails.expects(:root).returns(File.join(File.dirname(__FILE__),"../fixtures/rails_root"))
|
|
115
|
+
ActiveFedora.init()
|
|
116
|
+
ActiveFedora.solr.class.should == ActiveFedora::SolrService
|
|
117
|
+
ActiveFedora.fedora.class.should == Fedora::Repository
|
|
118
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@testhost.com:8983/fedora"
|
|
119
|
+
end
|
|
120
|
+
it "should load the default file if no config is found at Rails.root" do
|
|
121
|
+
Rails.expects(:root).returns(File.join(File.dirname(__FILE__),"../fixtures/bad/path/to/rails_root"))
|
|
122
|
+
ActiveFedora.init()
|
|
123
|
+
ActiveFedora.solr.class.should == ActiveFedora::SolrService
|
|
124
|
+
ActiveFedora.fedora.class.should == Fedora::Repository
|
|
125
|
+
ActiveFedora.fedora.fedora_url.to_s.should == "http://fedoraAdmin:fedoraAdmin@127.0.0.1:8983/fedora"
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
74
132
|
|
|
75
|
-
def mock_yaml(hash)
|
|
76
|
-
mock_file = mock(
|
|
77
|
-
File.
|
|
133
|
+
def mock_yaml(hash, path)
|
|
134
|
+
mock_file = mock(path.split("/")[-1])
|
|
135
|
+
File.stubs(:exist?).with(path).returns(true)
|
|
136
|
+
File.expects(:open).with(path).returns(mock_file)
|
|
78
137
|
YAML.expects(:load).returns(hash)
|
|
79
138
|
end
|
|
80
139
|
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active-fedora
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 3
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 2
|
|
8
|
-
- 2
|
|
9
8
|
- 3
|
|
10
|
-
|
|
9
|
+
- 0
|
|
10
|
+
version: 2.3.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Matt Zumwalt
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2011-06-
|
|
19
|
+
date: 2011-06-21 00:00:00 Z
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
22
22
|
name: solr-ruby
|
|
@@ -458,6 +458,7 @@ files:
|
|
|
458
458
|
- lib/active_fedora/nokogiri_datastream.rb
|
|
459
459
|
- lib/active_fedora/property.rb
|
|
460
460
|
- lib/active_fedora/qualified_dublin_core_datastream.rb
|
|
461
|
+
- lib/active_fedora/railtie.rb
|
|
461
462
|
- lib/active_fedora/relationship.rb
|
|
462
463
|
- lib/active_fedora/rels_ext_datastream.rb
|
|
463
464
|
- lib/active_fedora/samples.rb
|
|
@@ -494,6 +495,11 @@ files:
|
|
|
494
495
|
- spec/fixtures/minivan.jpg
|
|
495
496
|
- spec/fixtures/mods_articles/hydrangea_article1.xml
|
|
496
497
|
- spec/fixtures/oh_qdc.xml
|
|
498
|
+
- spec/fixtures/rails_root/config/fedora.yml
|
|
499
|
+
- spec/fixtures/rails_root/config/predicate_mappings.yml
|
|
500
|
+
- spec/fixtures/rails_root/config/solr_mappings.yml
|
|
501
|
+
- spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml
|
|
502
|
+
- spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml
|
|
497
503
|
- spec/fixtures/test_12.foxml.xml
|
|
498
504
|
- spec/hydrangea_fixture_mods_article1.foxml.xml
|
|
499
505
|
- spec/integration/base_file_management_spec.rb
|
|
@@ -514,6 +520,35 @@ files:
|
|
|
514
520
|
- spec/integration/rf_fedora_object_spec.rb
|
|
515
521
|
- spec/integration/semantic_node_spec.rb
|
|
516
522
|
- spec/integration/solr_service_spec.rb
|
|
523
|
+
- spec/rails3_test_app/.gitignore
|
|
524
|
+
- spec/rails3_test_app/.rspec
|
|
525
|
+
- spec/rails3_test_app/.rvmrc
|
|
526
|
+
- spec/rails3_test_app/Gemfile
|
|
527
|
+
- spec/rails3_test_app/Gemfile.lock
|
|
528
|
+
- spec/rails3_test_app/Rakefile
|
|
529
|
+
- spec/rails3_test_app/app/controllers/application_controller.rb
|
|
530
|
+
- spec/rails3_test_app/app/helpers/application_helper.rb
|
|
531
|
+
- spec/rails3_test_app/app/views/layouts/application.html.erb
|
|
532
|
+
- spec/rails3_test_app/config.ru
|
|
533
|
+
- spec/rails3_test_app/config/application.rb
|
|
534
|
+
- spec/rails3_test_app/config/boot.rb
|
|
535
|
+
- spec/rails3_test_app/config/database.yml
|
|
536
|
+
- spec/rails3_test_app/config/environment.rb
|
|
537
|
+
- spec/rails3_test_app/config/environments/development.rb
|
|
538
|
+
- spec/rails3_test_app/config/environments/production.rb
|
|
539
|
+
- spec/rails3_test_app/config/environments/test.rb
|
|
540
|
+
- spec/rails3_test_app/config/initializers/backtrace_silencers.rb
|
|
541
|
+
- spec/rails3_test_app/config/initializers/inflections.rb
|
|
542
|
+
- spec/rails3_test_app/config/initializers/mime_types.rb
|
|
543
|
+
- spec/rails3_test_app/config/initializers/secret_token.rb
|
|
544
|
+
- spec/rails3_test_app/config/initializers/session_store.rb
|
|
545
|
+
- spec/rails3_test_app/config/locales/en.yml
|
|
546
|
+
- spec/rails3_test_app/config/routes.rb
|
|
547
|
+
- spec/rails3_test_app/db/seeds.rb
|
|
548
|
+
- spec/rails3_test_app/run_tests
|
|
549
|
+
- spec/rails3_test_app/script/rails
|
|
550
|
+
- spec/rails3_test_app/spec/spec_helper.rb
|
|
551
|
+
- spec/rails3_test_app/spec/unit/rails_3_init.rb
|
|
517
552
|
- spec/rcov.opts
|
|
518
553
|
- spec/samples/models/audio_record.rb
|
|
519
554
|
- spec/samples/models/hydrangea_article.rb
|
|
@@ -592,6 +627,11 @@ test_files:
|
|
|
592
627
|
- spec/fixtures/minivan.jpg
|
|
593
628
|
- spec/fixtures/mods_articles/hydrangea_article1.xml
|
|
594
629
|
- spec/fixtures/oh_qdc.xml
|
|
630
|
+
- spec/fixtures/rails_root/config/fedora.yml
|
|
631
|
+
- spec/fixtures/rails_root/config/predicate_mappings.yml
|
|
632
|
+
- spec/fixtures/rails_root/config/solr_mappings.yml
|
|
633
|
+
- spec/fixtures/rails_root/config/solr_mappings_af_0.1.yml
|
|
634
|
+
- spec/fixtures/rails_root/config/solr_mappings_bl_2.4.yml
|
|
595
635
|
- spec/fixtures/test_12.foxml.xml
|
|
596
636
|
- spec/hydrangea_fixture_mods_article1.foxml.xml
|
|
597
637
|
- spec/integration/base_file_management_spec.rb
|
|
@@ -612,6 +652,35 @@ test_files:
|
|
|
612
652
|
- spec/integration/rf_fedora_object_spec.rb
|
|
613
653
|
- spec/integration/semantic_node_spec.rb
|
|
614
654
|
- spec/integration/solr_service_spec.rb
|
|
655
|
+
- spec/rails3_test_app/.gitignore
|
|
656
|
+
- spec/rails3_test_app/.rspec
|
|
657
|
+
- spec/rails3_test_app/.rvmrc
|
|
658
|
+
- spec/rails3_test_app/Gemfile
|
|
659
|
+
- spec/rails3_test_app/Gemfile.lock
|
|
660
|
+
- spec/rails3_test_app/Rakefile
|
|
661
|
+
- spec/rails3_test_app/app/controllers/application_controller.rb
|
|
662
|
+
- spec/rails3_test_app/app/helpers/application_helper.rb
|
|
663
|
+
- spec/rails3_test_app/app/views/layouts/application.html.erb
|
|
664
|
+
- spec/rails3_test_app/config.ru
|
|
665
|
+
- spec/rails3_test_app/config/application.rb
|
|
666
|
+
- spec/rails3_test_app/config/boot.rb
|
|
667
|
+
- spec/rails3_test_app/config/database.yml
|
|
668
|
+
- spec/rails3_test_app/config/environment.rb
|
|
669
|
+
- spec/rails3_test_app/config/environments/development.rb
|
|
670
|
+
- spec/rails3_test_app/config/environments/production.rb
|
|
671
|
+
- spec/rails3_test_app/config/environments/test.rb
|
|
672
|
+
- spec/rails3_test_app/config/initializers/backtrace_silencers.rb
|
|
673
|
+
- spec/rails3_test_app/config/initializers/inflections.rb
|
|
674
|
+
- spec/rails3_test_app/config/initializers/mime_types.rb
|
|
675
|
+
- spec/rails3_test_app/config/initializers/secret_token.rb
|
|
676
|
+
- spec/rails3_test_app/config/initializers/session_store.rb
|
|
677
|
+
- spec/rails3_test_app/config/locales/en.yml
|
|
678
|
+
- spec/rails3_test_app/config/routes.rb
|
|
679
|
+
- spec/rails3_test_app/db/seeds.rb
|
|
680
|
+
- spec/rails3_test_app/run_tests
|
|
681
|
+
- spec/rails3_test_app/script/rails
|
|
682
|
+
- spec/rails3_test_app/spec/spec_helper.rb
|
|
683
|
+
- spec/rails3_test_app/spec/unit/rails_3_init.rb
|
|
615
684
|
- spec/rcov.opts
|
|
616
685
|
- spec/samples/models/audio_record.rb
|
|
617
686
|
- spec/samples/models/hydrangea_article.rb
|