albacore 0.2.0.preview2 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/.rvmrc +1 -0
  2. data/Gemfile +11 -0
  3. data/Gemfile.lock +43 -0
  4. data/README.markdown +1 -0
  5. data/VERSION +1 -1
  6. data/lib/albacore/albacoretask.rb +32 -25
  7. data/lib/albacore/aspnetcompiler.rb +58 -0
  8. data/lib/albacore/assemblyinfo.rb +1 -1
  9. data/lib/albacore/config/aspnetcompilerconfig.rb +29 -0
  10. data/lib/albacore/csc.rb +2 -2
  11. data/lib/albacore/docu.rb +3 -2
  12. data/lib/albacore/exec.rb +2 -2
  13. data/lib/albacore/msbuild.rb +2 -2
  14. data/lib/albacore/mspectestrunner.rb +3 -3
  15. data/lib/albacore/nant.rb +2 -2
  16. data/lib/albacore/ncoverconsole.rb +2 -2
  17. data/lib/albacore/ncoverreport.rb +2 -2
  18. data/lib/albacore/ndepend.rb +2 -2
  19. data/lib/albacore/nunittestrunner.rb +2 -2
  20. data/lib/albacore/plink.rb +47 -0
  21. data/lib/albacore/specflowreport.rb +2 -2
  22. data/lib/albacore/sqlcmd.rb +2 -2
  23. data/lib/albacore/support/attrmethods.rb +9 -8
  24. data/lib/albacore/support/runcommand.rb +37 -35
  25. data/lib/albacore/unzip.rb +1 -1
  26. data/lib/albacore/xbuild.rb +2 -2
  27. data/lib/albacore/xunittestrunner.rb +3 -3
  28. data/lib/albacore/zipdirectory.rb +1 -1
  29. data/rakefile.rb +1 -6
  30. data/spec/albacoremodel_spec.rb +3 -3
  31. data/spec/assemblyinfo_spec.rb +3 -3
  32. data/spec/attrmethods_spec.rb +21 -1
  33. data/spec/config_spec.rb +2 -2
  34. data/spec/createtask_spec.rb +4 -4
  35. data/spec/csc_spec.rb +1 -1
  36. data/spec/docu_spec.rb +1 -1
  37. data/spec/exec_spec.rb +1 -1
  38. data/spec/msbuild_spec.rb +1 -1
  39. data/spec/mspec_spec.rb +1 -1
  40. data/spec/nant_spec.rb +1 -1
  41. data/spec/ncoverconsole_spec.rb +2 -7
  42. data/spec/ncoverreport_spec.rb +5 -5
  43. data/spec/ndepend_spec.rb +1 -1
  44. data/spec/nunittestrunner_spec.rb +1 -1
  45. data/spec/plink_spec.rb +62 -0
  46. data/spec/runcommand_spec.rb +3 -3
  47. data/spec/{support/spec_helper.rb → spec_helper.rb} +2 -1
  48. data/spec/specflowreport_spec.rb +1 -1
  49. data/spec/sqlcmd_spec.rb +3 -3
  50. data/spec/unzip_spec.rb +1 -1
  51. data/spec/xbuild_spec.rb +1 -1
  52. data/spec/xunit_spec.rb +1 -1
  53. data/spec/yamlconfig_spec.rb +8 -8
  54. data/spec/zip_spec.rb +1 -1
  55. metadata +98 -62
  56. data/install_dependencies.rb +0 -32
@@ -1,43 +1,45 @@
1
1
  require 'albacore/support/attrmethods'
2
2
 
3
- module RunCommand
4
- extend AttrMethods
5
-
6
- attr_accessor :command, :working_directory
7
- attr_array :parameters
8
-
9
- def initialize
10
- @working_directory = Dir.pwd
11
- @parameters = []
12
- super()
13
- end
14
-
15
- def run_command(name="Command Line", parameters=nil)
16
- begin
17
- params = Array.new
18
- params << parameters unless parameters.nil?
19
- params << @parameters unless (@parameters.nil? || @parameters.length==0)
20
-
21
- cmd = get_command(params)
22
- @logger.debug "Executing #{name}: #{cmd}"
23
-
24
- Dir.chdir(@working_directory) do
25
- return system(cmd)
26
- end
3
+ module Albacore
4
+ module RunCommand
5
+ extend AttrMethods
6
+
7
+ attr_accessor :command, :working_directory
8
+ attr_array :parameters
9
+
10
+ def initialize
11
+ @working_directory = Dir.pwd
12
+ @parameters = []
13
+ super()
14
+ end
15
+
16
+ def run_command(name="Command Line", parameters=nil)
17
+ begin
18
+ params = Array.new
19
+ params << parameters unless parameters.nil?
20
+ params << @parameters unless (@parameters.nil? || @parameters.length==0)
21
+
22
+ cmd = get_command(params)
23
+ @logger.debug "Executing #{name}: #{cmd}"
24
+
25
+ Dir.chdir(@working_directory) do
26
+ return system(cmd)
27
+ end
27
28
 
28
- rescue Exception => e
29
- puts "Error While Running Command Line Tool: #{e}"
30
- raise
29
+ rescue Exception => e
30
+ puts "Error While Running Command Line Tool: #{e}"
31
+ raise
32
+ end
31
33
  end
32
- end
33
34
 
34
- def get_command(params)
35
- executable = @command
36
- unless command.nil?
37
- executable = File.expand_path(@command) if File.exists?(@command)
35
+ def get_command(params)
36
+ executable = @command
37
+ unless command.nil?
38
+ executable = File.expand_path(@command) if File.exists?(@command)
39
+ end
40
+ cmd = "\"#{executable}\""
41
+ cmd +=" #{params.join(' ')}" if params.length > 0
42
+ cmd
38
43
  end
39
- cmd = "\"#{executable}\""
40
- cmd +=" #{params.join(' ')}" if params.length > 0
41
- cmd
42
44
  end
43
45
  end
@@ -4,7 +4,7 @@ require 'zip/zipfilesystem'
4
4
  include Zip
5
5
 
6
6
  class Unzip
7
- include AlbacoreTask
7
+ include Albacore::Task
8
8
 
9
9
  attr_accessor :destination, :file
10
10
 
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
 
3
3
  class XBuild
4
4
  TaskName = [:xbuild, :mono]
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
 
8
8
  attr_accessor :solution, :verbosity
9
9
  attr_array :targets
@@ -2,8 +2,8 @@ require 'albacore/albacoretask'
2
2
 
3
3
  class XUnitTestRunner
4
4
  TaskName = :xunit
5
- include AlbacoreTask
6
- include RunCommand
5
+ include Albacore::Task
6
+ include Albacore::RunCommand
7
7
 
8
8
  attr_accessor :html_output
9
9
  attr_array :options,:assembly,:assemblies
@@ -47,6 +47,6 @@ class XUnitTestRunner
47
47
 
48
48
  def build_html_output
49
49
  fail_with_message 'Directory is required for html_output' if !File.directory?(File.expand_path(@html_output))
50
- "/html #{File.join(File.expand_path(@html_output),"%s.html")}"
50
+ "/html \"#{File.join(File.expand_path(@html_output),"%s.html")}\""
51
51
  end
52
52
  end
@@ -5,7 +5,7 @@ include Zip
5
5
 
6
6
  class ZipDirectory
7
7
  TaskName = :zip
8
- include AlbacoreTask
8
+ include Albacore::Task
9
9
 
10
10
  attr_accessor :output_path, :output_file
11
11
  attr_accessor :flatten_zip
@@ -1,3 +1,4 @@
1
+ $: << './'
1
2
  require 'lib/albacore'
2
3
 
3
4
  task :default => ['albacore:sample']
@@ -238,11 +239,5 @@ namespace :jeweler do
238
239
 
239
240
  gs.add_dependency('rake', '>= 0.8.7')
240
241
  gs.add_dependency('rubyzip', '>= 0.9.4')
241
-
242
- gs.add_development_dependency('rspec', '>= 1.3.0')
243
- gs.add_development_dependency('jeweler', '>= 1.4.0')
244
- gs.add_development_dependency('derickbailey-notamock', '>= 0.0.1')
245
- gs.add_development_dependency('jekyll', '>= 0.5.7')
246
- gs.add_development_dependency('watchr', '>= 0.6')
247
242
  end
248
243
  end
@@ -1,8 +1,8 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/albacoretask'
3
3
 
4
4
  class ModelTest
5
- include AlbacoreTask
5
+ include Albacore::Task
6
6
  attr_accessor :foo, :bar
7
7
  attr_hash :a_hash
8
8
  attr_array :a_array
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  class NamedTaskExample
12
12
  TaskName = [:namedtask, :anothername]
13
- include AlbacoreTask
13
+ include Albacore::Task
14
14
  end
15
15
 
16
16
  describe "when updating object attributes with a valid set of hash keys" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'assemblyinfotester'
3
3
  require 'albacore/assemblyinfo'
4
4
 
@@ -15,7 +15,7 @@ describe AssemblyInfo, "when generating an assembly info file" do
15
15
  end
16
16
 
17
17
  it "should log the name of the output file" do
18
- @log_data.should include(@tester.assemblyinfo_file)
18
+ @log_data.downcase.should include(@tester.assemblyinfo_file.downcase)
19
19
  end
20
20
  end
21
21
 
@@ -34,7 +34,7 @@ describe AssemblyInfo, "when generating an assembly info file in verbose mode" d
34
34
  end
35
35
 
36
36
  it "should log the name of the output file" do
37
- @log_data.should include(@tester.assemblyinfo_file)
37
+ @log_data.downcase.should include(@tester.assemblyinfo_file.downcase)
38
38
  end
39
39
  end
40
40
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/support/attrmethods'
3
3
 
4
4
  describe "when setting an array attribute value without the equal sign" do
@@ -114,3 +114,23 @@ describe "when setting a hash attribute to an hash variable using the equal sign
114
114
  @test.test.length.should be(3)
115
115
  end
116
116
  end
117
+
118
+ describe "when setting a hash attribute to a hash across multiple lines" do
119
+ before :each do
120
+ class TestClass
121
+ extend AttrMethods
122
+ attr_hash :test
123
+ end
124
+
125
+ @test = TestClass.new
126
+ @test.test(
127
+ :a => "b",
128
+ :c => "d",
129
+ :e => "f"
130
+ )
131
+ end
132
+
133
+ it "should set the hash to the values" do
134
+ @test.test.length.should be(3)
135
+ end
136
+ end
@@ -1,9 +1,9 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/albacoretask'
3
3
  require 'albacore/config/config'
4
4
 
5
5
  class ConfigTest
6
- include AlbacoreTask
6
+ include Albacore::Task
7
7
  end
8
8
 
9
9
  module ConfigModuleTest
@@ -1,9 +1,9 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/albacoretask'
3
3
  require 'fail_patch'
4
4
 
5
5
  class SampleObject
6
- include AlbacoreTask
6
+ include Albacore::Task
7
7
 
8
8
  attr_array :array
9
9
  attr_hash :hash
@@ -21,8 +21,8 @@ class SampleObject
21
21
  end
22
22
 
23
23
  class RunCommandObject
24
- include AlbacoreTask
25
- include RunCommand
24
+ include Albacore::Task
25
+ include Albacore::RunCommand
26
26
 
27
27
  def execute
28
28
  result = run_command "Run Command Test Object"
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/csc'
3
3
 
4
4
  Albacore.configure do |config|
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/docu'
3
3
  require 'docu_patch'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/exec'
3
3
 
4
4
  describe Exec, "when executing a command with parameters" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/msbuild'
3
3
  require 'albacore/config/msbuildconfig'
4
4
  require 'msbuildtestdata'
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/mspectestrunner'
3
3
 
4
4
  describe MSpecTestRunner, "when providing configuration" do
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/nant'
3
3
  require 'nanttestdata'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/ncoverconsole'
3
3
  require 'albacore/nunittestrunner'
4
4
  require 'albacore/mspectestrunner'
@@ -261,12 +261,8 @@ describe NCoverConsole, "when producing an xml coverage report with nunit" do
261
261
  @ncc.system_command.should include(File.expand_path(@testdata.ncoverpath))
262
262
  end
263
263
 
264
- it "should execute with the specified working directory" do
265
- @ncc.system_command.should include(@testdata.working_directory)
266
- end
267
-
268
264
  it "should execute the test runner from the specified path" do
269
- @ncc.system_command.should include(@testdata.nunitpath)
265
+ @ncc.system_command.downcase.should include(@testdata.nunitpath.downcase)
270
266
  end
271
267
 
272
268
  it "should pass the specified assembly to the test runner" do
@@ -303,7 +299,6 @@ describe NCoverConsole, "when specifying an html report and an xml coverage repo
303
299
  ncc.testrunner = nunit
304
300
  ncc.execute
305
301
  end
306
-
307
302
 
308
303
  it "should produce the xml report" do
309
304
  File.exist?(@testdata.xml_coverage_output).should == true
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/ncoverreport'
3
3
  require 'ncoverreporttestdata'
4
4
 
@@ -37,7 +37,7 @@ describe NCoverReport, "when running a full coverage report with a specified out
37
37
  end
38
38
 
39
39
  it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
40
- @ncover.system_command.should include("//or FullCoverageReport:Html:\"#{NCoverReportTestData.output_folder}\"")
40
+ @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{NCoverReportTestData.output_folder}\"".downcase)
41
41
  end
42
42
 
43
43
  it "should produce the report" do
@@ -68,7 +68,7 @@ describe NCoverReport, "when running a summary report with a specified output fo
68
68
  end
69
69
 
70
70
  it "should tell ncover.reporting to produce a summary html report in the specified folder" do
71
- @ncover.system_command.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"")
71
+ @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
72
72
  end
73
73
 
74
74
  it "should produce the report" do
@@ -99,11 +99,11 @@ describe NCoverReport, "when running multiple ncover reports - a summary and a f
99
99
  end
100
100
 
101
101
  it "should tell ncover.reporting to produce a full coverage html report in the specified folder" do
102
- @ncover.system_command.should include("//or FullCoverageReport:Html:\"#{@fullcoverage_output_folder}\"")
102
+ @ncover.system_command.downcase.should include("//or FullCoverageReport:Html:\"#{@fullcoverage_output_folder}\"".downcase)
103
103
  end
104
104
 
105
105
  it "should tell ncover.reporting to produce a summary html report in the specified folder" do
106
- @ncover.system_command.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"")
106
+ @ncover.system_command.downcase.should include("//or Summary:Html:\"#{NCoverReportTestData.summary_output_file}\"".downcase)
107
107
  end
108
108
  end
109
109
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/ndepend'
3
3
  require 'albacore/msbuild'
4
4
 
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/nunittestrunner'
3
3
 
4
4
  shared_examples_for "nunit paths" do
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+ require 'albacore/plink'
3
+
4
+ describe PLink, 'when executing a command over plink' do
5
+ before :each do
6
+ @cmd = PLink.new
7
+ @cmd.extend(SystemPatch)
8
+ @cmd.extend(FailPatch)
9
+ @cmd.command ="C:\\plink.exe"
10
+ @cmd.host = "testhost"
11
+
12
+ end
13
+
14
+ it "should attempt to execute plink.exe" do
15
+ @cmd.run
16
+ @cmd.system_command.should include("plink.exe")
17
+ end
18
+
19
+ it "should attempt to connect to the test host on the default port (22)" do
20
+ @cmd.run
21
+ @cmd.system_command.should include("@testhost")
22
+ @cmd.system_command.should include("-P 22")
23
+ end
24
+
25
+ it "should connect to the test host on a non default port 2200" do
26
+ @cmd.port = 2200
27
+ @cmd.run
28
+ @cmd.system_command.should include("-P 2200")
29
+ end
30
+
31
+ it "should connect to the host with a username" do
32
+ expected_user = "dummyuser"
33
+ @cmd.user = expected_user
34
+ @cmd.run
35
+ @cmd.system_command.should include("#{expected_user}@")
36
+ end
37
+
38
+ it "should run remote commands in batch mode" do
39
+ @cmd.run
40
+ @cmd.system_command.should include("-batch")
41
+ end
42
+
43
+ it "should run commands in verbose mode" do
44
+ @cmd.verbose = true
45
+ @cmd.run
46
+ @cmd.system_command.should include("-v")
47
+ end
48
+
49
+ it "should include the remote command" do
50
+ expected_remote_exe = "C:\ThisIsTheRemoteExe.exe"
51
+ @cmd.commands expected_remote_exe
52
+ @cmd.run
53
+ @cmd.system_command.should include(expected_remote_exe)
54
+ end
55
+
56
+ it "should include the remote command with parameters" do
57
+ expected_remote_exe = "C:\\ThisIsTheRemoteExe.exe --help -o -p"
58
+ @cmd.commands expected_remote_exe
59
+ @cmd.run
60
+ @cmd.system_command.should include(expected_remote_exe)
61
+ end
62
+ end
@@ -1,10 +1,10 @@
1
- require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
1
+ require 'spec_helper'
2
2
  require 'albacore/albacoretask'
3
3
  require 'system_patch'
4
4
 
5
5
  class RunCommandObject
6
- include AlbacoreTask
7
- include RunCommand
6
+ include Albacore::Task
7
+ include Albacore::RunCommand
8
8
 
9
9
  def execute
10
10
  result = run_command "Run Command Test Object"