-
Notifications
You must be signed in to change notification settings - Fork 17
/
Rakefile
63 lines (53 loc) · 1.68 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
require "rake"
require "rake/clean"
CLEAN.include ["*.gem", "rdoc"]
RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
'Sequel PostgreSQL Triggers: Database enforced timestamps, immutable columns, and counter/sum caches', '--main', 'README.rdoc']
rdoc_task_class = begin
require "rdoc/task"
RDOC_OPTS.concat(['-f', 'hanna'])
RDoc::Task
rescue LoadError
require "rake/rdoctask"
Rake::RDocTask
end
rdoc_task_class.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.options += RDOC_OPTS
rdoc.rdoc_files.add %w"README.rdoc MIT-LICENSE lib/sequel_postgresql_triggers.rb lib/sequel/extensions/pg_triggers.rb"
end
test_flags = String.new
test_flags << " -w" if RUBY_VERSION >= '3'
test_flags << " -W:strict_unused_block" if RUBY_VERSION >= '3.4'
desc "Run specs with extension"
task :spec do
sh "#{FileUtils::RUBY} #{test_flags} spec/sequel_postgresql_triggers_spec.rb"
end
desc "Run specs with global modification"
task :spec_global do
begin
ENV['PGT_GLOBAL'] = '1'
sh "#{FileUtils::RUBY} #{test_flags} spec/sequel_postgresql_triggers_spec.rb"
ensure
ENV.delete('PGT_GLOBAL')
end
end
desc "Run all specs"
task :default => [:spec, :spec_global]
desc "Run specs with coverage"
task :spec_cov do
ENV["COVERAGE"] = "extension"
Rake::Task['spec'].invoke
ENV["COVERAGE"] = "global"
Rake::Task['spec_global'].invoke
ENV.delete('COVERAGE')
end
desc "Run specs in CI"
task :spec_ci do
ENV['PGT_SPEC_DB'] = "#{RUBY_ENGINE == 'jruby' ? 'jdbc:postgresql' : 'postgres'}://localhost/?user=postgres&password=postgres"
Rake::Task['default'].invoke
end
desc "Package sequel_postgresql_triggers"
task :package do
sh %{gem build sequel_postgresql_triggers.gemspec}
end