forked from dmacvicar/ruby-rpm-ffi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
52 lines (46 loc) · 1.35 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
$LOAD_PATH.push(File.join(File.dirname(__FILE__), 'lib'))
require 'bundler/gem_tasks'
require 'rpm/gem_version'
require 'rake/testtask'
task default: [:test]
Rake::TestTask.new do |t|
t.libs << File.expand_path('../test', __FILE__)
t.libs << File.expand_path('../', __FILE__)
t.test_files = FileList['test/test*.rb']
t.verbose = true
t.loader = :direct
end
extra_docs = ['README*', 'TODO*', 'CHANGELOG*']
begin
require 'yard'
YARD::Rake::YardocTask.new(:doc) do |t|
t.files = ['lib/**/*.rb', *extra_docs]
t.options = ['--no-private']
end
rescue LoadError
STDERR.puts 'Install yard if you want prettier docs'
begin
require 'rdoc/task'
Rake::RDocTask.new(:doc) do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = "rpm for Ruby #{RPM::GEM_VERSION}"
extra_docs.each { |ex| rdoc.rdoc_files.include ex }
end
rescue LoadError
STDERR.puts 'rdoc not available'
end
end
task :docker_images do
Dir.chdir('_docker') do
Dir.glob('Dockerfile.*').each do |dockerfile|
tag = 'ruby-rpm-ffi:' + File.extname(dockerfile).delete('.')
sh %(docker build -f #{dockerfile} -t #{tag} .)
end
end
end
task :docker_test do
Dir.glob('_docker/Dockerfile.*').each do |dockerfile|
tag = 'ruby-rpm-ffi:' + File.extname(dockerfile).delete('.')
sh %(docker run -ti -v #{Dir.pwd}:/src #{tag} rake test)
end
end