mendicantx-rubicant 0.0.3 → 0.0.4
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.
- data/lib/rubicant.rb +5 -37
- data/lib/runners/build_runners.rb +76 -0
- data/lib/runners/compiler_runners.rb +43 -0
- data/lib/runners/file_tasks.rb +51 -0
- data/lib/runners/test_runners.rb +45 -0
- data/rakefile.rb +2 -2
- data/rubicant.gemspec +13 -10
- data/test/unit/runners/when_calling_copyfiles_task.rb +48 -0
- data/test/unit/{tasks/when_calling_csc_task.rb → runners/when_calling_csc_runner.rb} +22 -32
- data/test/unit/runners/when_calling_mb_unit_runner.rb +202 -0
- data/test/unit/runners/when_calling_ms_build_runner.rb +225 -0
- data/test/unit/runners/when_calling_ms_build_runner_with_incorrect_parameters.rb +81 -0
- metadata +15 -10
- data/lib/tasks/compiler_tasks.rb +0 -50
- data/lib/tasks/file_tasks.rb +0 -61
- data/lib/tasks/test_tasks.rb +0 -79
- data/test/unit/tasks/when_calling_copyfiles_task.rb +0 -52
- data/test/unit/tasks/when_calling_mb_unit_task.rb +0 -326
data/lib/rubicant.rb
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/
|
|
2
|
-
require File.dirname(__FILE__) + '/
|
|
3
|
-
require File.dirname(__FILE__) + '/
|
|
4
|
-
require File.dirname(__FILE__) + '/
|
|
1
|
+
require File.dirname(__FILE__) + '/runners/compiler_runners'
|
|
2
|
+
require File.dirname(__FILE__) + '/runners/build_runners'
|
|
3
|
+
require File.dirname(__FILE__) + '/runners/test_runners'
|
|
4
|
+
require File.dirname(__FILE__) + '/runners/file_tasks'
|
|
5
5
|
require File.dirname(__FILE__) + '/dotnet/framework'
|
|
6
6
|
require File.dirname(__FILE__) + '/facades'
|
|
7
7
|
require 'erb'
|
|
8
8
|
|
|
9
9
|
module Rubicant
|
|
10
10
|
include Rubicant::DotNet
|
|
11
|
-
include Rubicant::
|
|
12
|
-
|
|
13
|
-
def csc(name, dependencies, opts={})
|
|
14
|
-
CscTask.new(name => dependencies) do |csc|
|
|
15
|
-
csc.target = opts[:target] unless opts[:target].nil?
|
|
16
|
-
csc.references = opts[:references] unless opts[:references].nil?
|
|
17
|
-
csc.out = opts[:out] unless opts[:out].nil?
|
|
18
|
-
csc.debug = opts[:debug] unless opts[:debug].nil?
|
|
19
|
-
csc.files = opts[:files] unless opts[:files].nil?
|
|
20
|
-
end
|
|
21
|
-
end
|
|
11
|
+
include Rubicant::Runners
|
|
22
12
|
|
|
23
13
|
def expand_template(template, output_file)
|
|
24
14
|
template_string = ""
|
|
@@ -31,26 +21,4 @@ module Rubicant
|
|
|
31
21
|
output.close
|
|
32
22
|
end
|
|
33
23
|
|
|
34
|
-
def mbunit(name, dependencies, mbunit_dir, test_dir, test_files, opts={})
|
|
35
|
-
MbUnitTask.new(name => dependencies) do |mbunit|
|
|
36
|
-
mbunit.mbunit_dir = mbunit_dir
|
|
37
|
-
mbunit.test_dir = test_dir
|
|
38
|
-
mbunit.test_files = test_files
|
|
39
|
-
mbunit.assembly_path = opts[:assembly_path] unless opts[:assembly_path].nil?
|
|
40
|
-
mbunit.report_folder = opts[:report_folder] unless opts[:report_folder].nil?
|
|
41
|
-
mbunit.report_name_format = opts[:report_name_format] unless opts[:report_name_format].nil?
|
|
42
|
-
mbunit.report_type = opts[:report_type] unless opts[:report_type].nil?
|
|
43
|
-
mbunit.show_reports = opts[:show_reports] unless opts[:show_reports].nil?
|
|
44
|
-
mbunit.transform = opts[:transform] unless opts[:transform].nil?
|
|
45
|
-
mbunit.filter_category = opts[:filter_category] unless opts[:filter_category].nil?
|
|
46
|
-
mbunit.exclude_category = opts[:exclude_category] unless opts[:exclude_category].nil?
|
|
47
|
-
mbunit.filter_author = opts[:filter_author] unless opts[:filter_author].nil?
|
|
48
|
-
mbunit.filter_type = opts[:filter_type] unless opts[:filter_type].nil?
|
|
49
|
-
mbunit.filter_namespace = opts[:filter_namespace] unless opts[:filter_namespace].nil?
|
|
50
|
-
mbunit.verbose = opts[:verbose] unless opts[:verbose].nil?
|
|
51
|
-
mbunit.shadow_copy = opts[:shadow_copy] unless opts[:shadow_copy].nil?
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
|
|
56
24
|
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require File.dirname(__FILE__) + '/../facades'
|
|
4
|
+
require File.dirname(__FILE__) + '/../dotnet/framework'
|
|
5
|
+
|
|
6
|
+
module Rubicant::Runners
|
|
7
|
+
class MsBuildRunner
|
|
8
|
+
|
|
9
|
+
attr_accessor :settings
|
|
10
|
+
attr_reader :rsp_file
|
|
11
|
+
|
|
12
|
+
def initialize(settings = {})
|
|
13
|
+
@settings = settings
|
|
14
|
+
@rsp_file = "#{ENV['TEMP']}/msbuild.rsp"
|
|
15
|
+
@msbuild = "#{Rubicant::DotNet::Frameworks.get_framework.framework_dir}\\msbuild.exe"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def run
|
|
19
|
+
fail 'no_autoresponse must be true or nil' unless @settings[:no_autoresponse].nil? || @settings[:no_autoresponse] == true
|
|
20
|
+
fail 'no_console_logger must be true or nil' unless @settings[:no_console_logger].nil? || @settings[:no_console_logger] == true
|
|
21
|
+
fail 'file_logger must be true or nil' unless @settings[:file_logger].nil? || @settings[:file_logger] == true
|
|
22
|
+
fail 'distributed_file_logger must be true or nil' unless @settings[:distributed_file_logger].nil? || @settings[:distributed_file_logger] == true
|
|
23
|
+
fail 'properties must be a hash' unless @settings[:properties].kind_of?(Hash) || @settings[:properties].nil?
|
|
24
|
+
fail 'file_logger_parameters must be a hash' unless @settings[:file_logger_parameters].kind_of?(Hash) || @settings[:file_logger_parameters].nil?
|
|
25
|
+
|
|
26
|
+
Rubicant::Runner.run "#{build_command}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
def build_command
|
|
31
|
+
build_rsp
|
|
32
|
+
command = "#{@msbuild} @#{@rsp_file}"
|
|
33
|
+
command
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def build_rsp
|
|
37
|
+
file = File.new("#{@rsp_file}", "w")
|
|
38
|
+
file.puts " /nologo"
|
|
39
|
+
file.puts " /noautoresponse" unless @settings[:no_autoresponse].nil?
|
|
40
|
+
file.puts " /target:#{@settings[:targets].join(';')}" unless @settings[:targets].nil?
|
|
41
|
+
file.puts " /logger:#{@settings[:logger]}" unless @settings[:logger].nil?
|
|
42
|
+
file.puts " /distributedlogger:#{@settings[:distributed_logger]}" unless @settings[:distributed_logger].nil?
|
|
43
|
+
file.puts " /consoleloggerparameters:#{@settings[:console_logger_parameters]}" unless @settings[:console_logger_parameters].nil?
|
|
44
|
+
file.puts " /validate" if @settings[:validate] == true
|
|
45
|
+
file.puts " /validate:#{@settings[:validate]}" if @settings[:validate] != nil && @settings[:validate] != true
|
|
46
|
+
file.puts " /verbosity:#{@settings[:verbosity]}" unless @settings[:verbosity].nil?
|
|
47
|
+
file.puts " /noconsolelogger" if @settings[:no_console_logger] == true
|
|
48
|
+
file.puts " /maxcpucount:#{@settings[:max_cpu_count]}" unless @settings[:max_cpu_count].nil?
|
|
49
|
+
file.puts " /ignoreprojectextensions:#{@settings[:ignore_project_extensions].join(';')}" unless @settings[:ignore_project_extensions].nil?
|
|
50
|
+
file.puts " /filelogger" if @settings[:file_logger] == true
|
|
51
|
+
file.puts " /distributedfilelogger" if @settings[:distributed_file_logger] == true
|
|
52
|
+
file.puts " /nodereuse:true" if @settings[:node_reuse] == true
|
|
53
|
+
file.puts " /nodereuse:false" if @settings[:node_reuse] == false
|
|
54
|
+
file.puts " #{@settings[:project_file]}" unless @settings[:project_file].nil?
|
|
55
|
+
|
|
56
|
+
unless (@settings[:properties].nil?)
|
|
57
|
+
properties_strings = []
|
|
58
|
+
@settings[:properties].each do |key, value|
|
|
59
|
+
properties_strings << "#{key}=#{value}"
|
|
60
|
+
end
|
|
61
|
+
file.puts(" /property:#{properties_strings.join(';')}") unless properties_strings.length == 0
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
unless (@settings[:file_logger_parameters].nil?)
|
|
65
|
+
file_logger_parameters_strings = []
|
|
66
|
+
@settings[:file_logger_parameters].each do |key, value|
|
|
67
|
+
file_logger_parameters_strings << "#{key}=#{value}"
|
|
68
|
+
end
|
|
69
|
+
file.puts(" /fileloggerparameters:#{file_logger_parameters_strings.join(';')}") unless file_logger_parameters_strings.length == 0
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
file.close
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require File.dirname(__FILE__) + '/../facades'
|
|
4
|
+
require File.dirname(__FILE__) + '/../dotnet/framework'
|
|
5
|
+
|
|
6
|
+
module Rubicant::Runners
|
|
7
|
+
class CscRunner
|
|
8
|
+
|
|
9
|
+
attr_accessor :settings
|
|
10
|
+
|
|
11
|
+
def initialize(settings = {})
|
|
12
|
+
@settings = settings
|
|
13
|
+
@csc = "#{Rubicant::DotNet::Frameworks.get_framework.framework_dir}\\csc.exe"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def run
|
|
17
|
+
fail('Debug can only be true or nil') if (@settings[:debug].nil? == false && !@settings[:debug])
|
|
18
|
+
Rubicant::Runner.run "#{build_command}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
private
|
|
22
|
+
def build_command
|
|
23
|
+
build_rsp
|
|
24
|
+
command = "#{@csc} @#{ENV['TEMP']}/csc.rsp"
|
|
25
|
+
command
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def build_rsp
|
|
29
|
+
file = File.new("#{ENV['TEMP']}/csc.rsp", "w")
|
|
30
|
+
|
|
31
|
+
file.puts " /target:#{@settings[:target]}" unless @settings[:target].nil?
|
|
32
|
+
file.puts " /reference:#{@settings[:references].join(';')}" unless @settings[:references].nil?
|
|
33
|
+
file.puts " /out:#{@settings[:out]}" unless @settings[:out].nil?
|
|
34
|
+
file.puts " /debug:full" unless @settings[:debug].nil?
|
|
35
|
+
file.puts " #{@settings[:files].to_a.join(' ')}".gsub(/\//, "\\") unless @settings[:files].nil?
|
|
36
|
+
file.close
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'fileutils'
|
|
3
|
+
|
|
4
|
+
module Rubicant::Runners
|
|
5
|
+
class CopyFiles
|
|
6
|
+
|
|
7
|
+
attr_accessor :settings
|
|
8
|
+
|
|
9
|
+
def initialize(settings = {})
|
|
10
|
+
@settings = settings
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run
|
|
14
|
+
fail "Target directory must be defined (:target_dir)" if @settings[:target_dir].nil?
|
|
15
|
+
fail "Source files must be defined (:file_globs)" if @settings[:file_globs].nil?
|
|
16
|
+
fail "Base directory must be defined (:base_dir)" if @settings[:base_dir].nil?
|
|
17
|
+
@settings[:excludes] = [] if @settings[:excludes].nil?
|
|
18
|
+
|
|
19
|
+
mkdir @settings[:target_dir] unless (File.exists?(@settings[:target_dir]))
|
|
20
|
+
|
|
21
|
+
files = FileList.new
|
|
22
|
+
@settings[:file_globs].each do |glob|
|
|
23
|
+
files.include("#{@settings[:base_dir]}/#{glob}")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@settings[:excludes].each do |exclude|
|
|
27
|
+
files.exclude(exclude)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
files.each do |filename|
|
|
31
|
+
target_dir_suffix = get_target_dir_suffix(filename)
|
|
32
|
+
target_name = File.join(@settings[:target_dir], target_dir_suffix)
|
|
33
|
+
if (File.directory?(filename))
|
|
34
|
+
mkdir_p target_name
|
|
35
|
+
else
|
|
36
|
+
puts "copying from #{filename} to #{target_name}"
|
|
37
|
+
cp filename, target_name
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def get_target_dir_suffix(file)
|
|
45
|
+
suffix = file[@settings[:base_dir].length..file.length-1]
|
|
46
|
+
puts "FileName is #{file}"
|
|
47
|
+
puts "Base dir is #{@settings[:base_dir]}"
|
|
48
|
+
puts "Suffix is #{suffix}"
|
|
49
|
+
return suffix
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require File.dirname(__FILE__) + '/../facades'
|
|
4
|
+
|
|
5
|
+
module Rubicant::Runners
|
|
6
|
+
|
|
7
|
+
class MbUnitRunner
|
|
8
|
+
attr_reader :settings
|
|
9
|
+
|
|
10
|
+
def initialize(settings = {})
|
|
11
|
+
@settings = settings
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def run
|
|
15
|
+
fail ('mbunit_dir must be set') if (@settings[:mbunit_dir].nil?)
|
|
16
|
+
fail ('test_files must be set') if (@settings[:test_files].nil?)
|
|
17
|
+
|
|
18
|
+
@settings[:mbunit_dir] = "./" if @settings[:mbunit_dir].length == 0
|
|
19
|
+
@settings[:mbunit_dir] = File.expand_path(@settings[:mbunit_dir])
|
|
20
|
+
|
|
21
|
+
exec_opts = {:working_dir => @settings[:mbunit_dir]}
|
|
22
|
+
|
|
23
|
+
exec_args = []
|
|
24
|
+
exec_args << "/ap:#{@settings[:assembly_path].to_a.join(' /ap:')}" unless @settings[:assembly_path].nil?
|
|
25
|
+
exec_args << "/rf:#{@settings[:report_folder]}" unless @settings[:report_folder].nil?
|
|
26
|
+
exec_args << "/rnf:#{@settings[:report_name_format]}" unless @settings[:report_name_format].nil?
|
|
27
|
+
exec_args << "/rt:#{@settings[:report_type]}" unless @settings[:report_type].nil?
|
|
28
|
+
exec_args << "/sr#{@settings[:show_reports]}" unless @settings[:show_reports].nil?
|
|
29
|
+
exec_args << "/tr:#{@settings[:transform]}" unless @settings[:transform].nil?
|
|
30
|
+
exec_args << "/fc:#{@settings[:filter_category]}" unless @settings[:filter_category].nil?
|
|
31
|
+
exec_args << "/ec:#{@settings[:exclude_category]}" unless @settings[:exclude_category].nil?
|
|
32
|
+
exec_args << "/fa:#{@settings[:filter_author]}" unless @settings[:filter_author].nil?
|
|
33
|
+
exec_args << "/ft:#{@settings[:filter_type]}" unless @settings[:filter_type].nil?
|
|
34
|
+
exec_args << "/fn:#{@settings[:filter_namespace]}" unless @settings[:filter_namespace].nil?
|
|
35
|
+
exec_args << "/v#{@settings[:verbose]}" unless @settings[:verbose].nil?
|
|
36
|
+
exec_args << "/sc#{@settings[:shadow_copy]}" unless @settings[:shadow_copy].nil?
|
|
37
|
+
|
|
38
|
+
@settings[:test_files] = [@settings[:test_files]] if @settings[:test_files].class == String
|
|
39
|
+
exec_args << @settings[:test_files].join(' ')
|
|
40
|
+
exec_opts.merge!({:args => exec_args})
|
|
41
|
+
|
|
42
|
+
Rubicant::Runner.exec(File.join(@settings[:mbunit_dir], "MbUnit.Cons.exe"), exec_opts)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/rakefile.rb
CHANGED
|
@@ -12,7 +12,7 @@ end
|
|
|
12
12
|
|
|
13
13
|
spec = Gem::Specification.new do |s|
|
|
14
14
|
s.name = "Rubicant"
|
|
15
|
-
s.version = "0.0.
|
|
15
|
+
s.version = "0.0.4"
|
|
16
16
|
s.author = "mendicant"
|
|
17
17
|
s.email = "mendicant@beigesunshine.com"
|
|
18
18
|
s.homepage = "http://blog.beigesunshine.com"
|
|
@@ -31,4 +31,4 @@ end
|
|
|
31
31
|
Rake::GemPackageTask.new(spec) do |pkg|
|
|
32
32
|
pkg.need_zip = true
|
|
33
33
|
pkg.need_tar = true
|
|
34
|
-
end
|
|
34
|
+
end
|
data/rubicant.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "rubicant"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.4"
|
|
4
4
|
s.author = "mendicant"
|
|
5
5
|
s.email = "mendicant@beigesunshine.com"
|
|
6
6
|
s.homepage = "http://blog.beigesunshine.com"
|
|
@@ -9,22 +9,25 @@ Gem::Specification.new do |s|
|
|
|
9
9
|
"lib/dotnet",
|
|
10
10
|
"lib/dotnet/frameworks.yml",
|
|
11
11
|
"lib/dotnet/framework.rb",
|
|
12
|
-
"lib/
|
|
13
|
-
"lib/
|
|
14
|
-
"lib/
|
|
15
|
-
"lib/
|
|
12
|
+
"lib/runners",
|
|
13
|
+
"lib/runners/test_runners.rb",
|
|
14
|
+
"lib/runners/compiler_runners.rb",
|
|
15
|
+
"lib/runners/build_runners.rb",
|
|
16
|
+
"lib/runners/file_tasks.rb",
|
|
16
17
|
"lib/rubicant.rb",
|
|
17
18
|
"rubicant.gemspec",
|
|
18
19
|
"rakefile.rb"]
|
|
19
20
|
s.require_path = "lib"
|
|
20
|
-
s.test_files = ["test/unit",
|
|
21
|
+
s.test_files = ["test/unit",
|
|
21
22
|
"test/unit/dotnet",
|
|
22
23
|
"test/unit/dotnet/when_creating_new_framework.rb",
|
|
23
24
|
"test/unit/dotnet/when_getting_framework_information.rb",
|
|
24
|
-
"test/unit/
|
|
25
|
-
"test/unit/
|
|
26
|
-
"test/unit/
|
|
27
|
-
"test/unit/
|
|
25
|
+
"test/unit/runners",
|
|
26
|
+
"test/unit/runners/when_calling_csc_runner.rb",
|
|
27
|
+
"test/unit/runners/when_calling_mb_unit_runner.rb",
|
|
28
|
+
"test/unit/runners/when_calling_copyfiles_task.rb",
|
|
29
|
+
"test/unit/runners/when_calling_ms_build_runner.rb",
|
|
30
|
+
"test/unit/runners/when_calling_ms_build_runner_with_incorrect_parameters.rb"]
|
|
28
31
|
s.has_rdoc = false
|
|
29
32
|
s.add_dependency("configatron", ">= 2.1.6")
|
|
30
33
|
s.add_dependency("rake", ">= 0.8.3")
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/runners/file_tasks'
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'mocha'
|
|
4
|
+
require 'rake'
|
|
5
|
+
|
|
6
|
+
class WhenCallingCopyFilesTask < Test::Unit::TestCase
|
|
7
|
+
|
|
8
|
+
def test_should_fail_when_calling_copyfiles_without_target_dir_parameter
|
|
9
|
+
begin
|
|
10
|
+
cf = Rubicant::Runners::CopyFiles.new
|
|
11
|
+
cf.run
|
|
12
|
+
|
|
13
|
+
assert.fail('Should get RuntimeError requiring target')
|
|
14
|
+
|
|
15
|
+
rescue RuntimeError => re
|
|
16
|
+
assert_equal('Target directory must be defined (:target_dir)', re.message)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_should_fail_when_calling_copyfiles_without_file_globs_parameter
|
|
21
|
+
begin
|
|
22
|
+
cf =Rubicant::Runners::CopyFiles.new
|
|
23
|
+
cf.settings[:target_dir] = "target_dir"
|
|
24
|
+
cf.run
|
|
25
|
+
|
|
26
|
+
assert.fail('Should get RuntimeError requiring target')
|
|
27
|
+
|
|
28
|
+
rescue RuntimeError => re
|
|
29
|
+
assert_equal('Source files must be defined (:file_globs)', re.message)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def test_should_fail_when_calling_copyfiles_without_base_dir_parameter
|
|
34
|
+
begin
|
|
35
|
+
cf = Rubicant::Runners::CopyFiles.new
|
|
36
|
+
cf.settings[:target_dir] = "target_dir"
|
|
37
|
+
cf.settings[:file_globs] = "**/*"
|
|
38
|
+
cf.run
|
|
39
|
+
|
|
40
|
+
assert.fail('Should get RuntimeError requiring target')
|
|
41
|
+
|
|
42
|
+
rescue RuntimeError => re
|
|
43
|
+
assert_equal('Base directory must be defined (:base_dir)', re.message)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../../../lib/
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/runners/compiler_runners'
|
|
2
2
|
require 'test/unit'
|
|
3
3
|
require 'mocha'
|
|
4
4
|
require File.dirname(__FILE__) + '/../../../lib/facades'
|
|
5
5
|
|
|
6
|
-
class
|
|
6
|
+
class WhenCallingCscRunner < Test::Unit::TestCase
|
|
7
|
+
|
|
7
8
|
|
|
8
|
-
|
|
9
9
|
def setup
|
|
10
|
-
@
|
|
10
|
+
@framework_dir = 'frameworkDir'
|
|
11
11
|
@framework = mock()
|
|
12
|
-
@framework.stubs(:framework_dir).returns(@
|
|
12
|
+
@framework.stubs(:framework_dir).returns(@framework_dir)
|
|
13
13
|
Rubicant::DotNet::Frameworks.expects(:get_framework).returns(@framework)
|
|
14
14
|
@rsp_file = "@#{ENV['TEMP']}/csc.rsp"
|
|
15
15
|
Rubicant::Runner.expects(:sh).with("frameworkDir\\csc.exe #{@rsp_file}")
|
|
@@ -21,19 +21,17 @@ class WhenCallingCscTask < Test::Unit::TestCase
|
|
|
21
21
|
|
|
22
22
|
def test_should_call_csc_with_rsp_file_even_with_no_parameters
|
|
23
23
|
|
|
24
|
-
Rubicant::
|
|
25
|
-
|
|
24
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
25
|
+
csc.run
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def test_should_call_csc_with_target_parameter
|
|
29
29
|
target = 'library'
|
|
30
30
|
|
|
31
31
|
@mock_file.expects(:puts).with(" /target:#{target}")
|
|
32
|
-
Rubicant::
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Rake.application['csc2'].invoke
|
|
32
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
33
|
+
csc.settings[:target] = target
|
|
34
|
+
csc.run
|
|
37
35
|
end
|
|
38
36
|
|
|
39
37
|
def test_should_call_csc_with_reference_parameter
|
|
@@ -42,43 +40,35 @@ class WhenCallingCscTask < Test::Unit::TestCase
|
|
|
42
40
|
|
|
43
41
|
@mock_file.expects(:puts).with(" /reference:#{foo};#{bar}")
|
|
44
42
|
|
|
45
|
-
Rubicant::
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Rake.application['csc3'].invoke
|
|
43
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
44
|
+
csc.settings[:references] = [foo, bar]
|
|
45
|
+
csc.run
|
|
50
46
|
end
|
|
51
47
|
|
|
52
48
|
def test_should_call_csc_with_out_parameter
|
|
53
49
|
out = "outfile.dll"
|
|
54
50
|
|
|
55
51
|
@mock_file.expects(:puts).with(" /out:#{out}")
|
|
56
|
-
Rubicant::
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Rake.application['csc4'].invoke
|
|
52
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
53
|
+
csc.settings[:out] = out
|
|
54
|
+
csc.run
|
|
61
55
|
end
|
|
62
56
|
|
|
63
57
|
def test_should_call_csc_with_files
|
|
64
58
|
foo = 'foo.cs'
|
|
65
59
|
bar = 'bar.cs'
|
|
66
60
|
@mock_file.expects(:puts).with(" #{foo} #{bar}")
|
|
67
|
-
Rubicant::
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Rake.application['csc5'].invoke
|
|
61
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
62
|
+
csc.settings[:files] = [foo, bar]
|
|
63
|
+
csc.run
|
|
72
64
|
end
|
|
73
65
|
|
|
74
66
|
def test_should_call_csc_with_debug
|
|
75
67
|
|
|
76
68
|
@mock_file.expects(:puts).with(" /debug:full")
|
|
77
|
-
Rubicant::
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
Rake.application['csc6'].invoke
|
|
69
|
+
csc = Rubicant::Runners::CscRunner.new
|
|
70
|
+
csc.settings[:debug] = true
|
|
71
|
+
csc.run
|
|
82
72
|
end
|
|
83
73
|
|
|
84
74
|
end
|