Sha256: 29a39d1a9cea312378719e87a6134a19b65c84af0ee5e0d055153681c39ffe5c

Contents?: true

Size: 1.55 KB

Versions: 5

Compression:

Stored size: 1.55 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?"
        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

5 entries across 5 versions & 1 rubygems

Version Path
hydra-head-4.0.3 lib/railties/hydra-fixtures.rake
hydra-head-4.0.2 lib/railties/hydra-fixtures.rake
hydra-head-4.0.1 lib/railties/hydra-fixtures.rake
hydra-head-4.0.0 lib/railties/hydra-fixtures.rake
hydra-head-4.0.0.rc6 lib/railties/hydra-fixtures.rake