forked from net7/ruby-oai-talia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
116 lines (97 loc) · 3.3 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
RUBY_OAI_VERSION = '0.0.12'
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'rake/packagetask'
require 'rubygems/package_task'
task :default => ["test"]
task :test => ["test:client", "test:provider"]
begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "oai_talia"
s.version = '1.0.10'
s.summary = "A ruby library for working with the Open Archive Initiative Protocol for Metadata Harvesting (OAI-PMH)"
s.description = "A ruby library for working with the Open Archive Initiative Protocol for Metadata Harvesting (OAI-PMH). Fork of the original version by Ed Summers, aims for best standards compatibility (test with http://re.cs.uct.ac.za/)"
s.required_ruby_version = '>= 1.8.6'
s.authors = ["Ed Summers", "Daniel Hahn", "Josyan Pierson"]
s.email = "[email protected]"
s.platform = Gem::Platform::RUBY
s.require_path = 'lib'
s.autorequire = 'oai'
s.has_rdoc = true
s.bindir = 'bin'
s.executables = 'oai'
s.add_dependency('builder', '>=2.0.0')
s.files = %w(README Rakefile) +
Dir.glob("{bin,test,lib}/**/*") +
Dir.glob("examples/**/*.rb")
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
namespace :test do
Rake::TestTask.new('client') do |t|
t.libs += ['lib', 'test/client']
t.pattern = 'test/client/tc_*.rb'
t.verbose = true
end
Rake::TestTask.new('provider') do |t|
t.libs += ['lib', 'test/provider']
t.pattern = 'test/provider/tc_*.rb'
t.verbose = true
end
desc "Active Record base Provider Tests"
Rake::TestTask.new('activerecord_provider') do |t|
t.libs += ['lib', 'test/activerecord_provider']
t.pattern = 'test/activerecord_provider/tc_*.rb'
t.verbose = true
end
desc 'Measures test coverage'
# borrowed from here: http://clarkware.com/cgi/blosxom/2007/01/05#RcovRakeTask
task :coverage do
rm_f "coverage"
rm_f "coverage.data"
system("rcov --aggregate coverage.data --text-summary -Ilib:test/provider test/provider/tc_*.rb")
system("rcov --aggregate coverage.data --text-summary -Ilib:test/client test/client/tc_*.rb")
system("open coverage/index.html") if PLATFORM['darwin']
end
end
desc "Run all unit tests"
task :test => ['test:client', 'test:provider', 'test:activerecord_provider']
task 'test:activerecord_provider' => :create_database
task :environment do
unless defined? OAI_PATH
OAI_PATH = File.dirname(__FILE__) + '/lib/oai'
$LOAD_PATH << OAI_PATH
$LOAD_PATH << File.dirname(__FILE__) + '/test'
end
end
task :drop_database => :environment do
%w{rubygems active_record yaml}.each { |lib| require lib }
require 'activerecord_provider/database/ar_migration'
require 'activerecord_provider/config/connection'
begin
OAIPMHTables.down
rescue
end
end
task :create_database => :drop_database do
OAIPMHTables.up
end
task :load_fixtures => :create_database do
require 'test/activerecord_provider/models/dc_field'
fixtures = YAML.load_file(
File.join('test', 'activerecord_provider', 'fixtures', 'dc.yml')
)
fixtures.keys.sort.each do |key|
DCField.create(fixtures[key])
end
end
Rake::RDocTask.new('doc') do |rd|
rd.rdoc_files.include("lib/**/*.rb", "README")
rd.main = 'README'
rd.rdoc_dir = 'doc'
end