Skip to content

Commit b4b9adf

Browse files
committed
Fixup rake + rspec for 1.8 + 1.9
1 parent acbc956 commit b4b9adf

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

README.rdoc renamed to README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
= noid
1+
# noid
22

33
Ruby implementation of NOID (Nice Opaque Identifier)
44

5-
== Contributing to noid
5+
## Contributing to noid
66

77
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
88
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
@@ -12,7 +12,7 @@ Ruby implementation of NOID (Nice Opaque Identifier)
1212
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
1313
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
1414

15-
== Copyright
15+
## Copyright
1616

1717
Copyright (c) 2010 Chris Beer. See LICENSE.txt for
1818
further details.

Rakefile

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,45 @@
1-
require 'bundler/gem_tasks'
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

13+
require 'rake'
14+
require 'rspec'
315
require 'rspec/core/rake_task'
416

17+
desc 'Default: run specs.'
18+
task :default => :spec
19+
520
RSpec::Core::RakeTask.new do |t|
6-
t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
7-
t.pattern = 'spec/**/*_spec.rb'
21+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.8/
22+
t.rcov = true
23+
t.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
24+
end
825
end
26+
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')
33+
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
44+
end
45+

spec/spec_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
require 'rubygems'
22
require 'bundler/setup'
3+
4+
if ENV['COVERAGE'] and RUBY_VERSION =~ /^1.9/
5+
require 'simplecov'
6+
7+
SimpleCov.start
8+
end
9+
310
require 'noid'
411

512
RSpec.configure do |config|

0 commit comments

Comments
 (0)