mendicantx-rubicant 0.0.1
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/dotnet/framework.rb +34 -0
- data/lib/dotnet/frameworks.yml +14 -0
- data/lib/facades.rb +40 -0
- data/lib/rubicant.rb +55 -0
- data/lib/tasks/compiler_tasks.rb +50 -0
- data/lib/tasks/file_tasks.rb +61 -0
- data/lib/tasks/test_tasks.rb +79 -0
- data/rakefile.rb +34 -0
- data/rubicant.gemspec +33 -0
- data/test/unit/dotnet/when_creating_new_framework.rb +60 -0
- data/test/unit/dotnet/when_getting_framework_information.rb +64 -0
- data/test/unit/tasks/when_calling_copyfiles_task.rb +52 -0
- data/test/unit/tasks/when_calling_csc_task.rb +85 -0
- data/test/unit/tasks/when_calling_mb_unit_task.rb +326 -0
- metadata +87 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'configatron'
|
|
2
|
+
require 'win32/registry'
|
|
3
|
+
|
|
4
|
+
module Rubicant::DotNet
|
|
5
|
+
|
|
6
|
+
class Frameworks
|
|
7
|
+
def self.get_framework()
|
|
8
|
+
ENV['framework'] = 'net35' if ENV['framework'].nil?
|
|
9
|
+
configatron.configure_from_yaml(File.dirname(__FILE__) + '/frameworks.yml') if configatron.frameworks.nil?
|
|
10
|
+
frameworkConfiguration = configatron.frameworks.retrieve(ENV['framework'])
|
|
11
|
+
fail('Requested framework does not exist in configuration') if frameworkConfiguration.nil?
|
|
12
|
+
return Framework.new(frameworkConfiguration)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class Framework
|
|
18
|
+
attr_reader :framework_dir, :sdk_dir
|
|
19
|
+
|
|
20
|
+
def initialize(frameworkConfig)
|
|
21
|
+
framework_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig.framework_registry_path)
|
|
22
|
+
framework_sdk_key = Win32::Registry::HKEY_LOCAL_MACHINE.open(frameworkConfig.framework_sdk_registry_path)
|
|
23
|
+
begin
|
|
24
|
+
@framework_dir = framework_key.read_s(frameworkConfig.framework_registry_key) + "\\#{frameworkConfig.framework_version}"
|
|
25
|
+
@sdk_dir = framework_sdk_key.read_s(frameworkConfig.framework_sdk_registry_key)
|
|
26
|
+
rescue Win32::Registry::Error
|
|
27
|
+
puts "Either the Framework or the SDK is not installed for #{ENV['framework']}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
frameworks:
|
|
2
|
+
net20:
|
|
3
|
+
framework_registry_path: SOFTWARE\Microsoft\.NETFramework
|
|
4
|
+
framework_sdk_registry_path: SOFTWARE\Microsoft\.NETFramework
|
|
5
|
+
framework_registry_key: InstallRoot
|
|
6
|
+
framework_sdk_registry_key: sdkInstallRootv2.0
|
|
7
|
+
framework_version: v2.0.50727
|
|
8
|
+
net35:
|
|
9
|
+
framework_registry_path: SOFTWARE\Microsoft\.NETFramework
|
|
10
|
+
framework_sdk_registry_path: SOFTWARE\Microsoft\Microsoft SDKs\Windows\v6.0A\WinSDKNetFxTools
|
|
11
|
+
framework_registry_key: InstallRoot
|
|
12
|
+
framework_sdk_registry_key: InstallationFolder
|
|
13
|
+
framework_version: v3.5
|
|
14
|
+
|
data/lib/facades.rb
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
|
|
3
|
+
module Rubicant
|
|
4
|
+
|
|
5
|
+
class Runner
|
|
6
|
+
def self.run(command)
|
|
7
|
+
puts command unless ENV['debug'].nil?
|
|
8
|
+
sh command
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.exec(program, opts={})
|
|
12
|
+
fail("program is required") if program.nil? || program.length == 0
|
|
13
|
+
command = ""
|
|
14
|
+
command << opts[:program_dir] unless opts[:program_dir].nil?
|
|
15
|
+
command << "/" if command.length > 0 && command.rindex("/") != command.length - 1
|
|
16
|
+
command << program + " "
|
|
17
|
+
command << opts[:args].join(" ") unless opts[:args].nil?
|
|
18
|
+
|
|
19
|
+
working_dir = Dir.pwd
|
|
20
|
+
working_dir = opts[:working_dir] unless opts[:working_dir].nil?
|
|
21
|
+
|
|
22
|
+
Dir.chdir(working_dir) do |path|
|
|
23
|
+
Runner.run(command)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
class Files
|
|
31
|
+
def self.copy(src, dest, opts={})
|
|
32
|
+
cp src, dest, opts
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.remove(list, options={})
|
|
36
|
+
rm list, options
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
data/lib/rubicant.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/tasks/compiler_tasks'
|
|
2
|
+
require File.dirname(__FILE__) + '/tasks/test_tasks'
|
|
3
|
+
require File.dirname(__FILE__) + '/tasks/file_tasks'
|
|
4
|
+
require File.dirname(__FILE__) + '/dotnet/framework'
|
|
5
|
+
require File.dirname(__FILE__) + '/facades'
|
|
6
|
+
require 'erb'
|
|
7
|
+
|
|
8
|
+
module Rubicant
|
|
9
|
+
include Rubicant::DotNet
|
|
10
|
+
include Rubicant::Tasks
|
|
11
|
+
|
|
12
|
+
def csc(name, dependencies, opts={})
|
|
13
|
+
CscTask.new(name => dependencies) do |csc|
|
|
14
|
+
csc.target = opts[:target] unless opts[:target].nil?
|
|
15
|
+
csc.references = opts[:references] unless opts[:references].nil?
|
|
16
|
+
csc.out = opts[:out] unless opts[:out].nil?
|
|
17
|
+
csc.debug = opts[:debug] unless opts[:debug].nil?
|
|
18
|
+
csc.files = opts[:files] unless opts[:files].nil?
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def expand_template(template, output_file)
|
|
23
|
+
template_string = ""
|
|
24
|
+
File.open(template).each do |line|
|
|
25
|
+
template_string << line
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
output = File.open(output_file, "w")
|
|
29
|
+
output.puts(ERB.new(template_string).result)
|
|
30
|
+
output.close
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def mbunit(name, dependencies, mbunit_dir, test_dir, test_files, opts={})
|
|
34
|
+
MbUnitTask.new(name => dependencies) do |mbunit|
|
|
35
|
+
mbunit.mbunit_dir = mbunit_dir
|
|
36
|
+
mbunit.test_dir = test_dir
|
|
37
|
+
mbunit.test_files = test_files
|
|
38
|
+
mbunit.assembly_path = opts[:assembly_path] unless opts[:assembly_path].nil?
|
|
39
|
+
mbunit.report_folder = opts[:report_folder] unless opts[:report_folder].nil?
|
|
40
|
+
mbunit.report_name_format = opts[:report_name_format] unless opts[:report_name_format].nil?
|
|
41
|
+
mbunit.report_type = opts[:report_type] unless opts[:report_type].nil?
|
|
42
|
+
mbunit.show_reports = opts[:show_reports] unless opts[:show_reports].nil?
|
|
43
|
+
mbunit.transform = opts[:transform] unless opts[:transform].nil?
|
|
44
|
+
mbunit.filter_category = opts[:filter_category] unless opts[:filter_category].nil?
|
|
45
|
+
mbunit.exclude_category = opts[:exclude_category] unless opts[:exclude_category].nil?
|
|
46
|
+
mbunit.filter_author = opts[:filter_author] unless opts[:filter_author].nil?
|
|
47
|
+
mbunit.filter_type = opts[:filter_type] unless opts[:filter_type].nil?
|
|
48
|
+
mbunit.filter_namespace = opts[:filter_namespace] unless opts[:filter_namespace].nil?
|
|
49
|
+
mbunit.verbose = opts[:verbose] unless opts[:verbose].nil?
|
|
50
|
+
mbunit.shadow_copy = opts[:shadow_copy] unless opts[:shadow_copy].nil?
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require File.dirname(__FILE__) + '/../facades'
|
|
4
|
+
require File.dirname(__FILE__) + '/../dotnet/framework'
|
|
5
|
+
|
|
6
|
+
module Rubicant::Tasks
|
|
7
|
+
class CscTask < Rake::TaskLib
|
|
8
|
+
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_accessor :target, :references, :out, :files, :debug
|
|
11
|
+
|
|
12
|
+
def initialize(name)
|
|
13
|
+
@name = name
|
|
14
|
+
@csc = "#{Rubicant::DotNet::Frameworks.get_framework.framework_dir}\\csc.exe"
|
|
15
|
+
yield self if block_given?
|
|
16
|
+
define
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def define
|
|
20
|
+
fail ('Debug can only be true or nil') if (@debug.nil? == false && !@debug)
|
|
21
|
+
task name do
|
|
22
|
+
Rubicant::Runner.run "#{build_command}"
|
|
23
|
+
end
|
|
24
|
+
self
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
def build_command
|
|
29
|
+
build_rsp
|
|
30
|
+
command = "#{@csc} @#{ENV['TEMP']}/csc.rsp"
|
|
31
|
+
#puts command
|
|
32
|
+
command
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def build_rsp
|
|
36
|
+
file = File.new("#{ENV['TEMP']}/csc.rsp", "w")
|
|
37
|
+
|
|
38
|
+
file.puts " /target:#{@target}" unless @target.nil?
|
|
39
|
+
file.puts " /reference:#{@references.join(';')}" unless @references.nil?
|
|
40
|
+
file.puts " /out:#{@out}" unless @out.nil?
|
|
41
|
+
file.puts " /debug:full" unless @debug.nil?
|
|
42
|
+
file.puts " #{@files.to_a.join(' ')}".gsub(/\//, "\\") unless @files.nil?
|
|
43
|
+
file.close
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require 'ftools'
|
|
4
|
+
|
|
5
|
+
module Rubicant::Tasks
|
|
6
|
+
class CopyFiles < Rake::TaskLib
|
|
7
|
+
|
|
8
|
+
attr_reader :name
|
|
9
|
+
attr_accessor :target_dir, :base_dir, :file_globs, :excludes
|
|
10
|
+
|
|
11
|
+
def initialize(name)
|
|
12
|
+
@name = name
|
|
13
|
+
yield self if block_given?
|
|
14
|
+
define
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def define
|
|
18
|
+
fail "Target directory must be defined (:target_dir)" if @target_dir.nil?
|
|
19
|
+
fail "Source files must be defined (:file_globs)" if @file_globs.nil?
|
|
20
|
+
fail "Base directory must be defined (:base_dir)" if @base_dir.nil?
|
|
21
|
+
@excludes = [] if @excludes.nil?
|
|
22
|
+
|
|
23
|
+
mkdir @target_dir unless (File.exists?(@target_dir))
|
|
24
|
+
|
|
25
|
+
files = FileList.new
|
|
26
|
+
@file_globs.each do |glob|
|
|
27
|
+
files.include("#{@base_dir}/#{glob}")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
@excludes.each do |exclude|
|
|
31
|
+
files.exclude(exclude)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
puts "Files are #{files}"
|
|
35
|
+
|
|
36
|
+
files.each do |filename|
|
|
37
|
+
target_dir_suffix = get_target_dir_suffix(filename)
|
|
38
|
+
targetName = File.join(@target_dir, target_dir_suffix)
|
|
39
|
+
file targetName do
|
|
40
|
+
if (File.directory?(filename))
|
|
41
|
+
mkdir_p targetName
|
|
42
|
+
else
|
|
43
|
+
puts "copying from #{filename} to #{targetName}"
|
|
44
|
+
cp filename, targetName
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
task @name => targetName
|
|
48
|
+
end
|
|
49
|
+
self
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def get_target_dir_suffix(file)
|
|
55
|
+
suffix = file[@base_dir.length..file.length-1]
|
|
56
|
+
puts "FileName is #{file}"
|
|
57
|
+
puts "Base dir is #{@base_dir}"
|
|
58
|
+
puts "Suffix is #{suffix}"
|
|
59
|
+
return suffix
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require File.dirname(__FILE__) + '/../facades'
|
|
4
|
+
|
|
5
|
+
module Rubicant::Tasks
|
|
6
|
+
|
|
7
|
+
class MbUnitTask < Rake::TaskLib
|
|
8
|
+
attr_reader :name
|
|
9
|
+
attr_accessor :mbunit_dir, :test_dir, :test_files, :assembly_path
|
|
10
|
+
attr_accessor :report_folder, :report_name_format, :report_type
|
|
11
|
+
attr_accessor :show_reports, :transform, :filter_category
|
|
12
|
+
attr_accessor :exclude_category, :filter_author, :filter_type
|
|
13
|
+
attr_accessor :filter_namespace, :verbose, :shadow_copy
|
|
14
|
+
|
|
15
|
+
def initialize(name)
|
|
16
|
+
@name = name
|
|
17
|
+
yield self if block_given?
|
|
18
|
+
define
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def define
|
|
22
|
+
fail ('mbunit_dir must be set') if (@mbunit_dir.nil?)
|
|
23
|
+
fail ('test_dir must be set') if (@test_dir.nil?)
|
|
24
|
+
fail ('test_files must be set') if (@test_files.nil?)
|
|
25
|
+
|
|
26
|
+
@mbunit_dir = "./" if @mbunit_dir.length == 0
|
|
27
|
+
@mbunit_dir = File.expand_path(@mbunit_dir)
|
|
28
|
+
|
|
29
|
+
exec_opts = {}
|
|
30
|
+
exec_opts.merge!({:working_dir => test_dir})
|
|
31
|
+
|
|
32
|
+
exec_args = []
|
|
33
|
+
exec_args << "/ap:#{@assembly_path.to_a.join(' /ap:')}" unless @assembly_path.nil?
|
|
34
|
+
exec_args << "/rf:#{@report_folder}" unless @report_folder.nil?
|
|
35
|
+
exec_args << "/rnf:#{@report_name_format}" unless @report_name_format.nil?
|
|
36
|
+
exec_args << "/rt:#{@report_type}" unless @report_type.nil?
|
|
37
|
+
exec_args << "/sr#{@show_reports}" unless @show_reports.nil?
|
|
38
|
+
exec_args << "/tr:#{@transform}" unless @transform.nil?
|
|
39
|
+
exec_args << "/fc:#{@filter_category}" unless @filter_category.nil?
|
|
40
|
+
exec_args << "/ec:#{@exclude_category}" unless @exclude_category.nil?
|
|
41
|
+
exec_args << "/fa:#{@filter_author}" unless @filter_author.nil?
|
|
42
|
+
exec_args << "/ft:#{@filter_type}" unless @filter_type.nil?
|
|
43
|
+
exec_args << "/fn:#{@filter_namespace}" unless @filter_namespace.nil?
|
|
44
|
+
exec_args << "/v#{@verbose}" unless @verbose.nil?
|
|
45
|
+
exec_args << "/sc#{@shadow_copy}" unless @shadow_copy.nil?
|
|
46
|
+
exec_args << @test_files.to_a.join(' ')
|
|
47
|
+
exec_opts.merge!({:args => exec_args})
|
|
48
|
+
|
|
49
|
+
task name do
|
|
50
|
+
copy_mbunit_files(@mbunit_dir, @test_dir)
|
|
51
|
+
Rubicant::Runner.exec("MbUnit.Cons.exe", exec_opts)
|
|
52
|
+
remove_mbunit_files(test_dir)
|
|
53
|
+
end
|
|
54
|
+
self
|
|
55
|
+
end
|
|
56
|
+
private
|
|
57
|
+
def copy_mbunit_files(mbunit_dir, test_dir)
|
|
58
|
+
required_mbunit_files.each do |file|
|
|
59
|
+
Rubicant::Files.copy("#{mbunit_dir}/#{file}", test_dir)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def remove_mbunit_files(test_dir)
|
|
64
|
+
required_mbunit_files.each do |file|
|
|
65
|
+
begin
|
|
66
|
+
Rubicant::Files.remove("#{test_dir}/#{file}")
|
|
67
|
+
rescue
|
|
68
|
+
#sometimes the mbunit files are still in use for some reason
|
|
69
|
+
sleep 1
|
|
70
|
+
Rubicant::Files.remove("#{test_dir}/#{file}")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
def required_mbunit_files()
|
|
75
|
+
return ["QuickGraph.dll", "QuickGraph.Algorithms.dll", "MbUnit.Framework.dll", "MbUnit.Cons.exe", "MbUnit.Cons.exe.config"]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
end
|
data/rakefile.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'rake/testtask'
|
|
4
|
+
require 'rake/rdoctask'
|
|
5
|
+
require 'lib/rubicant'
|
|
6
|
+
require 'rake/gempackagetask'
|
|
7
|
+
|
|
8
|
+
task :test do
|
|
9
|
+
require 'rake/runtest'
|
|
10
|
+
Rake.run_tests 'test/**/*.rb'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
spec = Gem::Specification.new do |s|
|
|
14
|
+
s.name = "Rubicant"
|
|
15
|
+
s.version = "0.0.1"
|
|
16
|
+
s.author = "mendicant"
|
|
17
|
+
s.email = "mendicant@beigesunshine.com"
|
|
18
|
+
s.homepage = "http://blog.beigesunshine.com"
|
|
19
|
+
s.platform = Gem::Platform::RUBY
|
|
20
|
+
s.summary = ".Net Build Framework in Ruby"
|
|
21
|
+
s.files = FileList["lib/**/*"].to_a
|
|
22
|
+
s.require_path = "lib"
|
|
23
|
+
s.autorequire = "rubicant"
|
|
24
|
+
s.test_files = FileList["test/**/when*.rb"].to_a
|
|
25
|
+
s.has_rdoc = false
|
|
26
|
+
s.extra_rdoc_files = []
|
|
27
|
+
s.add_dependency("configatron", ">= 2.1.6")
|
|
28
|
+
s.add_dependency("rake", ">= 0.8.3")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
|
32
|
+
pkg.need_zip = true
|
|
33
|
+
pkg.need_tar = true
|
|
34
|
+
end
|
data/rubicant.gemspec
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Gem::Specification.new do |s|
|
|
2
|
+
s.name = "rubicant"
|
|
3
|
+
s.version = "0.0.1"
|
|
4
|
+
s.author = "mendicant"
|
|
5
|
+
s.email = "mendicant@beigesunshine.com"
|
|
6
|
+
s.homepage = "http://blog.beigesunshine.com"
|
|
7
|
+
s.summary = ".Net Build Framework in Ruby"
|
|
8
|
+
s.files = ["lib/facades.rb",
|
|
9
|
+
"lib/dotnet",
|
|
10
|
+
"lib/dotnet/frameworks.yml",
|
|
11
|
+
"lib/dotnet/framework.rb",
|
|
12
|
+
"lib/tasks",
|
|
13
|
+
"lib/tasks/test_tasks.rb",
|
|
14
|
+
"lib/tasks/compiler_tasks.rb",
|
|
15
|
+
"lib/tasks/file_tasks.rb",
|
|
16
|
+
"lib/rubicant.rb",
|
|
17
|
+
"rubicant.gemspec",
|
|
18
|
+
"rakefile.rb"]
|
|
19
|
+
s.require_path = "lib"
|
|
20
|
+
s.autorequire = "rubicant"
|
|
21
|
+
s.test_files = ["test/unit",
|
|
22
|
+
"test/unit/dotnet",
|
|
23
|
+
"test/unit/dotnet/when_creating_new_framework.rb",
|
|
24
|
+
"test/unit/dotnet/when_getting_framework_information.rb",
|
|
25
|
+
"test/unit/tasks",
|
|
26
|
+
"test/unit/tasks/when_calling_csc_task.rb",
|
|
27
|
+
"test/unit/tasks/when_calling_mb_unit_task.rb",
|
|
28
|
+
"test/unit/tasks/when_calling_copyfiles_task.rb"]
|
|
29
|
+
s.has_rdoc = false
|
|
30
|
+
s.extra_rdoc_files = []
|
|
31
|
+
s.add_dependency("configatron", ">= 2.1.6")
|
|
32
|
+
s.add_dependency("rake", ">= 0.8.3")
|
|
33
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
require "test/unit"
|
|
2
|
+
|
|
3
|
+
class WhenCreatingNewFramework < Test::Unit::TestCase
|
|
4
|
+
|
|
5
|
+
def setup
|
|
6
|
+
@framework_path = 'framework_path'
|
|
7
|
+
@framework_sdk_path = 'framework_sdk_path'
|
|
8
|
+
@framework_version = 'framework_version'
|
|
9
|
+
@framework_key = 'framework_key'
|
|
10
|
+
@framework_sdk_key = 'framework_sdk_key'
|
|
11
|
+
@framework_config = StubbedFrameworkConfig.new(@framework_path, @framework_sdk_path, @framework_key, @framework_sdk_key, @framework_version)
|
|
12
|
+
@framework_dir = 'framework_dir'
|
|
13
|
+
@framework_sdk_dir = 'framework_sdk_dir'
|
|
14
|
+
@reg_path = mock()
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_should_load_framework_dir_from_registry
|
|
18
|
+
|
|
19
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.expects(:open).with(@framework_path).returns(@reg_path)
|
|
20
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.stubs(:open).with(@framework_sdk_path).returns(@reg_path)
|
|
21
|
+
@reg_path.expects(:read_s).with(@framework_key).returns(@framework_key)
|
|
22
|
+
@reg_path.stubs(:read_s).with(@framework_sdk_key).returns(@framework_sdk_key)
|
|
23
|
+
|
|
24
|
+
Rubicant::DotNet::Framework.new(@framework_config)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def test_should_load_framework_sdk_dir_from_registry
|
|
28
|
+
|
|
29
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.expects(:open).with(@framework_path).returns(@reg_path)
|
|
30
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.stubs(:open).with(@framework_sdk_path).returns(@reg_path)
|
|
31
|
+
@reg_path.stubs(:read_s).with(@framework_key).returns(@framework_key)
|
|
32
|
+
@reg_path.expects(:read_s).with(@framework_sdk_key).returns(@framework_sdk_key)
|
|
33
|
+
|
|
34
|
+
Rubicant::DotNet::Framework.new(@framework_config)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_should_get_values_loaded_from_registry_from_created_framework
|
|
38
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.stubs(:open).with(@framework_path).returns(@reg_path)
|
|
39
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.stubs(:open).with(@framework_sdk_path).returns(@reg_path)
|
|
40
|
+
@reg_path.stubs(:read_s).with(@framework_key).returns(@framework_dir)
|
|
41
|
+
@reg_path.stubs(:read_s).with(@framework_sdk_key).returns(@framework_sdk_dir)
|
|
42
|
+
|
|
43
|
+
result = Rubicant::DotNet::Framework.new(@framework_config)
|
|
44
|
+
assert_equal "#{@framework_dir}\\#{@framework_version}", result.framework_dir
|
|
45
|
+
assert_equal @framework_sdk_dir, result.sdk_dir
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
class StubbedFrameworkConfig
|
|
51
|
+
attr_reader :framework_registry_key, :framework_sdk_registry_key, :framework_registry_path, :framework_sdk_registry_path, :framework_version
|
|
52
|
+
|
|
53
|
+
def initialize(framework_registry_path, framework_sdk_registry_path, framework_key, framework_sdk_key, framework_version)
|
|
54
|
+
@framework_registry_path = framework_registry_path
|
|
55
|
+
@framework_sdk_registry_path = framework_sdk_registry_path
|
|
56
|
+
@framework_registry_key = framework_key
|
|
57
|
+
@framework_sdk_registry_key = framework_sdk_key
|
|
58
|
+
@framework_version = framework_version
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/dotnet/framework'
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'mocha'
|
|
4
|
+
|
|
5
|
+
class WhenGettingFrameworkInformation < Test::Unit::TestCase
|
|
6
|
+
|
|
7
|
+
def test_should_load_frameworks_if_not_already_loaded
|
|
8
|
+
framework = 'framework'
|
|
9
|
+
ENV['framework'] = framework
|
|
10
|
+
configatron.frameworks.stubs(:nil?).returns(true)
|
|
11
|
+
configatron.expects(:configure_from_yaml)
|
|
12
|
+
configatron.frameworks.stubs(:retrieve).with(framework).returns({framework => {}})
|
|
13
|
+
Rubicant::DotNet::Framework.stubs(:new).returns(mock())
|
|
14
|
+
|
|
15
|
+
Rubicant::DotNet::Frameworks.get_framework()
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_should_fail_if_requested_framework_is_not_in_configuration
|
|
20
|
+
begin
|
|
21
|
+
framework = 'framework'
|
|
22
|
+
ENV['framework'] = framework
|
|
23
|
+
configatron.frameworks.stubs(:nil?).returns(false)
|
|
24
|
+
configatron.frameworks.stubs(:retrieve).with(framework).returns(nil)
|
|
25
|
+
|
|
26
|
+
Rubicant::DotNet::Frameworks.get_framework()
|
|
27
|
+
|
|
28
|
+
fail('I wanted a runtime error to be thrown')
|
|
29
|
+
rescue RuntimeError => re
|
|
30
|
+
assert_equal(re.message, 'Requested framework does not exist in configuration')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_should_get_back_framework_if_exists_in_configuration
|
|
36
|
+
framework = mock()
|
|
37
|
+
frameworkName = 'framework'
|
|
38
|
+
ENV['framework'] = frameworkName
|
|
39
|
+
frameworkConfiguration = {frameworkName => {}}
|
|
40
|
+
|
|
41
|
+
configatron.frameworks.stubs(:nil?).returns(false)
|
|
42
|
+
configatron.frameworks.stubs(:retrieve).with(frameworkName).returns(frameworkConfiguration)
|
|
43
|
+
|
|
44
|
+
Rubicant::DotNet::Framework.expects(:new).with(frameworkConfiguration).returns(framework)
|
|
45
|
+
|
|
46
|
+
result = Rubicant::DotNet::Frameworks.get_framework()
|
|
47
|
+
assert_equal framework, result
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_should_default_to_net35_if_no_framework_specified
|
|
52
|
+
framework = mock()
|
|
53
|
+
ENV['framework'] = nil
|
|
54
|
+
frameworkConfiguration = {'net35' => {}}
|
|
55
|
+
|
|
56
|
+
configatron.frameworks.stubs(:nil?).returns(false)
|
|
57
|
+
configatron.frameworks.expects(:retrieve).with('net35').returns(frameworkConfiguration)
|
|
58
|
+
frameworkConfiguration.stubs(:nil?).returns(false)
|
|
59
|
+
Rubicant::DotNet::Framework.stubs(:new).with(frameworkConfiguration).returns(framework)
|
|
60
|
+
|
|
61
|
+
Rubicant::DotNet::Frameworks.get_framework()
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/tasks/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
|
+
Rubicant::Tasks::CopyFiles.new('cf1')
|
|
11
|
+
Rake.application['cf1'].invoke
|
|
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
|
+
Rubicant::Tasks::CopyFiles.new('cf2') do |cf|
|
|
23
|
+
cf.target_dir = "target_dir"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
Rake.application['cf2'].invoke
|
|
27
|
+
|
|
28
|
+
assert.fail('Should get RuntimeError requiring target')
|
|
29
|
+
|
|
30
|
+
rescue RuntimeError => re
|
|
31
|
+
assert_equal('Source files must be defined (:file_globs)', re.message)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_should_fail_when_calling_copyfiles_without_base_dir_parameter
|
|
36
|
+
begin
|
|
37
|
+
Rubicant::Tasks::CopyFiles.new('cf3') do |cf|
|
|
38
|
+
cf.target_dir = "target_dir"
|
|
39
|
+
cf.file_globs = "**/*"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Rake.application['cf3'].invoke
|
|
43
|
+
|
|
44
|
+
assert.fail('Should get RuntimeError requiring target')
|
|
45
|
+
|
|
46
|
+
rescue RuntimeError => re
|
|
47
|
+
assert_equal('Base directory must be defined (:base_dir)', re.message)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/tasks/compiler_tasks'
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'mocha'
|
|
4
|
+
require File.dirname(__FILE__) + '/../../../lib/facades'
|
|
5
|
+
|
|
6
|
+
class WhenCallingCscTask < Test::Unit::TestCase
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def setup
|
|
10
|
+
@frameworkDir = 'frameworkDir'
|
|
11
|
+
@framework = mock()
|
|
12
|
+
@framework.stubs(:framework_dir).returns(@frameworkDir)
|
|
13
|
+
Rubicant::DotNet::Frameworks.expects(:get_framework).returns(@framework)
|
|
14
|
+
@rsp_file = "@#{ENV['TEMP']}/csc.rsp"
|
|
15
|
+
Rubicant::Runner.expects(:sh).with("frameworkDir\\csc.exe #{@rsp_file}")
|
|
16
|
+
|
|
17
|
+
@mock_file = mock()
|
|
18
|
+
File.stubs(:new).with("#{ENV['TEMP']}/csc.rsp", "w").returns(@mock_file)
|
|
19
|
+
@mock_file.stubs(:close)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def test_should_call_csc_with_rsp_file_even_with_no_parameters
|
|
23
|
+
|
|
24
|
+
Rubicant::Tasks::CscTask.new('csc')
|
|
25
|
+
Rake.application['csc'].invoke
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def test_should_call_csc_with_target_parameter
|
|
29
|
+
target = 'library'
|
|
30
|
+
|
|
31
|
+
@mock_file.expects(:puts).with(" /target:#{target}")
|
|
32
|
+
Rubicant::Tasks::CscTask.new('csc2') do |csc|
|
|
33
|
+
csc.target = target
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Rake.application['csc2'].invoke
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_should_call_csc_with_reference_parameter
|
|
40
|
+
foo = 'foo.dll'
|
|
41
|
+
bar = 'bar.dll'
|
|
42
|
+
|
|
43
|
+
@mock_file.expects(:puts).with(" /reference:#{foo};#{bar}")
|
|
44
|
+
|
|
45
|
+
Rubicant::Tasks::CscTask.new('csc3') do |csc|
|
|
46
|
+
csc.references = [foo, bar]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Rake.application['csc3'].invoke
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def test_should_call_csc_with_out_parameter
|
|
53
|
+
out = "outfile.dll"
|
|
54
|
+
|
|
55
|
+
@mock_file.expects(:puts).with(" /out:#{out}")
|
|
56
|
+
Rubicant::Tasks::CscTask.new('csc4') do |csc|
|
|
57
|
+
csc.out = out
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
Rake.application['csc4'].invoke
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def test_should_call_csc_with_files
|
|
64
|
+
foo = 'foo.cs'
|
|
65
|
+
bar = 'bar.cs'
|
|
66
|
+
@mock_file.expects(:puts).with(" #{foo} #{bar}")
|
|
67
|
+
Rubicant::Tasks::CscTask.new('csc5') do |csc|
|
|
68
|
+
csc.files = [foo, bar]
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Rake.application['csc5'].invoke
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_should_call_csc_with_debug
|
|
75
|
+
|
|
76
|
+
@mock_file.expects(:puts).with(" /debug:full")
|
|
77
|
+
Rubicant::Tasks::CscTask.new('csc6') do |csc|
|
|
78
|
+
csc.debug = true
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Rake.application['csc6'].invoke
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
|
85
|
+
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../../lib/tasks/test_tasks'
|
|
2
|
+
require 'test/unit'
|
|
3
|
+
require 'mocha'
|
|
4
|
+
require File.dirname(__FILE__) + '/../../../lib/facades'
|
|
5
|
+
|
|
6
|
+
class WhenCallingMbUnitTask < Test::Unit::TestCase
|
|
7
|
+
|
|
8
|
+
def setup
|
|
9
|
+
@mbunit_dir = "./"
|
|
10
|
+
@full_mbunit_dir = "#{File.expand_path(@mbunit_dir)}/"
|
|
11
|
+
@test_files = "test.dll"
|
|
12
|
+
@test_dir = "./test"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def test_should_fail_if_mbunit_dir_not_set
|
|
16
|
+
begin
|
|
17
|
+
Rubicant::Tasks::MbUnitTask.new('mb1')
|
|
18
|
+
Rake.application['mb1'].invoke
|
|
19
|
+
|
|
20
|
+
rescue RuntimeError => re
|
|
21
|
+
assert_equal('mbunit_dir must be set', re.message)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_should_fail_if_test_dir_not_set
|
|
26
|
+
begin
|
|
27
|
+
Rubicant::Tasks::MbUnitTask.new('mb2') do |mb|
|
|
28
|
+
mb.mbunit_dir = @mbunit_dir
|
|
29
|
+
end
|
|
30
|
+
Rake.application['mb2'].invoke
|
|
31
|
+
|
|
32
|
+
rescue RuntimeError => re
|
|
33
|
+
assert_equal('test_dir must be set', re.message)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_should_fail_if_test_files_not_set
|
|
38
|
+
begin
|
|
39
|
+
Rubicant::Tasks::MbUnitTask.new('mb3') do |mb|
|
|
40
|
+
mb.mbunit_dir = @mbunit_dir
|
|
41
|
+
mb.test_dir = @test_dir
|
|
42
|
+
end
|
|
43
|
+
Rake.application['mb3'].invoke
|
|
44
|
+
|
|
45
|
+
rescue RuntimeError => re
|
|
46
|
+
assert_equal('test_files must be set', re.message)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_should_append_slash_if_mbunit_dir_doesnt_end_with_one
|
|
51
|
+
Rubicant::Files.stubs(:copy)
|
|
52
|
+
Rubicant::Files.stubs(:remove)
|
|
53
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe #{@test_files}")
|
|
54
|
+
|
|
55
|
+
Rubicant::Tasks::MbUnitTask.new('mb4') do |mb|
|
|
56
|
+
mb.mbunit_dir = "."
|
|
57
|
+
mb.test_dir = @test_dir
|
|
58
|
+
mb.test_files = @test_files
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
Rake.application['mb4'].invoke
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def test_should_set_mbunit_to_current_dir_if_mbunit_dir_empty
|
|
65
|
+
Rubicant::Files.stubs(:copy)
|
|
66
|
+
Rubicant::Files.stubs(:remove)
|
|
67
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe #{@test_files}")
|
|
68
|
+
|
|
69
|
+
Rubicant::Tasks::MbUnitTask.new('mb5') do |mb|
|
|
70
|
+
mb.mbunit_dir = ""
|
|
71
|
+
mb.test_dir = @test_dir
|
|
72
|
+
mb.test_files = @test_files
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
Rake.application['mb5'].invoke
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def test_should_set_a_single_assembly_path
|
|
79
|
+
Rubicant::Files.stubs(:copy)
|
|
80
|
+
Rubicant::Files.stubs(:remove)
|
|
81
|
+
dll = "dll1.dll"
|
|
82
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /ap:#{dll} #{@test_files}")
|
|
83
|
+
Rubicant::Tasks::MbUnitTask.new('mb6') do |mb|
|
|
84
|
+
mb.mbunit_dir = @mbunit_dir
|
|
85
|
+
mb.test_dir = @test_dir
|
|
86
|
+
mb.test_files = @test_files
|
|
87
|
+
mb.assembly_path = FileList[dll]
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
Rake.application['mb6'].invoke
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_should_set_multiple_assembly_paths
|
|
94
|
+
Rubicant::Files.stubs(:copy)
|
|
95
|
+
Rubicant::Files.stubs(:remove)
|
|
96
|
+
dll1 = "dll1.dll"
|
|
97
|
+
dll2 = "dll2.dll"
|
|
98
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /ap:#{dll1} /ap:#{dll2} #{@test_files}")
|
|
99
|
+
|
|
100
|
+
Rubicant::Tasks::MbUnitTask.new('mb7') do |mb|
|
|
101
|
+
mb.mbunit_dir = @mbunit_dir
|
|
102
|
+
mb.test_dir = @test_dir
|
|
103
|
+
mb.test_files = @test_files
|
|
104
|
+
mb.assembly_path = FileList[dll1, dll2]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
Rake.application['mb7'].invoke
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def test_should_set_report_folder
|
|
111
|
+
Rubicant::Files.stubs(:copy)
|
|
112
|
+
Rubicant::Files.stubs(:remove)
|
|
113
|
+
report_folder = "./reports"
|
|
114
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /rf:#{report_folder} #{@test_files}")
|
|
115
|
+
|
|
116
|
+
Rubicant::Tasks::MbUnitTask.new('mb21') do |mb|
|
|
117
|
+
mb.mbunit_dir = @mbunit_dir
|
|
118
|
+
mb.test_dir = @test_dir
|
|
119
|
+
mb.test_files = @test_files
|
|
120
|
+
mb.report_folder = report_folder
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
Rake.application['mb21'].invoke
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def test_should_set_report_name_format
|
|
127
|
+
Rubicant::Files.stubs(:copy)
|
|
128
|
+
Rubicant::Files.stubs(:remove)
|
|
129
|
+
report_format = "format{0}"
|
|
130
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /rnf:#{report_format} #{@test_files}")
|
|
131
|
+
|
|
132
|
+
Rubicant::Tasks::MbUnitTask.new('mb8') do |mb|
|
|
133
|
+
mb.mbunit_dir = @mbunit_dir
|
|
134
|
+
mb.test_dir = @test_dir
|
|
135
|
+
mb.test_files = @test_files
|
|
136
|
+
mb.report_name_format = report_format
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
Rake.application['mb8'].invoke
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def test_should_set_report_type
|
|
143
|
+
Rubicant::Files.stubs(:copy)
|
|
144
|
+
Rubicant::Files.stubs(:remove)
|
|
145
|
+
report_type = "xml"
|
|
146
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /rt:#{report_type} #{@test_files}")
|
|
147
|
+
Rubicant::Tasks::MbUnitTask.new('mb9') do |mb|
|
|
148
|
+
mb.mbunit_dir = @mbunit_dir
|
|
149
|
+
mb.test_dir = @test_dir
|
|
150
|
+
mb.test_files = @test_files
|
|
151
|
+
mb.report_type = report_type
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
Rake.application['mb9'].invoke
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def test_should_set_show_reports
|
|
158
|
+
Rubicant::Files.stubs(:copy)
|
|
159
|
+
Rubicant::Files.stubs(:remove)
|
|
160
|
+
show_reports = "+"
|
|
161
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /sr#{show_reports} #{@test_files}")
|
|
162
|
+
Rubicant::Tasks::MbUnitTask.new('mb10') do |mb|
|
|
163
|
+
mb.mbunit_dir = @mbunit_dir
|
|
164
|
+
mb.test_dir = @test_dir
|
|
165
|
+
mb.test_files = @test_files
|
|
166
|
+
mb.show_reports = show_reports
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
Rake.application['mb10'].invoke
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def test_should_set_transform
|
|
173
|
+
Rubicant::Files.stubs(:copy)
|
|
174
|
+
Rubicant::Files.stubs(:remove)
|
|
175
|
+
transform = "transform"
|
|
176
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /tr:#{transform} #{@test_files}")
|
|
177
|
+
Rubicant::Tasks::MbUnitTask.new('mb11') do |mb|
|
|
178
|
+
mb.mbunit_dir = @mbunit_dir
|
|
179
|
+
mb.test_dir = @test_dir
|
|
180
|
+
mb.test_files = @test_files
|
|
181
|
+
mb.transform = transform
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
Rake.application['mb11'].invoke
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
def test_should_set_filter_category
|
|
188
|
+
Rubicant::Files.stubs(:copy)
|
|
189
|
+
Rubicant::Files.stubs(:remove)
|
|
190
|
+
filter_category = "filter_category"
|
|
191
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /fc:#{filter_category} #{@test_files}")
|
|
192
|
+
Rubicant::Tasks::MbUnitTask.new('mb12') do |mb|
|
|
193
|
+
mb.mbunit_dir = @mbunit_dir
|
|
194
|
+
mb.test_dir = @test_dir
|
|
195
|
+
mb.test_files = @test_files
|
|
196
|
+
mb.filter_category = filter_category
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
Rake.application['mb12'].invoke
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def test_should_set_exclude_category
|
|
203
|
+
Rubicant::Files.stubs(:copy)
|
|
204
|
+
Rubicant::Files.stubs(:remove)
|
|
205
|
+
exclude_category = "exclude_category"
|
|
206
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /ec:#{exclude_category} #{@test_files}")
|
|
207
|
+
Rubicant::Tasks::MbUnitTask.new('mb13') do |mb|
|
|
208
|
+
mb.mbunit_dir = @mbunit_dir
|
|
209
|
+
mb.test_dir = @test_dir
|
|
210
|
+
mb.test_files = @test_files
|
|
211
|
+
mb.exclude_category = exclude_category
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
Rake.application['mb13'].invoke
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def test_should_set_filter_author
|
|
218
|
+
Rubicant::Files.stubs(:copy)
|
|
219
|
+
Rubicant::Files.stubs(:remove)
|
|
220
|
+
filter_author = "filter_author"
|
|
221
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /fa:#{filter_author} #{@test_files}")
|
|
222
|
+
Rubicant::Tasks::MbUnitTask.new('mb14') do |mb|
|
|
223
|
+
mb.mbunit_dir = @mbunit_dir
|
|
224
|
+
mb.test_dir = @test_dir
|
|
225
|
+
mb.test_files = @test_files
|
|
226
|
+
mb.filter_author = filter_author
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
Rake.application['mb14'].invoke
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
def test_should_set_filter_namespace
|
|
233
|
+
Rubicant::Files.stubs(:copy)
|
|
234
|
+
Rubicant::Files.stubs(:remove)
|
|
235
|
+
filter_namespace = "filter_namespace"
|
|
236
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /fn:#{filter_namespace} #{@test_files}")
|
|
237
|
+
Rubicant::Tasks::MbUnitTask.new('mb15') do |mb|
|
|
238
|
+
mb.mbunit_dir = @mbunit_dir
|
|
239
|
+
mb.test_dir = @test_dir
|
|
240
|
+
mb.test_files = @test_files
|
|
241
|
+
mb.filter_namespace = filter_namespace
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
Rake.application['mb15'].invoke
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
def test_should_set_verbose
|
|
248
|
+
Rubicant::Files.stubs(:copy)
|
|
249
|
+
Rubicant::Files.stubs(:remove)
|
|
250
|
+
verbose ="verbose"
|
|
251
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /v#{verbose} #{@test_files}")
|
|
252
|
+
Rubicant::Tasks::MbUnitTask.new('mb16') do |mb|
|
|
253
|
+
mb.mbunit_dir = @mbunit_dir
|
|
254
|
+
mb.test_dir = @test_dir
|
|
255
|
+
mb.test_files = @test_files
|
|
256
|
+
mb.verbose = verbose
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
Rake.application['mb16'].invoke
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def test_should_set_shadow_copy
|
|
263
|
+
Rubicant::Files.stubs(:copy)
|
|
264
|
+
Rubicant::Files.stubs(:remove)
|
|
265
|
+
shadow_copy = "shadow_copy"
|
|
266
|
+
Rubicant::Runner.expects(:run).with("MbUnit.Cons.exe /sc#{shadow_copy} #{@test_files}")
|
|
267
|
+
Rubicant::Tasks::MbUnitTask.new('mb17') do |mb|
|
|
268
|
+
mb.mbunit_dir = @mbunit_dir
|
|
269
|
+
mb.test_dir = @test_dir
|
|
270
|
+
mb.test_files = @test_files
|
|
271
|
+
mb.shadow_copy = shadow_copy
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
Rake.application['mb17'].invoke
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def test_should_copy_mbunit_files_when_run
|
|
278
|
+
Rubicant::Files.expects(:copy).with("#{@full_mbunit_dir}QuickGraph.dll", @test_dir)
|
|
279
|
+
Rubicant::Files.expects(:copy).with("#{@full_mbunit_dir}QuickGraph.Algorithms.dll", @test_dir)
|
|
280
|
+
Rubicant::Files.expects(:copy).with("#{@full_mbunit_dir}MbUnit.Framework.dll", @test_dir)
|
|
281
|
+
Rubicant::Files.expects(:copy).with("#{@full_mbunit_dir}MbUnit.Cons.exe", @test_dir)
|
|
282
|
+
Rubicant::Files.expects(:copy).with("#{@full_mbunit_dir}MbUnit.Cons.exe.config", @test_dir)
|
|
283
|
+
Rubicant::Files.stubs(:remove)
|
|
284
|
+
Rubicant::Runner.stubs(:run)
|
|
285
|
+
Rubicant::Tasks::MbUnitTask.new('mb18') do |mb|
|
|
286
|
+
mb.mbunit_dir = @mbunit_dir
|
|
287
|
+
mb.test_dir = @test_dir
|
|
288
|
+
mb.test_files = @test_files
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
Rake.application['mb18'].invoke
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def test_should_remove_mbunit_files_when_done
|
|
295
|
+
Rubicant::Files.expects(:remove).with("#{@test_dir}/QuickGraph.dll")
|
|
296
|
+
Rubicant::Files.expects(:remove).with("#{@test_dir}/QuickGraph.Algorithms.dll")
|
|
297
|
+
Rubicant::Files.expects(:remove).with("#{@test_dir}/MbUnit.Framework.dll")
|
|
298
|
+
Rubicant::Files.expects(:remove).with("#{@test_dir}/MbUnit.Cons.exe")
|
|
299
|
+
Rubicant::Files.expects(:remove).with("#{@test_dir}/MbUnit.Cons.exe.config")
|
|
300
|
+
Rubicant::Files.stubs(:copy)
|
|
301
|
+
Rubicant::Runner.stubs(:run)
|
|
302
|
+
Rubicant::Tasks::MbUnitTask.new('mb19') do |mb|
|
|
303
|
+
mb.mbunit_dir = @mbunit_dir
|
|
304
|
+
mb.test_dir = @test_dir
|
|
305
|
+
mb.test_files = @test_files
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
Rake.application['mb19'].invoke
|
|
309
|
+
end
|
|
310
|
+
|
|
311
|
+
def test_should_change_working_directory_to_test_directory
|
|
312
|
+
Rubicant::Files.stubs(:copy)
|
|
313
|
+
Rubicant::Files.stubs(:remove)
|
|
314
|
+
Rubicant::Runner.stubs(:run)
|
|
315
|
+
Dir.expects(:chdir).with(@test_dir)
|
|
316
|
+
Rubicant::Tasks::MbUnitTask.new('mb20') do |mb|
|
|
317
|
+
mb.mbunit_dir = @mbunit_dir
|
|
318
|
+
mb.test_dir = @test_dir
|
|
319
|
+
mb.test_files = @test_files
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
Rake.application['mb20'].invoke
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mendicantx-rubicant
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mendicant
|
|
8
|
+
autorequire: rubicant
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-01-11 00:00:00 -08:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: configatron
|
|
17
|
+
version_requirement:
|
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
19
|
+
requirements:
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 2.1.6
|
|
23
|
+
version:
|
|
24
|
+
- !ruby/object:Gem::Dependency
|
|
25
|
+
name: rake
|
|
26
|
+
version_requirement:
|
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
28
|
+
requirements:
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.8.3
|
|
32
|
+
version:
|
|
33
|
+
description:
|
|
34
|
+
email: mendicant@beigesunshine.com
|
|
35
|
+
executables: []
|
|
36
|
+
|
|
37
|
+
extensions: []
|
|
38
|
+
|
|
39
|
+
extra_rdoc_files: []
|
|
40
|
+
|
|
41
|
+
files:
|
|
42
|
+
- lib/facades.rb
|
|
43
|
+
- lib/dotnet
|
|
44
|
+
- lib/dotnet/frameworks.yml
|
|
45
|
+
- lib/dotnet/framework.rb
|
|
46
|
+
- lib/tasks
|
|
47
|
+
- lib/tasks/test_tasks.rb
|
|
48
|
+
- lib/tasks/compiler_tasks.rb
|
|
49
|
+
- lib/tasks/file_tasks.rb
|
|
50
|
+
- lib/rubicant.rb
|
|
51
|
+
- rubicant.gemspec
|
|
52
|
+
- rakefile.rb
|
|
53
|
+
has_rdoc: false
|
|
54
|
+
homepage: http://blog.beigesunshine.com
|
|
55
|
+
post_install_message:
|
|
56
|
+
rdoc_options: []
|
|
57
|
+
|
|
58
|
+
require_paths:
|
|
59
|
+
- lib
|
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
|
+
requirements:
|
|
62
|
+
- - ">="
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: "0"
|
|
65
|
+
version:
|
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: "0"
|
|
71
|
+
version:
|
|
72
|
+
requirements: []
|
|
73
|
+
|
|
74
|
+
rubyforge_project:
|
|
75
|
+
rubygems_version: 1.2.0
|
|
76
|
+
signing_key:
|
|
77
|
+
specification_version: 2
|
|
78
|
+
summary: .Net Build Framework in Ruby
|
|
79
|
+
test_files:
|
|
80
|
+
- test/unit
|
|
81
|
+
- test/unit/dotnet
|
|
82
|
+
- test/unit/dotnet/when_creating_new_framework.rb
|
|
83
|
+
- test/unit/dotnet/when_getting_framework_information.rb
|
|
84
|
+
- test/unit/tasks
|
|
85
|
+
- test/unit/tasks/when_calling_csc_task.rb
|
|
86
|
+
- test/unit/tasks/when_calling_mb_unit_task.rb
|
|
87
|
+
- test/unit/tasks/when_calling_copyfiles_task.rb
|