lib/tasks/active_fedora.rake in active-fedora-4.0.0.rc2 vs lib/tasks/active_fedora.rake in active-fedora-4.0.0.rc3

- old
+ new

@@ -4,11 +4,11 @@ desc "Delete and re-import the object identified by pid" task :refresh => [:delete,:load] desc "Delete the object identified by pid. Example: rake repo:delete pid=demo:12" - task :delete => :init do + task :delete => :environment do if ENV["pid"].nil? puts "You must specify a valid pid. Example: rake repo:delete pid=demo:12" else pid = ENV["pid"] begin @@ -21,11 +21,11 @@ puts "Deleted '#{pid}' from #{ActiveFedora::Base.connection_for_pid(pid).client.url}" end end desc "Delete a range of objects in a given namespace. ie 'rake repo:delete_range namespace=demo start=22 stop=50' will delete demo:22 through demo:50" - task :delete_range => :init do |t, args| + task :delete_range => :environment do |t, args| namespace = ENV["namespace"] start_point = ENV["start"].to_i stop_point = ENV["stop"].to_i unless start_point <= stop_point raise StandardError "start point must be less that end point." @@ -43,11 +43,11 @@ i += 1 end end desc "Export the object identified by pid into spec/fixtures. Example:rake repo:export pid=demo:12" - task :export => :init do + task :export => :environment do if ENV["pid"].nil? puts "You must specify a valid pid. Example: rake repo:export pid=demo:12" else pid = ENV["pid"] puts "Exporting '#{pid}' from #{ActiveFedora::Base.connection_for_pid(pid).client.url}" @@ -60,11 +60,11 @@ puts "The object has been saved as #{filename}" end end desc "Load the object located at the provided path or identified by pid. Example: rake repo:load path=spec/fixtures/demo_12.foxml.xml" - task :load => :init do + task :load => :environment do if !ENV["path"].nil? and File.file?(ENV["path"]) filename = ENV["path"] elsif !ENV["pid"].nil? pid = ENV["pid"] if !ENV["path"].nil? and File.directory?(ENV["path"]) @@ -91,16 +91,10 @@ end end end - - desc "Init ActiveFedora configuration" - task :init do - if !ENV["environment"].nil? - RAILS_ENV = ENV["environment"] - end - # If Fedora Repository connection is not already initialized, initialize it using ActiveFedora defaults - ActiveFedora.init unless Thread.current[:repo] + task :environment do + # This task is overridden (chained) in hydra-head. end end