Rake::DevEiate::

Releases

module

Release tasks

Public Instance Methods

anchor
define_tasks()

Define release tasks.

# File lib/rake/deveiate/releases.rb, line 12
def define_tasks
        super if defined?( super )

        checksum_dir = Rake::DevEiate::CHECKSUM_DIR
        checksum_path = checksum_dir + "#{self.gem_filename}.sha512"

        directory( checksum_dir )

        file( checksum_path => [self.gem_path, checksum_dir], &method(:do_make_release_checksum) )
        task :add_release_checksum => checksum_path

        task( :release_gem => :add_release_checksum, &method(:do_release_gem) )

        task :debug => :release_debug
        task( :release_debug, &method(:do_release_debug) )
end
anchor
do_make_release_checksum( task, args )

Create a checksum for a release gemfile

# File lib/rake/deveiate/releases.rb, line 31
def do_make_release_checksum( task, args )
        if self.prompt.yes?( "Make a checksum for this release?" )
                checksum = Digest::SHA512.new.hexdigest( self.gem_path.read )
                File.open( task.name, 'w', encoding: 'us-ascii' ) {|f| f.write(checksum) }
        end
end
anchor
do_release_debug( task, args )

Body of the release_debug task.

# File lib/rake/deveiate/releases.rb, line 50
def do_release_debug( task, args )
        gemserver = self.allowed_push_host || Rake::DevEiate::DEFAULT_GEMSERVER

        self.prompt.say( "Releases will be pushed to:", color: :bright_green )
        self.prompt.say( self.indent(gemserver, 4) )
        self.prompt.say( "\n" )
end
anchor
do_release_gem( task, args )

Body of the release_gem task.

# File lib/rake/deveiate/releases.rb, line 40
def do_release_gem( task, args )
        gemserver = self.allowed_push_host || Rake::DevEiate::DEFAULT_GEMSERVER

        if self.prompt.yes?( "Push a new gem to #{gemserver}?" ) {|q| q.default(false) }
                sh( Gem.ruby, "-S", "gem", "push", self.gem_path.to_s )
        end
end