forked from kennym/annotate-sequel
/
Rakefile
56 lines (44 loc) · 1.33 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
require "rake"
require "rake/clean"
CLEAN.include ["sequel-annotate-*.gem", "rdoc"]
desc "Build sequel-annotate gem"
task :package=>[:clean] do |p|
sh %{#{FileUtils::RUBY} -S gem build sequel-annotate.gemspec}
end
### Specs
desc "Run specs"
task :spec do
sh "#{FileUtils::RUBY} #{"-w" if RUBY_VERSION >= '3'} -I lib spec/sequel-annotate_spec.rb"
end
task :default => :spec
desc "Run specs with coverage"
task :spec_cov do
ENV["COVERAGE"] = "1"
Rake::Task['spec'].invoke
ENV.delete('COVERAGE')
end
desc "Run specs in CI"
task :spec_ci do
ENV['SEQUEL_ANNOTATE_SPEC_CI'] = '1'
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
ENV['SEQUEL_ANNOTATE_SPEC_POSTGRES_URL'] = "jdbc:postgresql://localhost/?user=postgres"
else
ENV['SEQUEL_ANNOTATE_SPEC_POSTGRES_URL'] = "postgres://localhost/?user=postgres"
end
Rake::Task['spec'].invoke
end
### RDoc
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'sequel-annotate: Annotate Sequel models with schema information']
begin
gem 'rdoc'
gem 'hanna'
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
rescue Gem::LoadError
end
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
require "rdoc/task"
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.options += RDOC_OPTS
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
end