rake-dotnet 0.1.15 → 0.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/History.txt +22 -0
  2. data/Manifest.txt +39 -1
  3. data/Rakefile.rb +44 -14
  4. data/coverage/index.html +576 -0
  5. data/coverage/lib-assemblyinfo_rb.html +716 -0
  6. data/coverage/lib-bcpcmd_rb.html +704 -0
  7. data/coverage/lib-cli_rb.html +646 -0
  8. data/coverage/lib-fxcop_rb.html +723 -0
  9. data/coverage/lib-harvester_rb.html +741 -0
  10. data/coverage/lib-iisappcmd_rb.html +657 -0
  11. data/coverage/lib-msbuild_rb.html +713 -0
  12. data/coverage/lib-ncover_rb.html +773 -0
  13. data/coverage/lib-package_rb.html +691 -0
  14. data/coverage/lib-sevenzip_rb.html +665 -0
  15. data/coverage/lib-sqlcmd_rb.html +680 -0
  16. data/coverage/lib-svn_rb.html +671 -0
  17. data/coverage/lib-version_rb.html +651 -0
  18. data/coverage/lib-xunit_rb.html +727 -0
  19. data/doc/examples.html +482 -0
  20. data/lib/rake_dotnet.rb +826 -616
  21. data/lib/rake_dotnet/default_rakefile.rb +16 -0
  22. data/spec/assemblyinfotask_spec.rb +8 -0
  23. data/spec/bcpcmd_spec.rb +81 -0
  24. data/spec/cli_spec.rb +48 -0
  25. data/spec/constants_spec.rb +6 -0
  26. data/spec/fxcopcmd_spec.rb +8 -0
  27. data/spec/fxcoptask_spec.rb +7 -0
  28. data/spec/harvester_spec.rb +6 -0
  29. data/spec/harvestoutputtask_spec.rb +6 -0
  30. data/spec/harvestwebapplicationtask_spec.rb +6 -0
  31. data/spec/iisappcmd_spec.rb +15 -0
  32. data/spec/msbuildcmd_spec.rb +7 -0
  33. data/spec/msbuildtask_spec.rb +7 -0
  34. data/spec/ncoverconsolecmd_spec.rb +12 -0
  35. data/spec/ncoverreportingcmd_spec.rb +14 -0
  36. data/spec/ncovertask_spec.rb +24 -0
  37. data/spec/rdnpackagetask_spec.rb +6 -0
  38. data/spec/sevenzipcmd_spec.rb +7 -0
  39. data/spec/sqlcmd_spec.rb +52 -0
  40. data/spec/svncmd_spec.rb +45 -0
  41. data/spec/versioner_spec.rb +6 -0
  42. data/spec/xunitcmd_spec.rb +10 -0
  43. data/spec/xunittask_spec.rb +7 -0
  44. metadata +77 -9
  45. data/test/test_rake_dotnet.rb +0 -16
@@ -0,0 +1,16 @@
1
+ require 'rake'
2
+ require '../rake_dotnet'
3
+
4
+ RakeDotNet::AssemblyInfoTask.new
5
+
6
+ RakeDotNet::MsBuildTask.new({:deps=>[RakeDotNet::Bin_out, :assembly_info]})
7
+
8
+ RakeDotNet::HarvestOutputTask.new({:deps => [:compile]})
9
+
10
+ RakeDotNet::HarvestWebApplicationTask.new({:deps=>[:compile]})
11
+
12
+ RakeDotNet::RDNPackageTask.new(name='bin', {:deps=>[:compile, :harvest_output, :xunit]}) do |p|
13
+ p.targets.include("#{RakeDotNet::Bin_out}")
14
+ end
15
+
16
+ task :default => [:compile, :harvest_output, :xunit, :package]
@@ -0,0 +1,8 @@
1
+ require 'spec'
2
+ require 'rake'
3
+ require 'rake/tasklib'
4
+ require File.join(File.dirname(__FILE__), '..','lib','assemblyinfo.rb')
5
+
6
+ describe AssemblyInfoTask do
7
+
8
+ end
@@ -0,0 +1,81 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','bcpcmd.rb')
4
+
5
+ describe BcpCmd do
6
+ before :each do
7
+ @params = {:database=>'foo', :table=>'bar', :direction=>:in, :file=>'data.bcp'}
8
+ end
9
+ it "should have sensible default search paths" do
10
+ bcp = BcpCmd.new
11
+ bcp.search_paths[0].should match(/#{TOOLS_DIR}\/sql/)
12
+ bcp.search_paths[1].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/100/tools/binn")
13
+ bcp.search_paths[2].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/90/tools/binn")
14
+ bcp.search_paths[3].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/80/tools/binn")
15
+ bcp.search_paths[4].should be_nil
16
+ end
17
+ it "should assume trusted connection by default" do
18
+ bcp = BcpCmd.new(@params)
19
+ bcp.cmd.should match(/.*-T.*/)
20
+ end
21
+ it "should read credentials from constants if trusted=false" do
22
+ bcp = BcpCmd.new(@params.merge({:trusted => false}))
23
+ bcp.cmd.should match(/.*-U "#{DB_USER}"/)
24
+ bcp.cmd.should match(/.*-P "#{DB_PASSWORD}"/)
25
+ end
26
+ it "should read server from constant if not specified" do
27
+ bcp = BcpCmd.new(@params)
28
+ bcp.cmd.should match(/.*-S ".".*/)
29
+ end
30
+ it "should write out a basic command line with the minimum required parameters supplied by constructor" do
31
+ bcp = BcpCmd.new(@params)
32
+ bcp_assert bcp
33
+ end
34
+ it "should write out a basic command line with the minimum required parameters supplied by accessors" do
35
+ bcp = BcpCmd.new
36
+ bcp.database = @params[:database]
37
+ bcp.table = @params[:table]
38
+ bcp.direction = @params[:direction]
39
+ bcp.file = @params[:file]
40
+ bcp_assert bcp
41
+ end
42
+ it "should write out extra parameters when supplied by accessors" do
43
+ bcp = BcpCmd.new(@params)
44
+ bcp.keep_identity_values = true
45
+ bcp.keep_null_values = true
46
+ bcp.wide_character_type = true
47
+ bcp.field_terminator = ','
48
+ bcp.native_type = true
49
+
50
+ bcp_assert bcp
51
+ bcp.cmd.should match(/.* -E.*/)
52
+ bcp.cmd.should match(/.* -k.*/)
53
+ bcp.cmd.should match(/.* -w.*/)
54
+ bcp.cmd.should match(/.* -t ','.*/)
55
+ bcp.cmd.should match(/.* -n.*/)
56
+ end
57
+ it "should revert optional attributes when told to" do
58
+ bcp = BcpCmd.new
59
+ bcp.keep_identity_values = true
60
+ bcp.keep_null_values = true
61
+ bcp.wide_character_type = true
62
+ bcp.field_terminator = ','
63
+ bcp.native_type = true
64
+
65
+ bcp.revert_optionals
66
+
67
+ bcp.keep_identity_values.should be_nil
68
+ bcp.keep_null_values.should be_nil
69
+ bcp.wide_character_type.should be_nil
70
+ bcp.field_terminator.should be_nil
71
+ bcp.native_type.should be_nil
72
+ end
73
+
74
+ def bcp_assert(bcp)
75
+ bcp.cmd.should match(/.*\[foo\]\.\[dbo\]\.\[bar\].*/)
76
+ bcp.cmd.should match(/.* in .*/)
77
+ bcp.cmd.should match(/.* "\w:\\.*data\.bcp".*/)
78
+ bcp.cmd.should match(/.* -S \".\"/)
79
+ bcp.cmd.should match(/.* -T.*/)
80
+ end
81
+ end
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,48 @@
1
+ #cli spec
2
+ require 'spec'
3
+ require 'fileutils'
4
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'cli.rb')
5
+
6
+ describe Cli do
7
+ before(:all) do
8
+ @here = File.dirname(__FILE__)
9
+ Dir.chdir('spec')
10
+ end
11
+ after :all do
12
+ Dir.chdir('..')
13
+ end
14
+ it "should push nil onto the array of search paths" do
15
+ cli = Cli.new
16
+ cli.search_paths.should == [nil]
17
+ end
18
+ it "should push nil onto the array of search paths as the last item" do
19
+ cli = Cli.new({:search_paths=>['foo']})
20
+ cli.search_paths.should == ['foo', nil]
21
+ end
22
+ it "should not search for exe if it's specified in the params" do
23
+ cli = Cli.new({:exe=>'foo', :search_paths=>['bar']})
24
+ cli.cmd.should == '"foo"'
25
+ end
26
+ it "should search for exe if we have an exe_name but no exe, and return exe_name (because we want it to look within system-path)" do
27
+ cli = Cli.new({:exe_name=>'foo'})
28
+ cli.cmd.should == '"foo"'
29
+ end
30
+ it "should return fully qualified path to exe when search-path is tried and exe is found there successfully" do
31
+ cli = Cli.new({:exe_name => 'foo.exe', :search_paths=>['support/cli']})
32
+ cli.cmd.should match(/#{@here}.*/)
33
+ cli.cmd.should include('support/cli/foo.exe')
34
+ end
35
+ it "should return fully qualified path to exe at first find when search-path is tried and exe is found" do
36
+ cli = Cli.new({:exe_name => 'foo.exe', :search_paths=>['support/cli/bar', 'support/cli']})
37
+ cli.cmd.should match(/#{@here}.*/)
38
+ cli.cmd.should include('support/cli/bar/foo.exe')
39
+ end
40
+ it "should return fq path to exe at first find, skipping non-finds" do
41
+ cli = Cli.new({:exe_name => 'foo.exe', :search_paths=>['support/cli/notexist', 'support/cli']})
42
+ cli.cmd.should match(/#{@here}.*/)
43
+ cli.cmd.should include('support/cli/foo.exe')
44
+ end
45
+ it "should throw if no exe found in search paths supplied and not in path" do
46
+ cli = Cli.new({:exe_name => 'nonexistent'})
47
+ end
48
+ end
@@ -0,0 +1,6 @@
1
+ TOOLS_DIR = 'support'
2
+ DB_SERVER = '.'
3
+ DB_USER = 'sa'
4
+ DB_PASSWORD = 'youREALLYdontwanttousethispasswordassa!'
5
+
6
+ OUT_DIR = 'out'
@@ -0,0 +1,8 @@
1
+ require 'spec'
2
+ require 'rake/tasklib'
3
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
4
+ require File.join(File.dirname(__FILE__), '..','lib','fxcop.rb')
5
+
6
+ describe FxCopCmd do
7
+
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','fxcop.rb')
4
+
5
+ describe FxCopTask do
6
+
7
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','harvester.rb')
3
+
4
+ describe Harvester do
5
+
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','harvester.rb')
3
+
4
+ describe HarvestOutputTask do
5
+
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','harvester.rb')
3
+
4
+ describe HarvestWebApplicationTask do
5
+
6
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec'
2
+ require 'rake/tasklib'
3
+ require File.join(File.dirname(__FILE__), '..','lib','iisappcmd.rb')
4
+
5
+ describe IisAppCmd do
6
+ it "should have some sensible default paths to look for exe"
7
+ it "should require a physical path"
8
+ it "should default to http://*:80 when no bindings are supplied"
9
+ it "should handle a list of bindings"
10
+ it "should handle a single binding"
11
+ it "should default to naming the site like the last directory name in physical-path"
12
+ it "should use a supplied website name"
13
+ it "should use a supplied id"
14
+ it "should generate an id when not supplied"
15
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','msbuild.rb')
4
+
5
+ describe MsBuildCmd do
6
+
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','msbuild.rb')
4
+
5
+ describe MsBuildTask do
6
+
7
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','ncover.rb')
4
+
5
+ describe NCoverConsoleCmd do
6
+ it "should have sensible search paths"
7
+ it "should require a assembly to profile"
8
+ it "should have a default for exclude_assemblies"
9
+ it "should have a default working directory that's the same dir as the assembly to profile"
10
+ it "should handle a single string for exclude_assemblies"
11
+ it "should handle an array for exclude_assemblies"
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','ncover.rb')
4
+
5
+ describe NCoverReportingCmd do
6
+ it "should have sensible search paths"
7
+ it "should require a report_dir"
8
+ it "should require coverage files to report against"
9
+ it "should have sensible defaults for reports to generate"
10
+ it "should output into the report directory"
11
+ it "should define a sensible sort order"
12
+ it "should default to a sensible product name"
13
+ it "should include a sensible build_id"
14
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','ncover.rb')
4
+
5
+ describe NCoverTask do
6
+ it "should default the product_name"
7
+ it "should allow product_name to be specified"
8
+ it "should default bin_dir"
9
+ it "should allow the bin_dir to be specified"
10
+ it "should default the report_dir"
11
+ it "should allow the report_dir to be specified"
12
+ it "should default the dependencies"
13
+ it "should allow the dependencies to be specified"
14
+ it "should default profile_options"
15
+ it "should merge in profile_options that are specified"
16
+ it "should default reporting_options"
17
+ it "should merge in reporting_options that are specified"
18
+ it "should make :ncover_profile depend on each dependency"
19
+ it "should define @report_dir as a directory-task"
20
+ it "should define a rule for ncover_profile"
21
+ it "should define a task for ncover_profile that depends on report_dir"
22
+ it "should define a task for ncover_reports that depends on ncover_profile"
23
+ it "should define :clobber_ncover"
24
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','package.rb')
3
+
4
+ describe RDNPackageTask do
5
+
6
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','sevenzip.rb')
4
+
5
+ describe SevenZipCmd do
6
+
7
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','sqlcmd.rb')
4
+
5
+ describe SqlCmd do
6
+ it "should have sensible default search_paths when constructed" do
7
+ sql = SqlCmd.new
8
+ sql.search_paths[0].should match(/#{TOOLS_DIR}\/sql/)
9
+ sql.search_paths[1].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/100/tools/binn")
10
+ sql.search_paths[2].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/90/tools/binn")
11
+ sql.search_paths[3].should include("#{ENV['PROGRAMFILES']}/Microsoft SQL Server/80/tools/binn")
12
+ sql.search_paths[4].should be_nil
13
+ end
14
+ it "should assume trusted connection by default" do
15
+ sql = SqlCmd.new
16
+ sql.cmd.should match(/.*-E.*/)
17
+ end
18
+ it "should read credentials from constants if trusted=false" do
19
+ sql = SqlCmd.new({:trusted => false})
20
+ sql.cmd.should match(/.*-U "#{DB_USER}"/)
21
+ sql.cmd.should match(/.*-P "#{DB_PASSWORD}"/)
22
+ end
23
+ it "should read server from constant if not specified" do
24
+ sql = SqlCmd.new
25
+ sql.cmd.should match(/.*-S ".".*/)
26
+ end
27
+ it "should use a database when told to" do
28
+ sql = SqlCmd.new
29
+ sql.database = 'db'
30
+ sql.cmd.should match(/.*-d "db".*/)
31
+ end
32
+ it "should use an input file with an expanded path with forward slashes replaced with backslashes when told to" do
33
+ sql = SqlCmd.new
34
+ sql.input_file = 'support/sqlcmd/foo.sql'
35
+ sql.cmd.should match(/.*-i "\w:\\.*\\support\\sqlcmd\\foo\.sql".*/)
36
+ end
37
+ it "should use a supplied query" do
38
+ sql = SqlCmd.new
39
+ sql.query = 'SELECT bar FROM dbo.foo'
40
+ sql.cmd.should match(/.*-Q "SELECT bar FROM dbo\.foo".*/)
41
+ end
42
+ it "should revert optional attributes when told to" do
43
+ sql = SqlCmd.new
44
+ sql.query = 'SELECT foo FROM bar'
45
+ sql.input_file = 'foo.sql'
46
+
47
+ sql.revert_optionals
48
+
49
+ sql.query.should be_nil
50
+ sql.input_file.should == ''
51
+ end
52
+ end
@@ -0,0 +1,45 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','svn.rb')
3
+
4
+ describe SvnCmd do
5
+ it "should know 3 sensible default search paths" do
6
+ svn = SvnCmd.new
7
+ svn.search_paths[0].should include(TOOLS_DIR)
8
+ svn.search_paths[1].should include(ENV['PROGRAMFILES'])
9
+ svn.search_paths[2].should include(ENV['PROGRAMFILES'])
10
+ svn.search_paths[3].should == nil
11
+ end
12
+ end
13
+
14
+ describe SvnExport do
15
+ it "should require src" do
16
+ lambda { SvnExport.new({:dest=>'support/svn/dest'})}.should raise_error(ArgumentError)
17
+ end
18
+ it "should require dest" do
19
+ lambda { SvnExport.new({:src=>'support/svn/src'}) }.should raise_error(ArgumentError)
20
+ end
21
+ it "export should generate correct command line when run" do
22
+ svn = SvnExport.new({:src=>'support/svn/src',:dest=>'support/svn/dest'})
23
+ cmd = svn.cmd
24
+ cmd.should_not be_nil
25
+ cmd.should match(/".*svn\.exe.*/)
26
+ cmd.should match(/".* export.*/)
27
+ cmd.should match(/".* ".*support\/svn\/src".*/)
28
+ cmd.should match(/".* ".*support\/svn\/dest"/)
29
+ end
30
+ end
31
+
32
+ describe SvnInfo do
33
+ it "should default to using current directory when path not specified" do
34
+ si = SvnInfo.new
35
+ si.cmd.should match(/".*svn\.exe.*/)
36
+ si.cmd.should match(/".* info.*"/)
37
+ si.cmd.should match(/.* info "."/)
38
+ end
39
+ it "should specify path when supplied as argument" do
40
+ si = SvnInfo.new({:path=>'support/svn'})
41
+ si.cmd.should match(/".*svn\.exe.*/)
42
+ si.cmd.should match(/".* info.*"/)
43
+ si.cmd.should match(/.* info "support\/svn"/)
44
+ end
45
+ end
@@ -0,0 +1,6 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','version.rb')
3
+
4
+ describe Versioner do
5
+
6
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','xunit.rb')
4
+
5
+ describe XUnitConsoleCmd do
6
+ it "should have sensible search paths"
7
+ it "should have sensible defaults for all optional settings"
8
+ it "should allow settings to be specified during initialisation"
9
+ it "should require a test_dll"
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec'
2
+ require File.join(File.dirname(__FILE__), '..','lib','cli.rb')
3
+ require File.join(File.dirname(__FILE__), '..','lib','xunit.rb')
4
+
5
+ describe XUnitTask do
6
+
7
+ end