Sha256: a346b45f561d273526bedd45ddcbc6227bb7e8cb9ea0b2b58889bac8485f6eba

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

require 'reap/manager/rubyforge'

module Reap

  class Manager

    # Update VERSION stamp file.
    #
    # TODO: Should we also update a lib/version.rb file?

    def stamp(options={})
      options = configure_options(options, 'stamp')

      meta = File.directory?('meta')

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

      abort "Invalid version -- #{version}" unless /^[0-9]/ =~ version

      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 file + ":"
        puts text
      else
        File.open(file, 'w'){|f| f << text}
        puts "#{file} updated."
      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

    # Clean, stamp if need be and package.

    def prepare(options={})
      clean
      make_distclean if compiles?
      stamp(options)
      package(options)
    end

    # Prepare and release to rubyforge.

    def release(options={})
      prepare(options)
      rubyforge_release(options)
      #announce(options)
      puts "\nBe sure to tag and announce this release if need be."
    end

    #def release(options)
      #name, version = release.name, release.version
      #sh "icli rubyforge release --version=#{version}"
    #end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reap-9.2.0 lib/reap/manager/release.rb