Skip to content

Commit

Permalink
Adding rake tasks: hudson, active_fedora, etc.
Browse files Browse the repository at this point in the history
Adds following rake tasks:
  rake hudson
  rake active_fedora:doc
  rake active_fedora:rspec
  rake active_fedora:configure_jetty
  • Loading branch information
John Scofield committed May 10, 2011
1 parent 73529c9 commit f35b1b3
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'rake/clean'
require 'rubygems'
load 'tasks/rspec.rake'
load 'tasks/active_fedora.rake'

$: << 'lib'


Expand All @@ -25,7 +27,12 @@ begin
gem.add_dependency("mediashelf-loggable")
gem.add_dependency("equivalent-xml")
gem.add_dependency("facets")

gem.add_development_dependency("yard")
gem.add_development_dependency("RedCloth")
gem.add_development_dependency("rcov")
gem.add_development_dependency("solrizer")
gem.add_development_dependency("solrizer-fedora")
gem.add_development_dependency("jettywrapper")
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
Expand Down
2 changes: 2 additions & 0 deletions spec/rcov.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--exclude "spec/*,gems/*"
--rails
93 changes: 93 additions & 0 deletions tasks/active_fedora.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
$: << 'lib'

JETTY_PARAMS = {
:quiet => true,
:jetty_home => File.join(File.dirname(__FILE__),'..','jetty'),
:jetty_port => 8983,
:solr_home => File.expand_path(File.join(File.dirname(__FILE__),'..','jetty','solr')),
:fedora_home => File.expand_path(File.join(File.dirname(__FILE__),'..','jetty','fedora','default')),
:startup_wait=>30
}


desc "Hudson build"
task :hudson do
require 'jettywrapper'
Rake::Task["active_fedora:doc"].invoke
Rake::Task["active_fedora:configure_jetty"].invoke
error = Jettywrapper.wrap(JETTY_PARAMS) do
Rake::Task["active_fedora:load_fixtures"].invoke
Rake::Task["active_fedora:rspec"].invoke
end
raise "test failures: #{error}" if error
end


namespace :active_fedora do
require 'lib/active-fedora'

# Use yard to build docs
begin
require 'yard'
require 'yard/rake/yardoc_task'
project_root = File.expand_path("#{File.dirname(__FILE__)}/../")
doc_destination = File.join(project_root, 'doc')

YARD::Rake::YardocTask.new(:doc) do |yt|
yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
[ File.join(project_root, 'README.textile') ]
yt.options = ['--output-dir', doc_destination, '--readme', 'README.textile']
end
rescue LoadError
desc "Generate YARD Documentation"
task :doc do
abort "Please install the YARD gem to generate rdoc."
end
end


Spec::Rake::SpecTask.new(:rspec) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts << "--exclude \"spec/* gems/*\" --rails"
end

task :refresh_fixtures do
Rake::Task["active_fedora:clean_jetty"].invoke
Rake::Task["active_fedora:load_fixtures"].invoke
end

task :clean_jetty do
Dir.chdir("./jetty")
system("git clean -f -d")
system("git checkout .")
Dir.chdir("..")
end

task :load_fixtures do
require 'solrizer'
require 'solrizer-fedora'
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}"
fixture = File.open(File.expand_path(File.join("spec","fixtures","hydrangea_fixture_mods_article1.foxml.xml")),"r")
ActiveFedora.init unless Thread.current[:repo]
result = foxml = Fedora::Repository.instance.ingest(fixture.read)
if result
solrizer = Solrizer::Fedora::Solrizer.new
solrizer.solrize "hydrangea:fixture_mods_article1"
end
#retval = `$FEDORA_HOME/client/bin/fedora-ingest.sh f #{fixture} info:fedora/fedora-system:FOXML-1.1 localhost:8983 fedoraAdmin fedoraAdmin http`
puts "Loaded #{fixture}: #{retval}"
end

desc "Copies the default SOLR config for the bundled Testing Server"
task :configure_jetty do
Rake::Task["active_fedora:clean_jetty"].invoke
FileList['solr/conf/*'].each do |f|
cp("#{f}", 'jetty/solr/development-core/conf/', :verbose => true)
cp("#{f}", 'jetty/solr/test-core/conf/', :verbose => true)
end
end

end

0 comments on commit f35b1b3

Please sign in to comment.