Sha256: ce4b07d92ed3b78b50e9e41f3526a39078709c6fa74b10dad686b139973f7d36

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

require 'mattock/tasklib'

module Corundum
  class GemspecFiles < Mattock::TaskLib
    default_namespace :gemspec_files

    setting(:gemspec)

    def default_configuration(toolkit)
      super
      self.gemspec = toolkit.gemspec
    end

    def define
      in_namespace do
        task :has_files do
          if gemspec.files.nil? or gemspec.files.empty?
            fail "No files mentioned in gemspec - do you intend an empty gem?"
          end
        end

        task :files_exist do
          missing = gemspec.files.find_all do |path|
            not File::exists?(path)
          end

          fail "Files mentioned in gemspec are missing: #{missing.join(", ")}" unless missing.empty?
        end
      end

      task :preflight => in_namespace(:files_exist, :has_files)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
corundum-0.3.1 lib/corundum/gemspec_files.rb
corundum-0.3 lib/corundum/gemspec_files.rb
corundum-0.2 lib/corundum/gemspec_files.rb