Skip to content

Commit

Permalink
fixup rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Aug 16, 2012
1 parent 7f24ede commit 8b8029c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
12 changes: 6 additions & 6 deletions README.textile → README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
h1. pairtree
# pairtree

Ruby implementation of the "Pairtree":https://confluence.ucop.edu/display/Curation/PairTree microservice specification from the California Digital Library
Ruby implementation of the [Pairtree](https://confluence.ucop.edu/display/Curation/PairTree microservice specification from the California Digital Librar)

h2. Usage
# Usage

<pre><code>
```ruby
# Initiate a tree
pairtree = Pairtree.at('./data', :prefix => 'pfx:', :create => true)

Expand All @@ -28,9 +28,9 @@ h2. Usage

# Delete a ppath and all its contents
pairtree.purge!('pfx:abc123def')
</code></pre>
```

h2. Copyright
## Copyright

Copyright (c) 2010 Chris Beer. See LICENSE.txt for
further details.
Expand Down
52 changes: 35 additions & 17 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
Dir.glob('lib/tasks/*.rake').each { |r| import r }
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end

Bundler::GemHelper.install_tasks

require 'bundler/gem_tasks'
require 'rake'
require 'rspec'
require 'rspec/core/rake_task'

begin
if RUBY_VERSION < "1.9"
require 'rcov/rcovtask'
desc "Generate code coverage"
RSpec::Core::RakeTask.new(:rcov) do |t|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
t.rcov = true
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
end
desc 'Default: run specs.'
task :default => :spec

RSpec::Core::RakeTask.new do |t|
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
t.rcov = true
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
end
rescue
end

RSpec::Core::RakeTask.new(:spec)
# 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')

task :clean do
puts 'Cleaning old coverage.data'
FileUtils.rm('coverage.data') if(File.exists? 'coverage.data')
YARD::Rake::YardocTask.new(:doc) do |yt|
yt.files = Dir.glob(File.join(project_root, 'lib', '**', '*.rb')) +
[ File.join(project_root, 'README.md') ]
yt.options = ['--output-dir', doc_destination, '--readme', 'README.md']
end
rescue LoadError
desc "Generate YARD Documentation"
task :doc do
abort "Please install the YARD gem to generate rdoc."
end
end

task :default => [:rcov, :doc]

0 comments on commit 8b8029c

Please sign in to comment.