forked from AlexWayfer/flame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
42 lines (30 loc) · 955 Bytes
/
Rakefile
File metadata and controls
42 lines (30 loc) · 955 Bytes
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
# frozen_string_literal: true
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task default: :spec
rescue LoadError
puts 'No RSpec available'
end
task :release, %i[version] do |_t, args|
version = args[:version]
raise ArgumentError, 'No version provided' unless version
## Write new version to version file
version_file = File.join(__dir__, 'lib/flame/version.rb')
File.write version_file, File.read(version_file).sub(/'.+'/, "'#{version}'")
## Commit version update
sh "git add #{version_file}"
sh "git commit -m 'Update version to #{version}'"
## Tag commit
sh "git tag -a v#{version} -m 'Version #{version}'"
## Push commit
sh 'git push'
## Push tags
sh 'git push --tags'
## Build new gem file
gemspec_file = Dir[File.join(__dir__, '*.gemspec')].first
sh "gem build #{gemspec_file}"
## Push new gem file
gem_file = Dir[File.join(__dir__, "*-#{version}.gem")].first
sh "gem push #{gem_file}"
end