-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
74 lines (63 loc) · 2.23 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
# frozen_string_literal: true
#--
# Yast rake
#
# Copyright (C) 2009-2013 Novell, Inc.
# This library is free software; you can redistribute it and/or modify
# it only under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#++
require_relative "lib/yast/rake"
# remove tarball implementation and create gem for this gemfile
Rake::Task[:tarball].clear
# build the gem package
desc "Build gem package, save RPM sources to package subdirectory"
task :tarball do
version = File.read("VERSION").chomp
Dir["package/*.tar.bz2"].each do |f|
rm f
end
Dir["package/*.gem"].each do |g|
rm g
end
sh "gem build yast-rake.gemspec"
mv "yast-rake-#{version}.gem", "package"
end
# remove install implementation and install via gem
Rake::Task[:install].clear
desc "Install yast-rake gem package"
task install: :tarball do
sh "sudo gem install --local package/yast-rake*.gem"
end
# this gem uses VERSION file, replace the standard yast implementation
Rake::Task[:"version:bump"].clear
namespace :version do
desc "Increase the last part of version in the VERSION and package/*.spec file"
task :bump do
# update VERSION
version_parts = File.read("VERSION").strip.split(".")
version_parts[-1] = (version_parts.last.to_i + 1).to_s
new_version = version_parts.join(".")
puts "Updating to #{new_version}"
File.write("VERSION", new_version + "\n")
# update *.spec file
spec_file = "package/rubygem-yast-rake.spec"
spec = File.read(spec_file)
spec.gsub!(/^\s*Version:.*$/, "Version: #{new_version}")
File.write(spec_file, spec)
end
end
Yast::Tasks.configuration do |conf|
conf.package_name = "rubygem-yast-rake"
conf.skip_license_check << /data\/index.html/
end
# vim: ft=ruby