Sha256: 542561a1765c590c7cd7115b02517f92697128449e32b715ca39403075316099

Contents?: true

Size: 1.6 KB

Versions: 51

Compression:

Stored size: 1.6 KB

Contents

namespace :hydra do
  
  desc "Init Hydra configuration" 
  task :init => [:environment] do
    # We need to just start rails so that all the models are loaded
  end

  desc "Load hydra-head models"
  task :load_models do
    require "hydra"
    Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), "..",'app','models', '*.rb')).each do |model|
      load model
    end
  end

  namespace :fixtures do
    task :load do
      ENV["dir"] ||= File.join("spec", "fixtures")
      loader = ActiveFedora::FixtureLoader.new(ENV['dir'])
      Dir.glob("#{ENV['dir']}/*.foxml.xml").each do |fixture_path|
        pid = File.basename(fixture_path, ".foxml.xml").sub("_",":")
        begin
          foo = loader.reload(pid)
          puts "Updated #{pid}"
        rescue Errno::ECONNREFUSED => e
          puts "Can't connect to Fedora! Are you sure jetty is running? (#{ActiveFedora::Base.connection_for_pid(pid).inspect})"
        rescue Exception => e
          puts("Received a Fedora error while loading #{pid}\n#{e}")
          logger.error("Received a Fedora error while loading #{pid}\n#{e}")
        end
      end
    end

    desc "Remove default Hydra fixtures"
    task :delete do
      ENV["dir"] ||= File.join("spec", "fixtures")
      loader = ActiveFedora::FixtureLoader.new(ENV['dir'])
      Dir.glob("#{ENV['dir']}/*.foxml.xml").each do |fixture_path|
        ENV["pid"] = File.basename(fixture_path, ".foxml.xml").sub("_",":")
        Rake::Task["repo:delete"].reenable
        Rake::Task["repo:delete"].invoke
      end
    end

    desc "Refresh default Hydra fixtures"
    task :refresh => [:delete, :load]

  end
end
  

Version data entries

51 entries across 51 versions & 2 rubygems

Version Path
hydra-core-5.4.1 lib/railties/hydra-fixtures.rake
hydra-core-6.3.4 lib/railties/hydra-fixtures.rake
hydra-core-6.3.3 lib/railties/hydra-fixtures.rake
hydra-core-6.3.2 lib/railties/hydra-fixtures.rake
hydra-core-6.3.1 lib/railties/hydra-fixtures.rake
hydra-core-6.3.0 lib/railties/hydra-fixtures.rake
hydra-core-6.3.0.rc1 lib/railties/hydra-fixtures.rake
hydra-core-6.2.2 lib/railties/hydra-fixtures.rake
hydra-core-6.2.1 lib/railties/hydra-fixtures.rake
hydra-core-6.2.0 lib/railties/hydra-fixtures.rake
hydra-core-6.1.1 lib/railties/hydra-fixtures.rake
hydra-core-6.1.0 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.rc4 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.rc3 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.rc2 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.rc1 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.pre8 lib/railties/hydra-fixtures.rake
hydra-core-5.4.0 lib/railties/hydra-fixtures.rake
hydra-core-6.0.0.pre7 lib/railties/hydra-fixtures.rake