Sha256: 545ffc90722fd615122d67b255063856bd28dc8ef9d3b03ffff588f978735de9

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

require 'rubygems/tasks/build/task'

require 'rubygems/builder'
require 'fileutils'

module Gem
  class Tasks
    module Build
      #
      # The `build:gem` task.
      #
      class Gem < Task

        #
        # Initializes the `build:gem` task.
        #
        # @param [Hash] options
        #   Additional options.
        #
        def initialize(options={})
          super()

          yield self if block_given?
          define
        end

        #
        # Defines the `build:gem` task.
        #
        def define
          build_task :gem

          # backwards compatibility for Gem::PackageTask
          task :gem => 'build:gem'

          # backwards compatibility for Hoe
          task :package => 'build:gem'
        end

        #
        # Builds the `.gem` package.
        #
        # @param [String] path
        #   The path for the `.gem` package.
        #
        # @param [Gem::Specification] gemspec
        #   The gemspec to build the `.gem` package from.
        #
        def build(path,gemspec)
          builder = ::Gem::Builder.new(gemspec)

          FileUtils.mv builder.build, Project::PKG_DIR
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubygems-tasks-0.2.0 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.2 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.1 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.0 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.0.pre3 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.0.pre2 lib/rubygems/tasks/build/gem.rb
rubygems-tasks-0.1.0.pre1 lib/rubygems/tasks/build/gem.rb