-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding rake tasks: hudson, active_fedora, etc.
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
Showing
3 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--exclude "spec/*,gems/*" | ||
--rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |