rake-dotnet 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/History.txt +8 -0
  2. data/Rakefile.rb +1 -1
  3. data/lib/rake_dotnet.rb +56 -30
  4. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,11 @@
1
+ === 0.1.5 / 2009-
2
+
3
+ * NEW: RDNPackageTask - generate a named task per package so they can be built individually
4
+ * NEW: SevenZip - wrapper for extracting an archive
5
+ * CHANGE: SevenZip - wrapper is more useful ;-)
6
+ * CHANGE: Harvesters - harvest dumps output into a config-version named directory now
7
+ (adjusted demo-project to match)
8
+
1
9
  === 0.1.4 / 2009-06-23
2
10
 
3
11
  * FIX: FxCop - support for running against .exe files instead of just DLLs. Exclude *.vshost.exe by default
data/Rakefile.rb CHANGED
@@ -5,7 +5,7 @@ require 'hoe'
5
5
  require 'Pathname'
6
6
  require 'rake/clean'
7
7
 
8
- Hoe.new('rake-dotnet', '0.1.4') do |p|
8
+ Hoe.new('rake-dotnet', '0.1.5') do |p|
9
9
  p.author = 'Peter Mounce'
10
10
  p.description = 'Making a .NET build-automation dev\'s life easier, one angle-bracket at a time'
11
11
  p.email = 'pete@neverrunwithscissors.com'
data/lib/rake_dotnet.rb CHANGED
@@ -316,9 +316,10 @@ module Rake
316
316
  class HarvestOutputTask < TaskLib
317
317
  def initialize(params={})
318
318
  @src_path = params[:src_path] || File.join(PRODUCT_ROOT, 'src')
319
- @target_path = params[:target_path] || File.join(OUT_DIR, 'bin')
320
319
  @deps = params[:deps] || []
321
320
  @configuration = params[:configuration] || CONFIGURATION
321
+ @version = params[:version] || RDNVERSION
322
+ @target_path = params[:target_path] || File.join(OUT_DIR, "bin-#{@configuration}-v#{@version}")
322
323
  @glob = params[:glob] || "#{@src_path}/*"
323
324
 
324
325
  yield self if block_given?
@@ -368,7 +369,9 @@ module Rake
368
369
  @src_path = params[:src_path] || File.join(PRODUCT_ROOT, 'src')
369
370
  @target_path = params[:target_path] || OUT_DIR
370
371
  @deps = params[:deps] || []
371
- @glob = params[:glob] || '*Site*'
372
+ @configuration = params[:configuration] || CONFIGURATION
373
+ @version = params[:version] || RDNVERSION
374
+ @glob = params[:glob] || "**/*.Site"
372
375
 
373
376
  yield self if block_given?
374
377
  define
@@ -377,25 +380,19 @@ module Rake
377
380
  def define
378
381
  out_dir_regex = regexify(@target_path)
379
382
 
380
- rule(/#{out_dir_regex}\/[\w\.-_ ]*Site[\w\.-_ ]*\//) do |r|
381
- web_app_name = r.name.match(/#{out_dir_regex}\/([\w\.-_ ]*Site[\w\.-_ ]*)\//)[1]
382
- src = File.join(@src_path, web_app_name)
383
- if (File.exist?("#{src}/.svn"))
384
- svn = SvnExport.new(src, r.name)
385
- svn.export
386
- cp_r(File.join(src, 'bin'), r.name)
387
- else
388
- cp_r src, r.name
389
- end
383
+ # config/version included
384
+ versioned_regex = /#{out_dir_regex}\/([\w\.-_ ]*Site)-\w+-v\d+\.\d+\.\d+\.\d+\//
385
+ rule(versioned_regex) do |r|
386
+ harvest(r.name, versioned_regex)
390
387
  end
391
-
388
+
392
389
  desc "Harvest specified web-applications (or all matching #{@src_path}/#{@glob}) to #{@target_path}"
393
390
  task :harvest_webapps,[:web_app_list] => @target_path do |t, args|
394
391
  list = FileList.new("#{@src_path}/#{@glob}")
395
392
  args.with_defaults(:web_app_list => list)
396
393
  args.web_app_list.each do |w|
397
394
  pn = Pathname.new(w)
398
- out = File.join(@target_path, pn.basename) + '/'
395
+ out = File.join(@target_path, "#{pn.basename}-#{@configuration}-v#{@version}") + '/'
399
396
  Rake::FileTask[out].invoke
400
397
  end
401
398
  end
@@ -406,6 +403,21 @@ module Rake
406
403
 
407
404
  self
408
405
  end
406
+
407
+ def harvest(path, regex)
408
+ web_app_name = path.match(regex)[1]
409
+ src = File.join(@src_path, web_app_name)
410
+ if (File.exist?("#{src}/.svn"))
411
+ svn = SvnExport.new(src, path)
412
+ svn.export
413
+ cp_r(File.join(src, 'bin'), path)
414
+ else
415
+ cp_r src, path
416
+ end
417
+ FileList.new("#{path}**/obj").each do |e|
418
+ rm_rf e if File.exist? e
419
+ end
420
+ end
409
421
  end
410
422
  end
411
423
 
@@ -755,8 +767,8 @@ module Rake
755
767
  end
756
768
  end
757
769
  snipped = pkg_root.sub(pkg + '/', '')
758
- chdir pkg do
759
- sz = SevenZip.new('../../'+package_file, snipped, {:sevenzip=>File.join('..','..',TOOLS_DIR, '7zip', 'x86', '7za.exe')})
770
+ sz = SevenZip.new(package_file)
771
+ chdir pkg_root do
760
772
  sz.run_add
761
773
  end
762
774
  end
@@ -766,6 +778,9 @@ module Rake
766
778
  desc "Generate zip'd packages for all package-tasks"
767
779
  task :package => [@out_dir, pkg, pkg_root, package_file]
768
780
 
781
+ desc "Generate zip'd package for #{@name}"
782
+ task "package_#{@name}".to_sym => [@out_dir, pkg, pkg_root, package_file]
783
+
769
784
  desc "Delete all packages"
770
785
  task :clobber_package do
771
786
  rm_rf pkg
@@ -787,18 +802,18 @@ end
787
802
 
788
803
 
789
804
  class SevenZip
790
- def initialize(archive_name, file_names, opts={})
805
+ def initialize(archive_name, opts={})
791
806
  arch = ENV['PROCESSOR_ARCHITECTURE'] || 'AMD64'
792
807
  bin = arch == 'x86' ? '7za.exe' : '7z.exe'
793
- @exe = opts[:sevenzip] || File.join(TOOLS_DIR, '7zip', arch, bin)
794
- @archive_name = archive_name
795
- @file_names = file_names
808
+ @exe = opts[:sevenzip] || File.expand_path(File.join(TOOLS_DIR, '7zip', arch, bin))
809
+ @archive_name = File.expand_path(archive_name)
810
+ @params = opts
796
811
 
797
812
  yield self if block_given?
798
813
  end
799
814
 
800
815
  def cmd_add
801
- "#{exe} a #{switches} #{archive_name} #{file_names}"
816
+ "#{exe} a #{archive_name} #{file_names}"
802
817
  end
803
818
 
804
819
  def run_add
@@ -806,17 +821,32 @@ class SevenZip
806
821
  sh cmd_add
807
822
  end
808
823
 
824
+ def cmd_extract
825
+ "#{exe} x -y #{out_dir} #{archive_name} #{file_names}"
826
+ end
827
+
828
+ def run_extract
829
+ puts cmd_extract if VERBOSE
830
+ sh cmd_extract
831
+ end
832
+
833
+ def out_dir
834
+ od = @params[:out_dir]
835
+ "-o#{File.expand_path(od)}" unless @params[:out_dir].nil?
836
+ end
837
+
809
838
  def archive_name
810
839
  "\"#{@archive_name}\""
811
840
  end
812
841
 
813
842
  def file_names
814
- if @file_names.is_a? String
815
- "\"#{@file_names}\""
816
- elsif @file_names.is_a? Array
843
+ fns = @params[:file_names]
844
+ if fns.is_a? String
845
+ "\"#{fns}\""
846
+ elsif fns.is_a? Array
817
847
  list = ''
818
- @file_names.each do |fn|
819
- list += "\"#{fn}\" "
848
+ fns.each do |fn|
849
+ list += "\"#{File.expand_path(fn)}\" "
820
850
  end
821
851
  list.chop
822
852
  end
@@ -825,10 +855,6 @@ class SevenZip
825
855
  def exe
826
856
  "\"#{@exe}\""
827
857
  end
828
-
829
- def switches
830
-
831
- end
832
858
  end
833
859
 
834
860
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-dotnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter MouncePeter Mounce
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-23 00:00:00 +01:00
12
+ date: 2009-06-30 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency