-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
31 lines (26 loc) · 964 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
require "bundler/gem_tasks"
require "rake/testtask"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_files = FileList["test/**/*_test.rb"]
end
task :default => :test
AVAILABLE_REVISIONS = ["major", "minor", "patch"]
desc "Bump version"
task :bump, [:revision] do |t, args|
args.with_defaults(revision: "patch")
abort "Please provide valid revision: #{AVAILABLE_REVISIONS.join(',')}" unless AVAILABLE_REVISIONS.include?(args.revision)
system "bumpversion #{args.revision}"
end
def get_package_name
name = Dir['*.gemspec'].first.split('.').first
line = File.read("lib/#{name}/version.rb")[/^\s*VERSION\s*=\s*.*/]
version = line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
"#{name}-#{version}.gem"
end
desc "Push #{get_package_name} to GitHub registry"
task :push_to_github do
package_path = "pkg/#{get_package_name}"
system "gem push --key github --host https://rubygems.pkg.github.com/promptapi #{package_path}"
end