Class: RakeDotNet::HarvestOutputTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/rake_dotnet.rb

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) {|_self| ... } ⇒ HarvestOutputTask

Returns a new instance of HarvestOutputTask.

Yields:

  • (_self)

Yield Parameters:



527
528
529
530
531
532
533
534
535
536
# File 'lib/rake_dotnet.rb', line 527

def initialize(params={})
	@src_path = params[:src_path] || File.join(PRODUCT_ROOT, 'src')
	@target_path = params[:target_path] || Bin_out
	@deps = params[:deps] || []
	@configuration = params[:configuration] || CONFIGURATION
	@glob = params[:glob] || "#{@src_path}/*"

	yield self if block_given?
	define
end

Instance Method Details

#defineObject



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/rake_dotnet.rb', line 538

def define
	directory @target_path

	desc "Harvest specified libraries (or all matching #{@glob}) to #{@target_path}"
	task :harvest_output, [:to_harvest_list] => @target_path do |t, args|
		list = FileList.new
		@glob.each do |g|
			list.include(g)
		end
		args.with_defaults(:to_harvest_list => list)
		args.to_harvest_list.each do |entry|
			pn = Pathname.new(entry)
			if pn.directory?
				output = FileList.new
				#TODO: distinguish between web and class and console output
				output.include("#{entry}/bin/#{@configuration}/*")
				output.include("#{entry}/bin/*")
				output.each do |o|
					o_pn = Pathname.new(o)
					to_pn = Pathname.new("#{@target_path}")
					if (o_pn.directory?)
						cp_r(o, to_pn) unless o_pn.to_s.match(/#{@configuration}$/)
					else
						cp(o, to_pn)
					end
				end
			end
		end
	end

	@deps.each do |d|
		task :harvest => d
	end

	self
end