-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
40 lines (31 loc) · 876 Bytes
/
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
require 'erb'
require 'rubygems/package_task'
@gemname = 'rbenv-rubygem-cpanel-helper'
@specfile = "#{@gemname}.spec"
begin
require 'yard'
YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb']
end
rescue LoadError
end
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
end
spec = Gem::Specification.load(Dir.glob('*.gemspec').first)
Gem::PackageTask.new(spec) {}
desc 'Build SRPM'
task srpm: [:gem, :template_spec] do |t|
sh "rpmbuild -bs -D '_sourcedir #{Dir.pwd}/pkg' -D '_srcrpmdir #{Dir.pwd}/pkg' #{@specfile}"
$?.success? || raise('Failure building SRPM')
end
task :template_spec do
spectempl = "#{@specfile}.in"
gem_version = spec.version
ruby_version = RUBY_VERSION
erb = ERB.new(File.read(spectempl))
erb.filename = spectempl
File.write(@specfile, erb.result(binding), mode: 'w+')
end