Sha256: 7ab1a5008068f290affb56948407274ee8fc212d06e72740022196e4b4cf437b
Contents?: true
Size: 1.86 KB
Versions: 2
Compression:
Stored size: 1.86 KB
Contents
module Reap class Project # Update VERSION stamp file. # # TODO: Should we also update a lib/version.rb file? # TODO: Make sure the new version isn't less then the old verison. # Will have to use VersionNumnber class for this. def stamp(options={}) version = options['version'] status = options['status'] options = configure_options(options, 'stamp') version = version || metadata.version || '0.0.0' status = status || metadata.status || '0.0.0' abort "Invalid version -- #{version}" unless String===version && /^[0-9]/ =~ version meta = File.directory?('meta') file = glob('{,meta/}version{,.txt}', File::FNM_CASEFOLD).first file = (meta ? 'meta/VERSION' : 'VERSION') unless file text = "#{version} #{status} (#{Time.now.strftime('%Y-%m-%d')})" if File.exist?(file) old_text = File.read(file).strip old_version, old_status, old_date = *old_text.split(/\s/) if old_version == "#{version}" && old_status == status puts old_text return end end if dryrun? puts "echo '#{text}' > #{file}" else write(file, text) puts text puts "#{file} updated." metadata.version = version metadata.status = status metadata.released = Time.now end # TODO: Stamp .roll if roll file exists. # should we read current .roll file and use as defaults? if File.exist?('.roll') str = [] str << "name = #{metadata.name}" str << "version = #{metadata.version}" str << "status = #{metadata.status}" str << "date = #{metadata.date}" str << "default = #{metadata.default}" str << "libpath = #{metadata.libpath}" # File.open('.roll','w'){ |f| f << str.join("\n") } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reap-9.3.1 | lib/reap/project/stamp.rb |
reap-9.3.0 | lib/reap/project/stamp.rb |