Sha256: 024c8aa457f28900c471506ebc4cce5de3ff8a0e167a48a33190b32fedd4c2d8

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'rubygems/tasks/task'

require 'rubygems/builder'

module Gem
  class Tasks
    module Build
      class Task < Tasks::Task

        #
        # @param [String] path
        #
        # @param [Gem::Specification] gemspec
        #
        # @abstract
        #
        def build(path,gemspec)
        end

        protected

        #
        # Defines build task(s) for file type.
        #
        # @param [Symbol] name
        #   The name for the task(s).
        #
        # @param [String, Symbol] extname
        #   The file extension for the resulting files.
        #
        # @api semipublic
        #
        def build_task(name,extname=name)
          directory Project::PKG_DIR

          @project.builds.each do |build,packages|
            namespace :build do
              namespace name do
                gemspec = @project.gemspecs[build]
                path    = packages[extname]

                # define file tasks, so the packages are not needless re-built
                file(path => [Project::PKG_DIR, *gemspec.files]) do
                  status "Building #{File.basename(path)} ..."

                  build(path,gemspec)
                end

                task build => path
              end
            end

            task "build:#{build}" => "build:#{name}:#{build}"
          end

          gemspec_tasks "build:#{name}"

          desc "Builds all packages" unless task?(:build)
          task :build => "build:#{name}"
        end

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubygems-tasks-0.2.0 lib/rubygems/tasks/build/task.rb