fuburake 0.9.5.37 → 1.0.0.38

Sign up to get free protection for your applications and to get access to all the features.
data/lib/msbuild.rb CHANGED
@@ -1,83 +1,84 @@
1
+ # vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
1
2
  module FubuRake
2
- class MSBuild
3
- def self.create_task(tasks, options)
4
- if tasks.compile == nil
5
- return nil
6
- end
3
+ class MSBuild
4
+ def self.create_task(tasks, options)
5
+ if tasks.compile == nil
6
+ return nil
7
+ end
7
8
 
8
- compileTask = Rake::Task.define_task :compile do
9
- MSBuildRunner.compile options.merge(tasks.compile)
10
- end
9
+ compileTask = Rake::Task.define_task :compile do
10
+ MSBuildRunner.compile options.merge(tasks.compile)
11
+ end
11
12
 
12
- compileTask.add_description "Compiles the solution #{tasks.compile[:solutionfile]}"
13
+ compileTask.add_description "Compiles the solution #{tasks.compile[:solutionfile]}"
13
14
 
14
- openTask = Rake::Task.define_task :sln do
15
- sh "start #{tasks.compile[:solutionfile]}"
16
- end
17
- openTask.add_description "Open solution #{tasks.compile[:solutionfile]}"
15
+ openTask = Rake::Task.define_task :sln do
16
+ Platform.open("#{tasks.compile[:solutionfile]}")
17
+ end
18
+ openTask.add_description "Open solution #{tasks.compile[:solutionfile]}"
18
19
 
19
- return compileTask
20
+ return compileTask
21
+ end
20
22
  end
21
- end
22
23
 
23
- class CompileTarget
24
- def initialize(name, solution)
25
- @name = name
26
- @solution = solution
27
- end
24
+ class CompileTarget
25
+ def initialize(name, solution)
26
+ @name = name
27
+ @solution = solution
28
+ end
28
29
 
29
- def create(options)
30
- compileTask = Rake::Task.define_task @name do
31
- MSBuildRunner.compile options.merge({:solutionfile => @solution})
32
- end
30
+ def create(options)
31
+ compileTask = Rake::Task.define_task @name do
32
+ MSBuildRunner.compile options.merge({:solutionfile => @solution})
33
+ end
33
34
 
34
- compileTask.add_description "Compiles #{@solution}"
35
+ compileTask.add_description "Compiles #{@solution}"
36
+ end
35
37
  end
36
- end
37
38
  end
38
39
 
39
40
 
40
41
  class MSBuildRunner
41
42
  def self.compile(attributes)
42
- compileTarget = attributes.fetch(:compilemode, 'debug')
43
- solutionFile = attributes[:solutionfile]
44
-
45
- attributes[:projFile] = solutionFile
46
- attributes[:properties] ||= []
47
- attributes[:properties] << "Configuration=#{compileTarget}"
48
- attributes[:extraSwitches] = ["v:m", "t:rebuild"]
43
+ compileTarget = attributes.fetch(:compilemode, 'Debug')
44
+ solutionFile = attributes[:solutionfile]
45
+
46
+ attributes[:projFile] = solutionFile
47
+ attributes[:properties] ||= []
48
+ attributes[:properties] << "Configuration=#{compileTarget}"
49
+ attributes[:extraSwitches] = ["v:m", "t:rebuild"]
49
50
  attributes[:extraSwitches] << "maxcpucount:2" unless Platform.is_nix
50
51
 
51
- self.runProjFile(attributes);
52
+ self.runProjFile(attributes);
52
53
  end
53
-
54
+
54
55
  def self.runProjFile(attributes)
55
56
  version = attributes.fetch(:clrversion, 'v4.0.30319')
56
57
  compileTarget = attributes.fetch(:compilemode, 'debug')
57
- projFile = attributes[:projFile]
58
-
59
- if Platform.is_nix
60
- msbuildFile = `which xbuild`.chop
61
- attributes[:properties] << "TargetFrameworkProfile="""""
62
- else
63
- frameworkDir = File.join(ENV['windir'].dup, 'Microsoft.NET', 'Framework', version)
64
- msbuildFile = File.join(frameworkDir, 'msbuild.exe')
65
- end
58
+ projFile = attributes[:projFile]
59
+
60
+ if Platform.is_nix
61
+ msbuildFile = `which xbuild`.chop
62
+ attributes[:properties] << "TargetFrameworkProfile="""""
63
+ else
64
+ frameworkDir = File.join(ENV['windir'].dup, 'Microsoft.NET', 'Framework', version)
65
+ msbuildFile = File.join(frameworkDir, 'msbuild.exe')
66
+ end
67
+
68
+ properties = attributes.fetch(:properties, [])
66
69
 
67
- properties = attributes.fetch(:properties, [])
68
-
69
70
  switchesValue = ""
70
-
71
+
71
72
  properties.each do |prop|
72
73
  switchesValue += " /property:#{prop}"
73
- end
74
-
75
- extraSwitches = attributes.fetch(:extraSwitches, [])
76
-
74
+ end
75
+
76
+ extraSwitches = attributes.fetch(:extraSwitches, [])
77
+
77
78
  extraSwitches.each do |switch|
78
79
  switchesValue += " /#{switch}"
79
- end
80
-
80
+ end
81
+
81
82
  targets = attributes.fetch(:targets, [])
82
83
  targetsValue = ""
83
84
  targets.each do |target|
data/lib/nuget.rb CHANGED
@@ -1,25 +1,25 @@
1
+ # vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
1
2
  module Nuget
2
- def self.tool(package, tool)
3
- nugetDir = Dir.glob(File.join(package_root,"#{package}*")).sort.last
4
- return File.join(nugetDir, "tools", tool) if File.directory?(nugetDir)
5
-
6
-
7
- File.join(Dir.glob(File.join(package_root,"#{package}.[0-9]*")).sort.last, "tools", tool)
8
- end
9
-
10
- def self.package_root
11
- root = nil
12
-
13
- packroots = Dir.glob("{source,src}/packages")
3
+ def self.tool(package, tool)
4
+ nugetDir = Dir.glob(File.join(package_root,"#{package}*")).sort.last
5
+ return File.join(nugetDir, "tools", tool) if File.directory?(nugetDir)
14
6
 
15
- return packroots.last if packroots.length > 0
7
+ File.join(Dir.glob(File.join(package_root,"#{package}.[0-9]*")).sort.last, "tools", tool)
8
+ end
16
9
 
17
- Dir.glob("{source,src}").each do |d|
18
- packroot = File.join d, "packages"
19
- FileUtils.mkdir_p(packroot)
20
- root = packroot
21
- end
10
+ def self.package_root
11
+ root = nil
22
12
 
23
- root
24
- end
13
+ packroots = Dir.glob("{source,src}/packages")
14
+
15
+ return packroots.last if packroots.length > 0
16
+
17
+ Dir.glob("{source,src}").each do |d|
18
+ packroot = File.join d, "packages"
19
+ FileUtils.mkdir_p(packroot)
20
+ root = packroot
21
+ end
22
+
23
+ root
24
+ end
25
25
  end
data/lib/nunit.rb CHANGED
@@ -1,101 +1,96 @@
1
+ # vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
1
2
  module FubuRake
2
- class NUnit
3
- def self.create_task(tasks, options)
4
- nunitTask = nil
5
-
6
- tests = Array.new
7
-
8
- if options[:unit_test_projects].any?
9
- tests = options[:unit_test_projects]
10
- elsif options[:unit_test_list_file] != nil and File::exists?(options[:unit_test_list_file])
11
- file = options[:unit_test_list_file]
3
+ class NUnit
4
+ def self.create_task(tasks, options)
5
+ nunitTask = nil
12
6
 
13
- tests = NUnitRunner.readFromFile(file)
14
-
15
- else
16
- # just find testing projects
17
- Dir.glob('**/*.{Testing,Tests}.csproj').each do |f|
18
- test = File.basename(f, ".csproj")
19
- tests.push test
20
- end
7
+ tests = Array.new
21
8
 
22
- end
23
-
24
- if !tests.empty?
25
- nunitTask = Rake::Task.define_task :unit_test do
26
- runner = NUnitRunner.new options
27
- runner.executeTests tests
28
- end
29
-
30
- nunitTask.enhance [:compile]
31
- nunitTask.add_description "Runs unit tests for " + tests.join(', ')
32
- end
9
+ if options[:unit_test_projects].any?
10
+ tests = options[:unit_test_projects]
11
+ elsif options[:unit_test_list_file] != nil and File::exists?(options[:unit_test_list_file])
12
+ file = options[:unit_test_list_file]
33
13
 
34
- if tasks.integration_test != nil
35
- integrationTask = Rake::Task.define_task :integration_test do
36
- runner = NUnitRunner.new options
37
- runner.executeTests tasks.integration_test
38
- end
14
+ tests = NUnitRunner.readFromFile(file)
15
+
16
+ else
17
+ # just find testing projects
18
+ Dir.glob('**/*.{Testing,Tests}.csproj').each do |f|
19
+ test = File.basename(f, ".csproj")
20
+ tests.push test
21
+ end
22
+ end
23
+
24
+ if !tests.empty?
25
+ nunitTask = Rake::Task.define_task :unit_test do
26
+ runner = NUnitRunner.new options
27
+ runner.executeTests tests
28
+ end
29
+
30
+ nunitTask.enhance [:compile]
31
+ nunitTask.add_description "Runs unit tests for " + tests.join(', ')
32
+ end
33
+
34
+ if tasks.integration_test != nil
35
+ integrationTask = Rake::Task.define_task :integration_test do
36
+ runner = NUnitRunner.new options
37
+ runner.executeTests tasks.integration_test
38
+ end
39
39
 
40
- integrationTask.enhance [:compile]
41
- integrationTask.add_description "integration tests: #{tasks.integration_test.join(', ')}"
42
- end
40
+ integrationTask.enhance [:compile]
41
+ integrationTask.add_description "integration tests: #{tasks.integration_test.join(', ')}"
42
+ end
43
+ end
43
44
  end
44
- end
45
-
46
-
47
-
48
- class NUnitRunner
45
+
46
+
47
+
48
+ class NUnitRunner
49
49
  include FileTest
50
50
 
51
- def initialize(paths)
52
- @sourceDir = paths.fetch(:source, 'src')
53
- @resultsDir = paths.fetch(:results, 'results')
54
- @compilePlatform = paths.fetch(:platform, '')
55
- @compileTarget = paths.fetch(:compilemode, 'debug')
56
- @clrversion = paths.fetch(:clrversion, 'v4.0.30319')
57
- @nunitExe = Nuget.tool("NUnit", "nunit-console#{(@compilePlatform.empty? ? '' : "-#{@compilePlatform}")}.exe") + Platform.switch("nothread")
58
- end
51
+ def initialize(paths)
52
+ @sourceDir = paths.fetch(:source, 'src')
53
+ @resultsDir = paths.fetch(:results, 'results')
54
+ @compilePlatform = paths.fetch(:platform, '')
55
+ @compileTarget = paths.fetch(:compilemode, 'debug')
56
+ @clrversion = paths.fetch(:clrversion, 'v4.0.30319')
57
+ @nunitExe = Nuget.tool("NUnit", "nunit-console#{(@compilePlatform.empty? ? '' : "-#{@compilePlatform}")}.exe") + Platform.switch("nothread")
58
+ end
59
59
 
60
- def executeTests(assemblies)
61
- Dir.mkdir @resultsDir unless exists?(@resultsDir)
62
-
63
- assemblies.each do |assem|
64
- file = File.expand_path("#{@sourceDir}/#{assem}/bin/#{@compilePlatform.empty? ? '' : @compilePlatform + '/'}#{@compileTarget}/#{assem}.dll")
65
- puts "The platform is #{@compilePlatform}"
66
- sh Platform.runtime("#{@nunitExe} -noshadow -xml=#{@resultsDir}/#{assem}-TestResults.xml \"#{file}\"", @clrversion)
60
+ def executeTests(assemblies)
61
+ Dir.mkdir @resultsDir unless exists?(@resultsDir)
62
+
63
+ assemblies.each do |assem|
64
+ file = File.expand_path("#{@sourceDir}/#{assem}/bin/#{@compilePlatform.empty? ? '' : @compilePlatform + '/'}#{@compileTarget}/#{assem}.dll")
65
+ puts "The platform is #{@compilePlatform}"
66
+ sh Platform.runtime("#{@nunitExe} -noshadow -xml=#{@resultsDir}/#{assem}-TestResults.xml \"#{file}\"", @clrversion)
67
+ end
67
68
  end
68
- end
69
69
 
70
- def self.readFromFile(file)
71
- tests = Array.new
70
+ def self.readFromFile(file)
71
+ tests = Array.new
72
72
 
73
- file = File.new(file, "r")
74
- assemblies = file.readlines()
75
- assemblies.each do |a|
76
- test = a.gsub("\r\n", "").gsub("\n", "")
77
- tests.push(test)
78
- end
79
- file.close
80
-
81
- return tests
82
- end
73
+ file = File.new(file, "r")
74
+ assemblies = file.readlines()
75
+ assemblies.each do |a|
76
+ test = a.gsub("\r\n", "").gsub("\n", "")
77
+ tests.push(test)
78
+ end
79
+ file.close
80
+
81
+ return tests
82
+ end
83
83
 
84
- def executeTestsInFile(file)
85
- if !File.exist?(file)
86
- throw "File #{file} does not exist"
87
- end
88
-
89
- tests = readFromFile(file)
90
-
91
- if (!tests.empty?)
92
- executeTests tests
93
- end
84
+ def executeTestsInFile(file)
85
+ if !File.exist?(file)
86
+ throw "File #{file} does not exist"
87
+ end
88
+
89
+ tests = readFromFile(file)
90
+
91
+ if (!tests.empty?)
92
+ executeTests tests
93
+ end
94
+ end
94
95
  end
95
- end
96
-
97
-
98
96
  end
99
-
100
-
101
-
data/lib/platform.rb CHANGED
@@ -1,20 +1,53 @@
1
+ # vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
1
2
  module Platform
2
3
 
3
- def self.is_nix
4
- !RUBY_PLATFORM.match("linux|darwin").nil?
5
- end
4
+ def self.is_nix
5
+ !RUBY_PLATFORM.match("linux|darwin").nil?
6
+ end
6
7
 
7
- def self.runtime(cmd, runtime)
8
- command = cmd
9
- if self.is_nix
10
- command = "mono --runtime=#{runtime} #{cmd}"
11
- end
12
- command
13
- end
8
+ def self.is_linux
9
+ !RUBY_PLATFORM.match("linux").nil?
10
+ end
14
11
 
15
- def self.switch(arg)
16
- sw = self.is_nix ? " -" : " /"
17
- sw + arg
18
- end
12
+ def self.is_darwin
13
+ !RUBY_PLATFORM.match("darwin").nil?
14
+ end
19
15
 
20
- end
16
+ def self.open(path)
17
+ command = "start #{path}"
18
+ if self.is_linux
19
+ command = "xdg-open #{path}"
20
+ elsif self.is_darwin
21
+ command = "open #{path}"
22
+ end
23
+ sh command
24
+ end
25
+
26
+ #http://src.chromium.org/chrome/trunk/deps/third_party/xdg-utils/scripts/xdg-terminal
27
+ # #https://github.com/ssokolow/profile/blob/master/supplemental/xdg-terminal
28
+ # #http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/start.mspx?mfr=true
29
+ #
30
+ def self.start(command)
31
+ if self.is_linux
32
+ command = "xterm -e '#{command}'"
33
+ elsif self.is_darmin
34
+ command = "Terminal -e '#{command}'"
35
+ else
36
+ command = "start '#{command}'"
37
+ end
38
+ sh command
39
+ end
40
+
41
+ def self.runtime(cmd, runtime='v4.0.30319')
42
+ command = cmd
43
+ if self.is_nix
44
+ command = "mono --runtime=#{runtime} #{cmd}"
45
+ end
46
+ command
47
+ end
48
+
49
+ def self.switch(arg)
50
+ sw = self.is_nix ? " -" : " /"
51
+ sw + arg
52
+ end
53
+ end
data/lib/ripple.rb CHANGED
@@ -1,38 +1,39 @@
1
+ # vim: tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab
1
2
  module FubuRake
2
- class Ripple
3
- def self.create(tasks, options)
4
- if !tasks.ripple_enabled
5
- return
6
- end
7
-
8
- tasks.clean << 'artifacts'
9
-
10
- restoreTask = Rake::Task.define_task 'ripple:restore' do
11
- puts 'Restoring all the nuget package files'
12
- sh 'ripple restore'
13
- end
14
- restoreTask.add_description "Restores nuget package files and updates all floating nugets"
15
-
16
- updateTask = Rake::Task.define_task 'ripple:update' do
17
- puts 'Cleaning out existing packages out of paranoia'
18
- sh 'ripple clean'
19
-
20
- puts 'Updating all the nuget package files'
21
- sh 'ripple update'
22
- end
23
- updateTask.add_description "Updates nuget package files to the latest"
24
-
25
-
26
- historyTask = Rake::Task.define_task 'ripple:history' do
27
- sh 'ripple history'
28
- end
29
- historyTask.add_description "creates a history file for nuget dependencies"
30
-
31
- packageTask = Rake::Task.define_task 'ripple:package' do
32
- sh "ripple local-nuget --version #{options[:build_number]} --destination artifacts"
33
- end
34
- packageTask.add_description "packages the nuget files from the nuspec files in packaging/nuget and publishes to /artifacts"
3
+ class Ripple
4
+ def self.create(tasks, options)
5
+ if !tasks.ripple_enabled
6
+ return
7
+ end
8
+
9
+ tasks.clean << 'artifacts'
10
+
11
+ restoreTask = Rake::Task.define_task 'ripple:restore' do
12
+ puts 'Restoring all the nuget package files'
13
+ sh 'ripple restore'
14
+ end
15
+ restoreTask.add_description "Restores nuget package files and updates all floating nugets"
16
+
17
+ updateTask = Rake::Task.define_task 'ripple:update' do
18
+ puts 'Cleaning out existing packages out of paranoia'
19
+ sh 'ripple clean'
20
+
21
+ puts 'Updating all the nuget package files'
22
+ sh 'ripple update'
23
+ end
24
+ updateTask.add_description "Updates nuget package files to the latest"
25
+
26
+
27
+ historyTask = Rake::Task.define_task 'ripple:history' do
28
+ sh 'ripple history'
29
+ end
30
+ historyTask.add_description "creates a history file for nuget dependencies"
31
+
32
+ packageTask = Rake::Task.define_task 'ripple:package' do
33
+ sh "ripple local-nuget --version #{options[:build_number]} --destination artifacts"
34
+ end
35
+ packageTask.add_description "packages the nuget files from the nuspec files in packaging/nuget and publishes to /artifacts"
36
+ end
35
37
  end
36
- end
37
38
  end
38
39