Sha256: a59b241657bfbeba02370123970a033e1ee5a345e0b02e976e46ce1d490016a2

Contents?: true

Size: 890 Bytes

Versions: 2

Compression:

Stored size: 890 Bytes

Contents

require 'rake'
require 'rake/testtask'
require 'spec/rake/spectask'

module Taglob
  module Rake
    class TagsTask
      attr_accessor :pattern
      attr_accessor :tags

      def initialize(name)
        @name = name
        yield self if block_given?
        define
      end

      def test_files
        Dir.taglob(pattern,tags) unless tags.nil? || pattern.nil?
      end
    end
    
    class TestTagsTask < TagsTask
      def initialize(name = :test_tags)
        super(name)
      end
      
      def define
        ::Rake::TestTask.new @name do |t|
          t.test_files = test_files
        end
      end      
    end
    
    class SpecTagsTask < TagsTask
      def initialize(name = :spec_tags)
        super(name)
      end
      
      def define
        ::Spec::Rake::SpecTask.new @name do |t|
          t.spec_files = test_files
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
scudco-taglob-1.0.0 lib/taglob/rake/test_tags_task.rb
taglob-1.0.0 lib/taglob/rake/test_tags_task.rb