Sha256: 4047b06ffb72c827b88cfec8124572bc941d54c1d705eb9a9c59470e010e1d0f
Contents?: true
Size: 1.71 KB
Versions: 21
Compression:
Stored size: 1.71 KB
Contents
require 'find' require 'rake/packagetask' require 'rubygems/user_interaction' require 'rubygems/builder' class Bones::GemPackageTask < Rake::PackageTask # Ruby GEM spec containing the metadata for this package. The # name, version and package_files are automatically determined # from the GEM spec and don't need to be explicitly provided. # attr_accessor :gem_spec # Create a GEM Package task library. Automatically define the gem # if a block is given. If no block is supplied, then +define+ # needs to be called to define the task. # def initialize(gem_spec) init(gem_spec) yield self if block_given? define if block_given? end # Initialization tasks without the "yield self" or define # operations. # def init(gem) super(gem.name, gem.version) @gem_spec = gem @package_files += gem_spec.files if gem_spec.files end # Create the Rake tasks and actions specified by this # GemPackageTask. (+define+ is automatically called if a block is # given to +new+). # def define super task :prereqs task :package => ['gem:prereqs', "#{package_dir_path}/#{gem_file}"] file "#{package_dir_path}/#{gem_file}" => [package_dir_path] + package_files do when_writing("Creating GEM") { chdir(package_dir_path) do Gem::Builder.new(gem_spec).build verbose(true) { mv gem_file, "../#{gem_file}" } end } end file package_dir_path do mkdir_p package_dir rescue nil end end # # def gem_file if @gem_spec.platform == Gem::Platform::RUBY "#{package_name}.gem" else "#{package_name}-#{@gem_spec.platform}.gem" end end end # class Bones::GemPackageTask # EOF
Version data entries
21 entries across 21 versions & 1 rubygems