-
Notifications
You must be signed in to change notification settings - Fork 73
/
Rakefile
52 lines (43 loc) · 1.28 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
$:.unshift File.expand_path("../lib", __FILE__)
require "pliny/version"
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
desc "Cut a new version specified in VERSION and push"
task :release do
unless ENV["VERSION"]
abort("ERROR: Missing VERSION. Currently at #{Pliny::VERSION}")
end
current_version = Gem::Version.new(Pliny::VERSION)
new_version = Gem::Version.new(ENV["VERSION"])
if current_version >= new_version
abort("ERROR: Invalid version, already at #{Pliny::VERSION}")
end
# update lib/pliny/version.rb
sh "ruby",
"-i",
"-pe",
"$_.gsub!(/VERSION = .*/, %{VERSION = \"#{new_version}\"})",
"lib/pliny/version.rb"
# update version in the template app Gemfile
sh "ruby",
"-i",
"-pe",
"$_.gsub!(/gem \"pliny\", .*/, %{gem \"pliny\", \"#{new_version.approximate_recommendation}\"})",
"lib/template/Gemfile"
# tag/commit
sh "bundle install"
sh "git commit -a -m 'v#{new_version}'"
sh "git tag v#{new_version}"
# build new gem and push
sh "gem build pliny.gemspec"
sh "gem push pliny-#{new_version}.gem"
sh "git push origin main --tags"
sh "rm pliny-#{new_version}.gem"
end
desc 'Open a irb/pry session preloaded with pliny'
task :console do
require 'pry'
require 'pliny'
Pry.start
end