Rakefile in connfu-client-0.1.5 vs Rakefile in connfu-client-0.1.6

- old
+ new

@@ -34,5 +34,20 @@ rdoc.options << '-m' << 'README.rdoc' #rdoc.rdoc_files.include('README*') end +# extracted from https://github.com/grosser/project_template +desc "Bump version" +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/connfu/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 + new_version = version_parts * '.' + File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) } + + sh "bundle && git add -f #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'" +end