Top Level Namespace

Includes:
FileTest, FileUtils

Defined Under Namespace

Modules: FubuRake, Nuget, Platform Classes: FubuDocs, MSBuildRunner

Constant Summary collapse

BUILD_VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#add_dependency(from, to) ⇒ Object



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
# File 'lib/fuburake.rb', line 486

def add_dependency(from, to)
	if to.kind_of?(Array)
		to.each do |dep|
			add_dependency from, dep
		end
	end

	if !Rake::Task.task_defined?(from)
		return
	end

	if !Rake::Task.task_defined?(to)
		return
	end 

	Rake::Task[from].enhance [to]
end

#cleanDirectory(dir) ⇒ Object



470
471
472
473
474
475
476
477
478
479
480
# File 'lib/fuburake.rb', line 470

def cleanDirectory(dir)
	if exists?(dir)
		puts 'Cleaning directory ' + dir
		FileUtils.rm_rf dir;
		waitfor { !exists?(dir) }
	end
	
	if dir == 'artifacts'
		Dir.mkdir 'artifacts'
	end
end

#cleanFile(file) ⇒ Object



482
483
484
# File 'lib/fuburake.rb', line 482

def cleanFile(file)
	File.delete file unless !File.exist?(file)
end

#copyOutputFiles(fromDir, filePattern, outDir) ⇒ Object



455
456
457
458
459
# File 'lib/fuburake.rb', line 455

def copyOutputFiles(fromDir, filePattern, outDir)
	Dir.glob(File.join(fromDir, filePattern)){|file|		
		copy(file, outDir) if File.file?(file)
	} 
end

#waitfor(&block) ⇒ Object



461
462
463
464
465
466
467
468
# File 'lib/fuburake.rb', line 461

def waitfor(&block)
	checks = 0
	until block.call || checks >10 
		sleep 0.5
		checks += 1
	end
	raise 'waitfor timeout expired' if checks > 10
end