Class: RakeDotNet::HarvestWebApplicationTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- RakeDotNet::HarvestWebApplicationTask
- Defined in:
- lib/rake_dotnet.rb
Instance Method Summary collapse
- #define ⇒ Object
- #harvest(path, regex) ⇒ Object
-
#initialize(params = {}) {|_self| ... } ⇒ HarvestWebApplicationTask
constructor
A new instance of HarvestWebApplicationTask.
Constructor Details
#initialize(params = {}) {|_self| ... } ⇒ HarvestWebApplicationTask
Returns a new instance of HarvestWebApplicationTask.
577 578 579 580 581 582 583 584 585 |
# File 'lib/rake_dotnet.rb', line 577 def initialize(params={}) @src_path = params[:src_path] || File.join(PRODUCT_ROOT, 'src') @target_path = params[:target_path] || OUT_DIR @deps = params[:deps] || [] @glob = params[:glob] || "**/*.Site" yield self if block_given? define end |
Instance Method Details
#define ⇒ Object
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/rake_dotnet.rb', line 587 def define out_dir_regex = RakeDotNet::regexify(@target_path) odr = /#{out_dir_regex}\/([\w\.-_ ]*Site)\// rule(odr) do |r| harvest(r.name, odr) end desc "Harvest specified web-applications (or all matching #{@src_path}/#{@glob}) to #{@target_path}" task :harvest_webapps, [:web_app_list] => @target_path do |t, args| list = FileList.new("#{@src_path}/#{@glob}") args.with_defaults(:web_app_list => list) args.web_app_list.each do |w| pn = Pathname.new(w) out = File.join(@target_path, pn.basename) + '/' Rake::FileTask[out].invoke end end @deps.each do |d| task :harvest_webapps => d end self end |
#harvest(path, regex) ⇒ Object
613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
# File 'lib/rake_dotnet.rb', line 613 def harvest(path, regex) web_app_name = path.match(regex)[1] src = File.join(@src_path, web_app_name) if (File.exist?("#{src}/.svn")) svn = SvnExport.new({:src=>src, :dest=>path}) svn.run cp_r(File.join(src, 'bin'), path) else cp_r src, path end FileList.new("#{path}**/obj").each do |e| rm_rf e if File.exist? e end end |