albacore 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ class MSBuild
8
8
 
9
9
  attr_accessor :solution, :verbosity, :loggermodule, :max_cpu_count
10
10
  attr_array :targets
11
- attr_hash :properties
11
+ attr_hash :properties, :other_switches
12
12
 
13
13
  def initialize
14
14
  super()
@@ -33,6 +33,7 @@ class MSBuild
33
33
  command_parameters << "\"/maxcpucount:#{@max_cpu_count}\"" if @max_cpu_count != nil
34
34
  command_parameters << "\"/nologo\"" if @nologo
35
35
  command_parameters << build_properties if @properties != nil
36
+ command_parameters << build_switches if @other_switches != nil
36
37
  command_parameters << "\"/target:#{build_targets}\"" if @targets != nil
37
38
 
38
39
  result = run_command "MSBuild", command_parameters.join(" ")
@@ -40,7 +41,7 @@ class MSBuild
40
41
  failure_message = 'MSBuild Failed. See Build Log For Detail'
41
42
  fail_with_message failure_message if !result
42
43
  end
43
-
44
+
44
45
  def check_solution(file)
45
46
  return if file
46
47
  msg = 'solution cannot be nil'
@@ -58,4 +59,20 @@ class MSBuild
58
59
  end
59
60
  option_text.join(" ")
60
61
  end
62
+
63
+ def build_switches
64
+ switch_text = []
65
+ @other_switches.each do |key, value|
66
+ switch_text << print_switch(key, value)
67
+ end
68
+ switch_text.join(" ")
69
+ end
70
+
71
+ def print_switch(key, value)
72
+ pure_switch?(value) ? "/#{key}" : "/#{key}:\"#{value}\""
73
+ end
74
+
75
+ def pure_switch?(value)
76
+ value.is_a?(TrueClass) || value == :true
77
+ end
61
78
  end
@@ -18,7 +18,6 @@ class MSDeploy
18
18
  end
19
19
 
20
20
  def execute
21
-
22
21
  if(@command.nil?)
23
22
  @command = get_msdeploy_path
24
23
  end
@@ -38,27 +37,30 @@ class MSDeploy
38
37
 
39
38
  failure_msg = 'MSDeploy Failed. See build log for details'
40
39
  fail_with_message failure_msg if !result
41
- end
40
+ end
42
41
 
43
42
  def get_msdeploy_path
44
-
45
- #check path directory
46
- ENV['PATH'].split(';').each do |folder|
47
- if(File.exists?(folder+'/msdeploy.exe'))
48
- return folder+'/msdeploy.exe'
49
- end
50
- end
43
+ #check the environment paths
44
+ ENV['PATH'].split(';').each do |path|
45
+ msdeploy_path = File.join(path, 'msdeploy.exe')
46
+ return msdeploy_path if File.exists?(msdeploy_path)
47
+ end
48
+
49
+ #check the environment variables
50
+ if ENV['MSDeployPath']
51
+ msdeploy_path = File.join(ENV['MSDeployPath'], 'msdeploy.exe')
52
+ return msdeploy_path if File.exists?(msdeploy_path)
53
+ end
54
+
51
55
  #check if it's in registry
52
- msdeploy_path = ENV['MSDeployPath']
53
- if(msdeploy_path == nil || !File.exist?("#{msdeploy_path}msdeploy.exe"))
54
- Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2') do |reg|
55
- reg_typ, reg_val = reg.read('InstallPath') # no checking for x86 here.
56
- msdeploy_path = reg_val
57
- end
58
- end
59
- fail_with_message 'MSDeploy could not be found is it installed?' if !File.exist?("#{msdeploy_path}msdeploy.exe")
60
- return "#{msdeploy_path}msdeploy.exe"
61
- end
56
+ Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2') do |reg|
57
+ reg_typ, reg_val = reg.read('InstallPath') # no checking for x86 here.
58
+ msdeploy_path = reg_val
59
+ return msdeploy_path if File.exists?(msdeploy_path)
60
+ end
61
+
62
+ fail_with_message 'MSDeploy could not be found is it installed?'
63
+ end
62
64
 
63
65
  def get_package
64
66
  #is it a direct file
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
@@ -3,7 +3,6 @@ require 'albacore/msbuild'
3
3
  require 'albacore/config/msbuildconfig'
4
4
  require 'msbuildtestdata'
5
5
 
6
-
7
6
  shared_context "prepping msbuild" do
8
7
  before :all do
9
8
  @testdata = MSBuildTestData.new
@@ -11,6 +10,7 @@ shared_context "prepping msbuild" do
11
10
  @strio = StringIO.new
12
11
  @msbuild.log_device = @strio
13
12
  @msbuild.log_level = :diagnostic
13
+ @msbuild.properties :platform => 'Any CPU'
14
14
  end
15
15
  end
16
16
 
@@ -28,7 +28,7 @@ describe MSBuild, "when building a solution with verbose logging turned on" do
28
28
  end
29
29
 
30
30
  it "should log the msbuild command line being called" do
31
- com = @log_data.downcase().should include("Executing MSBuild: \"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe\"".downcase())
31
+ com = @log_data.downcase().should include("Executing MSBuild: \"C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe\"".downcase())
32
32
  end
33
33
  end
34
34
 
@@ -130,8 +130,8 @@ describe MSBuild, "when building a visual studio solution for a specified config
130
130
  before :all do
131
131
  @testdata= MSBuildTestData.new("Release")
132
132
  @msbuild = @testdata.msbuild
133
-
134
- @msbuild.properties :configuration => :Release
133
+
134
+ @msbuild.properties :configuration => :Release, :platform => 'Any CPU'
135
135
  @msbuild.solution = @testdata.solution_path
136
136
  @msbuild.execute
137
137
  end
@@ -181,7 +181,7 @@ describe MSBuild, "when specifying multiple configuration properties" do
181
181
  File.delete(@testdata.output_path) if File.exist?(@testdata.output_path)
182
182
 
183
183
  @msbuild.targets :Clean, :Build
184
- @msbuild.properties :configuration => :Debug, :DebugSymbols => true
184
+ @msbuild.properties :configuration => :Debug, :DebugSymbols => true, :platform => 'Any CPU'
185
185
  @msbuild.solution = @testdata.solution_path
186
186
  @msbuild.execute
187
187
  end
@@ -244,3 +244,44 @@ describe MSBuild, "when specifying max cpu count" do
244
244
  end
245
245
  end
246
246
 
247
+ describe MSBuild, "when including a TrueClass switch" do
248
+ include_context "prepping msbuild"
249
+
250
+ before :all do
251
+ @msbuild.other_switches :noconsolelogger => true
252
+ @msbuild.solution = @testdata.solution_path
253
+ @msbuild.execute
254
+ end
255
+
256
+ it 'should call msbuild with the noconsolelogger switch' do
257
+ @msbuild.system_command.should include('/noconsolelogger')
258
+ end
259
+ end
260
+
261
+ describe MSBuild, "when including a true symbol switch" do
262
+ include_context "prepping msbuild"
263
+
264
+ before :all do
265
+ @msbuild.other_switches :noconsolelogger => :true
266
+ @msbuild.solution = @testdata.solution_path
267
+ @msbuild.execute
268
+ end
269
+
270
+ it 'should call msbuild with the noconsolelogger switch' do
271
+ @msbuild.system_command.should include('/noconsolelogger')
272
+ end
273
+ end
274
+
275
+ describe MSBuild, "when including a switch with value" do
276
+ include_context "prepping msbuild"
277
+
278
+ before :all do
279
+ @msbuild.other_switches :toolsVersion => 3.5
280
+ @msbuild.solution = @testdata.solution_path
281
+ @msbuild.execute
282
+ end
283
+
284
+ it 'should call msbuild with the noconsolelogger switch' do
285
+ @msbuild.system_command.should include("/toolsVersion:\"3.5\"")
286
+ end
287
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: albacore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-10 00:00:00.000000000Z
13
+ date: 2012-09-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rubyzip
17
- requirement: &22238760 !ruby/object:Gem::Requirement
17
+ requirement: &2985840 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *22238760
25
+ version_requirements: *2985840
26
26
  description: Easily build your .Net or Mono project using this collection of Rake
27
27
  tasks.
28
28
  email: henrik@haf.se
@@ -692,7 +692,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
692
692
  version: '0'
693
693
  segments:
694
694
  - 0
695
- hash: 16372145
695
+ hash: -36994097
696
696
  required_rubygems_version: !ruby/object:Gem::Requirement
697
697
  none: false
698
698
  requirements:
@@ -701,10 +701,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
701
701
  version: '0'
702
702
  segments:
703
703
  - 0
704
- hash: 16372145
704
+ hash: -36994097
705
705
  requirements: []
706
706
  rubyforge_project: albacore
707
- rubygems_version: 1.7.2
707
+ rubygems_version: 1.8.16
708
708
  signing_key:
709
709
  specification_version: 3
710
710
  summary: Dolphin-safe and awesome Mono and .Net Rake-tasks