-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
66 lines (60 loc) · 1.72 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
# frozen_string_literal: true
require_relative "lib/attribool"
require "bundler/gem_tasks"
require "rdoc/task"
require "rake/testtask"
Rake::TestTask.new do |t|
t.libs = ["lib"]
t.warning = true
t.verbose = true
t.test_files = FileList["test/**/*_test.rb"]
end
RDoc::Task.new do |rdoc|
rdoc.main = "README.md"
rdoc.rdoc_dir = "docs"
rdoc.rdoc_files.include("README.md", "lib/**/*.rb")
end
task default: :test
namespace :version do
desc "Print the current version from the version.rb file"
task :current do
puts Attribool::VERSION
end
namespace :increment do
desc "Increment the version's PATCH level"
task :patch do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file).sub(/(PATCH\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
desc "Increment the version's MINOR level"
task :minor do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file)
.sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MINOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
desc "Increment the version's MAJOR level"
task :major do
File.join(__dir__, "lib", "attribool", "version.rb").then do |version_file|
File.write(
version_file,
File.read(version_file)
.sub(/(PATCH\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MINOR\s=\s)(\d+)/) { "#{$1}0" }
.sub(/(MAJOR\s=\s)(\d+)/) { "#{$1}#{$2.next}" }
)
end
system("bundle lock")
end
end
end