Sha256: 61ebfa430820245b5b9eea7fc24a2fa3f10e9ddbc21544840d9e1313295d3946

Contents?: true

Size: 990 Bytes

Versions: 4

Compression:

Stored size: 990 Bytes

Contents

require 'rake/tasklib'

module Rake::Funnel::Tasks
  class SideBySideSpecs < Rake::TaskLib
    include Rake::Funnel::Support

    attr_accessor :name, :projects, :references, :specs, :enabled

    def initialize(*args, &task_block)
      setup_ivars(args)

      define(args, &task_block)
    end

    private
    def setup_ivars(args)
      @name = args.shift || :compile

      @projects = %w(**/*.csproj **/*.vbproj **/*.fsproj)
      @references = []
      @specs = %w(*Specs.cs **/*Specs.cs *Tests.cs **/*Tests.cs)
      @enabled = false
    end

    def define(args, &task_block)
      desc 'Remove tests from projects' unless Rake.application.last_description
      task(name, *args) do |_, task_args|
        task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block

        next unless enabled
        SpecsRemover.remove({ projects: projects, references: references, specs: specs })
      end

      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre lib/rake/funnel/tasks/side_by_side_specs.rb
rake-funnel-0.3.1.pre lib/rake/funnel/tasks/side_by_side_specs.rb
rake-funnel-0.3.0.pre lib/rake/funnel/tasks/side_by_side_specs.rb
rake-funnel-0.2.0.pre lib/rake/funnel/tasks/side_by_side_specs.rb