Skip to content

Commit

Permalink
fixing rake tasks to load fixture properly
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingzumwalt committed May 11, 2011
1 parent ae8962b commit 26b9388
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
12 changes: 12 additions & 0 deletions spec/samples/models/hydrangea_article.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "active-fedora"
require "active_fedora/samples"

# This Model is used to load & index the hydrangea:fixture_mods_article1 fixture for use in tests.
#
# See lib/samples/sample_thing.rb for a fuller, annotated example of an ActiveFedora Model
class HydrangeaArticle < ActiveFedora::Base

has_metadata :name => "descMetadata", :type=> Hydra::ModsArticleDatastream
has_metadata :name => "rightsMetadata", :type => Hydra::RightsMetadataDatastream

end
13 changes: 12 additions & 1 deletion tasks/active_fedora.rake
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ namespace :active_fedora do
Dir.chdir("..")
end

task :load_fixtures do
task :load_fixtures => :environment do
require 'solrizer'
require 'solrizer-fedora'
require 'spec/samples/models/hydrangea_article'
ENV["FEDORA_HOME"]=File.expand_path(File.join(File.dirname(__FILE__),'..','jetty','fedora','default'))
retval = `$FEDORA_HOME/client/bin/fedora-ingest-demos.sh localhost 8983 fedoraAdmin fedoraAdmin http`
puts "loaded demo objects #{retval}"
Expand All @@ -107,3 +108,13 @@ namespace :active_fedora do
end

end

# Provides an :environment task for use while working within a working copy of active-fedora
# You should never load this rake file into any other application
desc 'Set up ActiveFedora environment. !! Only for use while working within a working copy of active-fedora'
task :environment do
puts "Initializing ActiveFedora Rake environment. This should only be called when working within a workign copy of the active-fedora code."
require 'spec/samples/models/hydrangea_article'
# $:.unshift(File.dirname(__FILE__) + '/../lib')
# Dir[File.join(File.dirname(__FILE__)+'/../lib/')+'**/*.rb'].each{|x| require x}
end

0 comments on commit 26b9388

Please sign in to comment.