Sha256: 8bcf62b7bc7dc28b4a262b5b76335a5af82a42ed922c323bcf2ef272def91824

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

require 'reap/manager/rubyforge'

module Reap

  class Manager

    # 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={})
      options ||= {}

      default = configuration['stamp']

      version = options['version'] || metadata.version || default['version'] || '0.0.0'
      status  = options['status']  || metadata.status  || default['status']  || 'alpha'

      abort "Invalid version -- #{version}" unless /^[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
        return if text == old_text
      end

      if dryrun?
        puts "[DRYRUN] echo #{text} > #{file}"
      else
        File.open(file, 'w'){|f| f << 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

1 entries across 1 versions & 1 rubygems

Version Path
reap-9.2.1 lib/reap/manager/stamp.rb