Sha256: 6a850ba01de7d9d24cc9b80f1be02a7cc2156780eeb84934965b0ccf000a0420

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'rake/tasklib'

Dir["#{File.dirname(__FILE__)}/msbuild_support/*.rb"].each do |path|
  require path
end

module Rake::Funnel::Tasks
  class MSBuild < Rake::TaskLib
    attr_accessor :name, :project_or_solution, :args, :search_pattern

    def initialize(name = :compile)
      @name = name
      @args = {}
      @search_pattern = %w(**/*.sln)

      yield self if block_given?
      define
    end

    def msbuild
      @_msbuild || MSBuildSupport::BuildTool.find
    end

    def msbuild=(value)
      @_msbuild = value
    end

    def project_or_solution
      Rake::Funnel::Support::Finder.new(@_project_or_solution || search_pattern, self, 'No projects or more than one project found.')
    end

    def project_or_solution=(value)
      @_project_or_solution = value
    end

    private
    def define
      desc "Compile #{project_or_solution.single_or_default}"
      task @name do
        cmd = [
          msbuild,
          project_or_solution.single,
          *Rake::Funnel::Support::Mapper.new(:MSBuild).map(args)
        ]

        sh(*cmd)
      end

      self
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rake-funnel-0.0.6.pre lib/rake/funnel/tasks/msbuild.rb
rake-funnel-0.0.5.pre lib/rake/funnel/tasks/msbuild.rb
rake-funnel-0.0.4.pre lib/rake/funnel/tasks/msbuild.rb
rake-funnel-0.0.3.pre lib/rake/funnel/tasks/msbuild.rb
rake-funnel-0.0.2.pre lib/rake/funnel/tasks/msbuild.rb
rake-funnel-0.0.1.pre lib/rake/funnel/tasks/msbuild.rb