-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
31 lines (26 loc) · 1.16 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
require "bundler/gem_tasks"
task :karma_test_prepare do
desc 'prepare karma'
sh 'mkdir -p gems/assets/javascripts'
Dir.chdir 'gems/assets/javascripts'
sh 'ln -fs $(bundle show angularjs-rails)/vendor/assets/javascripts angular'
end
task :push_gem do
sh 'gem build required.gemspec && gem inabox *.gem && rm *.gem'
end
# extracted from https://github.com/grosser/project_template
rule /^version:bump:.*/ do |t|
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
index = ['major', 'minor','patch'].index(t.name.split(':').last)
file = 'lib/required/version.rb'
version_file = File.read(file)
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
version_parts[index] = version_parts[index].to_i + 1
version_parts[2] = 0 if index < 2
version_parts[1] = 0 if index < 1
new_version = version_parts * '.'
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
# original version -- we aren't committing Gemfile.lock
# sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
sh "git add #{file} && git commit -m 'bump version to #{new_version}'"
end