Skip to content

Commit 8b8029c

Browse files
committed
fixup rakefile
1 parent 7f24ede commit 8b8029c

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed

README.textile renamed to README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
h1. pairtree
1+
# pairtree
22

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

5-
h2. Usage
5+
# Usage
66

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

@@ -28,9 +28,9 @@ h2. Usage
2828

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

33-
h2. Copyright
33+
## Copyright
3434

3535
Copyright (c) 2010 Chris Beer. See LICENSE.txt for
3636
further details.

Rakefile

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,45 @@
1-
Dir.glob('lib/tasks/*.rake').each { |r| import r }
1+
require 'rubygems'
2+
require 'bundler'
3+
begin
4+
Bundler.setup(:default, :development)
5+
rescue Bundler::BundlerError => e
6+
$stderr.puts e.message
7+
$stderr.puts "Run `bundle install` to install missing gems"
8+
exit e.status_code
9+
end
10+
11+
Bundler::GemHelper.install_tasks
212

3-
require 'bundler/gem_tasks'
413
require 'rake'
14+
require 'rspec'
515
require 'rspec/core/rake_task'
616

7-
begin
8-
if RUBY_VERSION < "1.9"
9-
require 'rcov/rcovtask'
10-
desc "Generate code coverage"
11-
RSpec::Core::RakeTask.new(:rcov) do |t|
12-
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
13-
t.rcov = true
14-
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
15-
end
17+
desc 'Default: run specs.'
18+
task :default => :spec
19+
20+
RSpec::Core::RakeTask.new do |t|
21+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
22+
t.rcov = true
23+
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
1624
end
17-
rescue
1825
end
1926

20-
RSpec::Core::RakeTask.new(:spec)
27+
# Use yard to build docs
28+
begin
29+
require 'yard'
30+
require 'yard/rake/yardoc_task'
31+
project_root = File.expand_path(File.dirname(__FILE__))
32+
doc_destination = File.join(project_root, 'doc')
2133

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

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

0 commit comments

Comments
 (0)