Sha256: bbea08e66eb3f1258b8bed5ff8bfafb7d83a679baa6d47ecb66ede36c7380b85
Contents?: true
Size: 1.92 KB
Versions: 2
Compression:
Stored size: 1.92 KB
Contents
unless ENV.to_hash.has_key? 'CI' 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 require 'fedux_org/stdlib/logging/logger' namespace :version do @logger = FeduxOrg::Stdlib::Logging::Logger.new def bump_version( type ) version_update do |file| file.bump( type ) end end def version_update( &block ) file = FeduxOrg::Stdlib::VersionManagement::RubygemVersionFile.read( version_file ) old_version = file.version block.call( file ) new_version = file.version file.write( version_file ) @logger.info( "Updated version. It was \"#{old_version}\". It is now \"#{new_version}\"." ) end desc "Bump x.1.1" task :bump_major do bump_version( :major ) end desc "Bump 1.x.1" task :bump_minor do bump_version( :minor ) end desc "Bump 1.1.x" task :bump_tiny do bump_version( :tiny ) end 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 begin version_update do |file| file.version = new_version file.write( version_file ) @logger.info( 'Adding new version file to repository.' ) sh "git add #{version_file}" sh "git commit -m 'version bump to #{new_version}'" end rescue @logger.fatal( 'Nothing has changed since your last commit or has been added to the index. Therefor nothing needs to be commited.' ) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fedux_org-stdlib-0.3.0 | lib/fedux_org/stdlib/rake/version/bump.rb |
fedux_org-stdlib-0.2.1 | lib/fedux_org/stdlib/rake/version/bump.rb |