Sha256: c882c20b25da016570e14a6230c165d82413968af0fd975062aa6470801df6e4

Contents?: true

Size: 1.55 KB

Versions: 26

Compression:

Stored size: 1.55 KB

Contents

require 'rubyforge'

class Jeweler
  module Commands
    class ReleaseToRubyforge
      attr_accessor :gemspec, :version, :output, :gemspec_helper, :rubyforge

      def initialize
        self.output = $stdout
      end

      def run
        raise NoRubyForgeProjectInGemspecError unless @gemspec.rubyforge_project
        
        @rubyforge.configure rescue nil

        output.puts 'Logging in rubyforge'
        @rubyforge.login

        @rubyforge.userconfig['release_notes'] = @gemspec.description if @gemspec.description
        @rubyforge.userconfig['preformatted'] = true

        output.puts "Releasing #{@gemspec.name}-#{@version} to #{@gemspec.rubyforge_project}"
        begin
          @rubyforge.add_release(@gemspec.rubyforge_project, @gemspec.name, @version.to_s, @gemspec_helper.gem_path)
        rescue StandardError => e
          case e.message
          when /no <group_id> configured for <#{Regexp.escape @gemspec.rubyforge_project}>/
            raise RubyForgeProjectNotConfiguredError, @gemspec.rubyforge_project
          when /no <package_id> configured for <#{Regexp.escape @gemspec.name}>/i
            raise MissingRubyForgePackageError, @gemspec.name
          else
            raise
          end
        end
      end

      def self.build_for(jeweler)
        command = new
        command.gemspec = jeweler.gemspec
        command.gemspec_helper = jeweler.gemspec_helper
        command.version = jeweler.version
        command.rubyforge = jeweler.rubyforge
        command.output = jeweler.output

        command
      end
      
    end
  end
end

Version data entries

26 entries across 26 versions & 8 rubygems

Version Path
dima-jeweler-1.2.0 lib/jeweler/commands/release_to_rubyforge.rb
gohanlonllc-jeweler-0.11.1.20090513153819 lib/jeweler/commands/release_to_rubyforge.rb
gohanlonllc-jeweler-1.0.0.20080513000000 lib/jeweler/commands/release_to_rubyforge.rb
gohanlonllc-jeweler-1.0.0.20090513153819 lib/jeweler/commands/release_to_rubyforge.rb
mcornick-jeweler-1.2.0 lib/jeweler/commands/release_to_rubyforge.rb
monkeyhelper-jeweler-1.0.1 lib/jeweler/commands/release_to_rubyforge.rb
namelessjon-jeweler-1.0.1 lib/jeweler/commands/release_to_rubyforge.rb
pivotal-jeweler-1.0.1.1 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-0.10.0 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-0.10.1 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-0.10.2 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-0.11.0 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-1.0.0 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-1.0.1 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-1.0.2 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-1.1.0 lib/jeweler/commands/release_to_rubyforge.rb
technicalpickles-jeweler-1.2.1 lib/jeweler/commands/release_to_rubyforge.rb
jeweler-1.2.1 lib/jeweler/commands/release_to_rubyforge.rb
jeweler-1.2.0 lib/jeweler/commands/release_to_rubyforge.rb
jeweler-1.1.0 lib/jeweler/commands/release_to_rubyforge.rb