Sha256: c81bf3fb97e79062c670bc808a9d29212dc7a8c981eb90207ef01149a3737c3f
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require_relative 'base' begin require 'active_support/core_ext/string/strip' rescue LoadError $stderr.puts 'You need to install the "activesupport"-gem to make that rake task work.' exit 1 end begin require 'erubis' rescue LoadError $stderr.puts 'You need to install the "erubis"-gem to make that rake task work.' exit 1 end namespace :version do desc 'bump version of library to new version' task :bump do new_version = ENV['VERSION'] || ENV['version'] raise Exception, "You need to define a version via \"VERSION=<version>\" or \"version=<version>\"." unless new_version raw_module_names = File.open(version_file, "r").readlines.grep(/module/) module_names = raw_module_names.collect { |n| n.chomp.match(/module\s+(\S+)/) {$1} } template = <<-EOF #main <%= @modules.first %> <% @modules.each do |m| %> module <%= m %> <% end %> VERSION = '<%= @version %>' <% @modules.size.times do |m| %> end <% end %> EOF version_string = Erubis::Eruby.new(template).evaluate(modules: module_names, version: new_version) File.open(version_file, "w") do |f| f.write version_string.strip_heredoc end sh "git add #{version_file}" sh "git commit -m 'version bump to #{new_version}'" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.1.2 | lib/fedux_org/stdlib/rake/version/bump.rb |