albacore 2.0.0.rc.6 → 2.0.0.rc.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # Albacore
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/Albacore/albacore.png?branch=clean_slate)](http://travis-ci.org/Albacore/albacore)
3
+ [![Build Status](https://secure.travis-ci.org/Albacore/albacore.png?branch=master)](http://travis-ci.org/Albacore/albacore)
4
4
 
5
5
  Version 2.0 of Albacore.
6
6
 
7
- This branch is the next official version. It is currently being used for
7
+ It is currently being used for
8
8
  numerous builds for us and is free of known bugs. It works on RMI 1.9.3 and RMI
9
9
  2.0.
10
10
 
@@ -32,7 +32,7 @@ build will use. Create a new file, named `Gemfile`. This file should look like
32
32
  this:
33
33
 
34
34
  source 'http://rubygems.org'
35
- gem 'albacore', '2.0.0.rc.5'
35
+ gem 'albacore', '2.0.0.rc.7'
36
36
 
37
37
  When setting up your build you need to ensure it is reproducible. Bundler
38
38
  allows you to lock down all gems that albacore depend on to their specific
@@ -152,7 +152,21 @@ and methods in the DSL you get when you do `require 'albacore'`
152
152
 
153
153
  ### Docs: build
154
154
 
155
- TBD
155
+ ``` ruby
156
+ require 'albacore'
157
+ build :compile_this do |b|
158
+ b.file = Paths.join 'src', 'MyProj.fsproj' # the file that you want to build
159
+ # b.sln = Paths.join 'src', 'MyProj.sln' # alt. name
160
+ b.target = ['Clean', 'Rebuild'] # call with an array of targets or just a single target
161
+ b.prop 'Configuration', 'Release' # call with 'key, value', to specify a MsBuild property
162
+ b.cores = 4 # no of cores to build with, defaults to the number of cores on your machine
163
+ b.clp 'ShowEventId' # any parameters you want to pass to the console logger of MsBuild
164
+ b.logging = 'verbose' # verbose logging mode
165
+ # b.be_quiet # opposite of the above
166
+ b.no_logo # no Microsoft/XBuild header output
167
+ end
168
+
169
+ ```
156
170
 
157
171
  ### Docs: nugets_pack
158
172
 
@@ -200,7 +214,7 @@ TBD
200
214
  Tasks are things you can include that create singleton ruby tasks that are
201
215
  pre-named and pre-made. As opposed to the task types, these are 'includeable'.
202
216
  More info can be found in the
203
- [README](https://github.com/Albacore/albacore/blob/clean_slate/lib/albacore/tasks/README.md).
217
+ [README](https://github.com/Albacore/albacore/blob/master/lib/albacore/tasks/README.md).
204
218
 
205
219
  ### Versionizer
206
220
 
@@ -1,5 +1,6 @@
1
1
  require 'albacore/version'
2
2
  require 'albacore/albacore_module'
3
+ require 'albacore/rake_overrides'
3
4
  require 'albacore/dsl'
4
5
 
5
6
  module Albacore
@@ -1,3 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  require 'albacore/application'
2
4
  require 'albacore/logging'
3
5
 
@@ -1,4 +1,5 @@
1
1
  require 'rake'
2
+
2
3
  module Albacore
3
4
  class Application
4
5
 
@@ -81,7 +81,7 @@ module Albacore
81
81
  # TODO: figure out how to interleave output and error streams
82
82
  out, _, inmem = opts.get(:out), opts.get(:err), StringIO.new
83
83
 
84
- trace { "system( exe=#{exe}, pars=[#{pars.join(', ')}], options=#{opts.to_s}), in directory: #{opts.getopt(:workdir, '<<current>>')} [cross_platform_cmd #system]" }
84
+ trace { "system( exe=#{exe}, pars=[#{pars.join(', ')}], options=#{opts.to_s}), in directory: #{opts.getopt(:work_dir, '<<current>>')} [cross_platform_cmd #system]" }
85
85
 
86
86
  puts printable unless opts.get :silent, false # log cmd verbatim
87
87
 
@@ -111,7 +111,7 @@ module Albacore
111
111
  #debug 'waiting for thread completion'
112
112
  #@out_thread.join
113
113
 
114
- return block.call(status.success? && inmem.string, status)
114
+ return block.call(status.success? && inmem.string, status, inmem.string)
115
115
  end
116
116
  end
117
117
 
@@ -162,7 +162,7 @@ module Albacore
162
162
  end
163
163
  end
164
164
 
165
- return block.call($? == 0 && lines, $?)
165
+ return block.call($? == 0 && lines, $?, lines)
166
166
  end
167
167
  end
168
168
 
@@ -173,7 +173,7 @@ module Albacore
173
173
  # #exitstatus : Int
174
174
  # #pid : Int
175
175
  def shie *cmd, &block
176
- block = lambda { |ok, status| ok } unless block_given?
176
+ block = lambda { |ok, status, output| ok } unless block_given?
177
177
  sh *cmd, &block
178
178
  end
179
179
 
@@ -196,7 +196,7 @@ module Albacore
196
196
  end
197
197
 
198
198
  def which executable
199
- raise ArgumentError, "executable is nil" unless executable
199
+ raise ArgumentError, "executable to #which is nil" unless executable
200
200
 
201
201
  dir = File.dirname executable
202
202
  file = File.basename executable
@@ -247,16 +247,16 @@ module Albacore
247
247
  end
248
248
 
249
249
  def handler_with_message printable
250
- lambda { |ok, status| ok or raise_failure(printable, status) }
250
+ lambda { |ok, status, output| ok or raise_failure(printable, status, output) }
251
251
  end
252
252
 
253
253
  # handles the errors from not finding the executable on the system
254
254
  def handle_not_found rescue_block
255
255
  yield
256
256
  rescue Errno::ENOENT => e
257
- rescue_block.call(nil, PseudoStatus.new(127))
257
+ rescue_block.call(nil, PseudoStatus.new(127), e.to_s)
258
258
  rescue IOError => e # rescue for JRuby
259
- rescue_block.call(nil, PseudoStatus.new(127))
259
+ rescue_block.call(nil, PseudoStatus.new(127), e.to_s)
260
260
  end
261
261
 
262
262
 
@@ -264,11 +264,11 @@ module Albacore
264
264
  { 127 => 'number 127 in particular means that the operating system could not find the executable' }
265
265
  end
266
266
 
267
- def raise_failure cmd, status
267
+ def raise_failure cmd, status, output
268
268
  if status.exitstatus == 127
269
269
  raise CommandNotFoundError.new(format_failure(cmd, status), cmd)
270
270
  else
271
- raise CommandFailedError.new(format_failure(cmd, status), cmd)
271
+ raise CommandFailedError.new(format_failure(cmd, status), cmd, output)
272
272
  end
273
273
  end
274
274
 
@@ -1,4 +1,5 @@
1
1
  require 'albacore/cross_platform_cmd'
2
+ require 'albacore/paths'
2
3
 
3
4
  module Albacore
4
5
  module DSL
@@ -3,9 +3,19 @@ module Albacore
3
3
 
4
4
  attr_reader :executable
5
5
 
6
- def initialize message, executable
6
+ attr_reader :output
7
+
8
+ def initialize message, executable, output = nil
7
9
  super(message)
8
10
  @executable = executable
11
+ @output = output
12
+ end
13
+
14
+ def message
15
+ s = StringIO.new
16
+ s.puts super
17
+ s.puts output if output
18
+ s.string
9
19
  end
10
20
  end
11
21
  end
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
+
2
3
  require 'logger'
3
- require 'albacore/application'
4
+ require 'albacore/albacore_module'
4
5
 
5
6
  module Albacore
6
7
  module Logging
@@ -335,7 +335,7 @@ end})
335
335
  verify_files: false,
336
336
  nuget_dependencies: true })
337
337
 
338
- trace { "#from_xxproj opts: #{opts} [nuget model: package]" }
338
+ trace { "#from_xxproj proj: #{proj} opts: #{opts} [nuget model: package]" }
339
339
 
340
340
  version = opts.get :version
341
341
  package = Package.new
@@ -361,7 +361,7 @@ end})
361
361
  end
362
362
  end
363
363
 
364
- output = proj.output_path(opts.get(:configuration))
364
+ output = get_output_path proj, opts
365
365
  target_lib = %W[lib #{opts.get(:dotnet_version)}].join(Albacore::Paths.separator)
366
366
 
367
367
  if opts.get :symbols
@@ -401,6 +401,13 @@ end})
401
401
 
402
402
  package
403
403
  end
404
+ def self.get_output_path proj, opts
405
+ try = proj.try_output_path(opts.get(:configuration))
406
+ return try if try
407
+ warn 'using fallback output path'
408
+ proj.fallback_output_path
409
+ end
410
+
404
411
  end
405
412
  end
406
413
  end
@@ -1,34 +1,113 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require 'rake'
4
+ require 'albacore/albacore_module'
5
+ require 'albacore/logging'
6
+ require 'pathname'
4
7
 
5
- module Albacore
6
- # module methods for handling paths
7
- module Paths
8
- class << self
9
- def separator
10
- ::Rake::Win32.windows? ? '\\' : '/'
11
- end
8
+ # module methods for handling paths
9
+ module Albacore::Paths
10
+ class PathnameWrap
11
+ include ::Albacore::Logging
12
12
 
13
- # normalize the slashes of the path to what the operating system prefers
14
- def normalise_slashes path
15
- raise ArgumentError, "path is nil" if path.nil?
16
- ::Rake::Win32.windows? ? path.gsub('/', '\\') : path.gsub('\\', '/')
17
- end
13
+ # inner pathname
14
+ attr_reader :inner
18
15
 
19
- def make_command executable, parameters
20
- raise ArgumentError, "executable is nil" if executable.nil?
21
- params = parameters.collect{|p| '"' + p + '"'}.join ' '
22
- exe = normalise_slashes executable
23
- %Q{"#{exe}" #{params}}
24
- end
16
+ # string pathname
17
+ attr_reader :p
18
+
19
+ def initialize p
20
+ raise ArgumentError, 'p is nil' if p.nil?
21
+ @p = (p.is_a?(String) ? p : p.to_s)
22
+ @inner = Pathname.new @p
23
+ end
24
+
25
+ def parent
26
+ PathnameWrap.new(inner.parent)
27
+ end
28
+
29
+ def +(other)
30
+ join other
31
+ end
32
+
33
+ def join *other
34
+ args = other.collect { |x| x.is_a?(PathnameWrap) ? x.p : x }
35
+ PathnameWrap.new(inner.join(*args))
36
+ end
37
+
38
+ def to_s
39
+ Paths.normalise_slashes p
40
+ end
41
+
42
+ def ==(o)
43
+ trace { "#{self} ==( #{o} )" }
44
+ (o.respond_to? :p) && o.p == p
45
+ end
46
+
47
+ alias_method :eql?, :==
48
+
49
+ def hash
50
+ p.hash
51
+ end
25
52
 
26
- def normalise executable, parameters
27
- raise ArgumentError, "executable is nil" if executable.nil?
28
- parameters = parameters.collect{ |p| (p === String) ? p : p.to_s }
29
- exe = normalise_slashes executable
30
- ["#{exe}", parameters]
53
+ # unwraps the pathname; defaults all return forward slashes
54
+ def as_unix
55
+ to_s.gsub /\\/, '/'
56
+ end
57
+ end
58
+
59
+ class << self
60
+
61
+ # returns the operating system separator character as a string
62
+ def separator
63
+ ::Albacore.windows? ? '\\' : '/'
64
+ end
65
+
66
+ # normalize the slashes of the path to what the operating system prefers
67
+ def normalise_slashes path
68
+ return path unless path.respond_to? :gsub
69
+ raise ArgumentError, "path is nil" if path.nil?
70
+ ::Rake::Win32.windows? ? path.gsub('/', '\\') : path.gsub('\\', '/')
71
+ end
72
+
73
+ # make a single string-command from a given executable string, by quoting each parameter
74
+ # individually. You can also use Albacore::CrossPlatformCmd#system given an array
75
+ # of 'stringly' things.
76
+ def make_command executable, parameters
77
+ raise ArgumentError, "executable is nil" if executable.nil?
78
+ params = parameters.collect{|p| '"' + p + '"'}.join ' '
79
+ exe = normalise_slashes executable
80
+ %Q{"#{exe}" #{params}}
81
+ end
82
+
83
+ # normalise slashes in an executable/parameters combo
84
+ def normalise executable, parameters
85
+ raise ArgumentError, "executable is nil" if executable.nil?
86
+ parameters = parameters.collect{ |p| (p === String) ? p : p.to_s }
87
+ exe = normalise_slashes executable
88
+ ["#{exe}", parameters]
89
+ end
90
+
91
+ # join an Enumerable of paths by normalising slashes on each of the segments, then
92
+ # joining them
93
+ def join *paths
94
+ raise ArgumentError, 'no paths given' if paths.nil?
95
+
96
+ joined = paths[1..-1].inject(PathnameWrap.new(normalise_slashes(paths[0]))) do |s, t|
97
+ s + normalise_slashes(t)
31
98
  end
99
+
100
+ PathnameWrap.new joined
101
+ end
102
+
103
+ # join an Enumerable of paths by normalising slashes on each of the segments, then
104
+ # joining them, returning a string
105
+ def join_str *paths
106
+ join(*paths).to_s
32
107
  end
33
108
  end
34
109
  end
110
+
111
+ # Paths should be accessible if you require this file
112
+ self.include Albacore
113
+
@@ -1,7 +1,14 @@
1
1
  require 'nokogiri'
2
+ require 'albacore/logging'
2
3
  require 'albacore/semver'
3
4
 
4
5
  module Albacore
6
+
7
+ # error raised from Project#output_path if the given configuration wasn't
8
+ # found
9
+ class ConfigurationNotFoundError < ::StandardError
10
+ end
11
+
5
12
  # a project encapsulates the properties from a xxproj file.
6
13
  class Project
7
14
  include Logging
@@ -9,6 +16,7 @@ module Albacore
9
16
  attr_reader :proj_path_base, :proj_filename, :proj_xml_node
10
17
 
11
18
  def initialize proj_path
19
+ proj_path = proj_path.to_s unless proj_path.is_a? String
12
20
  @proj_xml_node = Nokogiri.XML(open(proj_path))
13
21
  @proj_path_base, @proj_filename = File.split proj_path
14
22
  end
@@ -34,14 +42,27 @@ module Albacore
34
42
  read_property "Authors"
35
43
  end
36
44
 
37
- # gets the output path of the project given the configuration
45
+ # gets the output path of the project given the configuration or raise
46
+ # an error otherwise
38
47
  def output_path conf
39
- path = @proj_xml_node.css("Project PropertyGroup[Condition*=#{conf}] OutputPath")
40
- debug "#{name}: output path node[#{conf}]: #{ (path.empty? ? 'empty' : path.inspect) } [albacore: project]"
48
+ try_output_path conf || raise(ConfigurationNotFoundError, "could not find configuration '#{conf}'")
49
+ end
50
+
51
+ def try_output_path conf
52
+ path = @proj_xml_node.css("Project PropertyGroup[Condition*='#{conf}|'] OutputPath")
53
+ # path = @proj_xml_node.xpath("//Project/PropertyGroup[matches(@Condition, '#{conf}')]/OutputPath")
54
+
55
+ debug { "#{name}: output path node[#{conf}]: #{ (path.empty? ? 'empty' : path.inspect) } [albacore: project]" }
56
+
41
57
  return path.inner_text unless path.empty?
58
+ nil
59
+ end
42
60
 
43
- path = @proj_xml_node.css("Project PropertyGroup OutputPath")
44
- path.inner_text
61
+ def fallback_output_path
62
+ fallback = @proj_xml_node.css("Project PropertyGroup OutputPath").first
63
+ condition = fallback.parent['Condition'] || 'No \'Condition\' specified'
64
+ warn "chose an OutputPath in: '#{self}' for Configuration: <#{condition}> [albacore: project]"
65
+ fallback.inner_text
45
66
  end
46
67
 
47
68
  # find the NodeList reference list
@@ -0,0 +1,21 @@
1
+ require 'albacore/paths'
2
+ require 'albacore/albacore_module'
3
+
4
+ module ::Rake
5
+ class << self
6
+ alias_method :old_original_dir, :original_dir
7
+
8
+ # get the original dir that rake was called from as a string
9
+ def albacore_original_dir *args
10
+ ::Albacore::Paths::PathnameWrap.new(old_original_dir(*args)).to_s
11
+ end
12
+
13
+ alias_method :original_dir, :albacore_original_dir
14
+
15
+ # get the original dir that rake was called from a Pathname
16
+ def original_dir_path
17
+ ::Albacore::Paths::PathnameWrap.new(old_original_dir())
18
+ end
19
+ end
20
+ end
21
+
@@ -68,7 +68,7 @@ module Albacore
68
68
  # If you specify any targets by using this switch, they are run instead of any targets in the DefaultTargets attribute in the project file. For more information, see Target Build Order (http://msdn.microsoft.com/en-us/library/vstudio/ee216359.aspx) and How to: Specify Which Target to Build First (http://msdn.microsoft.com/en-us/library/vstudio/ms171463.aspx).
69
69
  # A target is a group of tasks. For more information, see MSBuild Targets (http://msdn.microsoft.com/en-us/library/vstudio/ms171462.aspx)."
70
70
  #
71
- # t :: the array or string target to add to the list of tarets to build
71
+ # t :: the array or string target to add to the list of targets to build
72
72
  attr_path_accessor :target do |t|
73
73
  update_array_prop "target", method(:make_target), :targets, t
74
74
  end
@@ -99,6 +99,16 @@ module Albacore
99
99
  set_logging mode
100
100
  end
101
101
 
102
+
103
+ # Gets or sets a target .NET Framework version to build the project with, which
104
+ # enables an MSBuild task to build a project that targets a different version of
105
+ # the .NET Framework than the one specified in the project. Valid values are 2.0,
106
+ # 3.0 and 3.5.
107
+ #
108
+ attr_path_accessor :tools_version do |t|
109
+ @parameters.add "/toolsversion:#{t}"
110
+ end
111
+
102
112
  # Specifies the number of parallel worker processes to build with
103
113
  # Defaults to the number of logical cores
104
114
  attr_path_accessor :cores do |num|
@@ -178,7 +188,7 @@ module Albacore
178
188
  %w{v4.0.30319 v4.0 v3.5 v2.0}.collect { |fw_ver|
179
189
  msb = File.join ENV['WINDIR'], 'Microsoft.NET', 'Framework', fw_ver, 'msbuild.exe'
180
190
  CrossPlatformCmd.which(msb) ? msb : nil
181
- }.first
191
+ }.compact.first
182
192
  else
183
193
  nil
184
194
  end
@@ -306,6 +306,7 @@ module Albacore
306
306
  end
307
307
 
308
308
  def write_nuspec! proj, nuspec, symbols
309
+ raise ArgumentError, "no nuspect metadata id, project at path: #{proj.proj_path_base}, nuspec: #{nuspec.inspect}" unless nuspec.metadata.id
309
310
  nuspec_path = File.join(proj.proj_path_base, nuspec.metadata.id + "#{ symbols ? '.symbols' : '' }.nuspec")
310
311
 
311
312
  File.write(nuspec_path, nuspec.to_xml)
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = "2.0.0.rc.6"
2
+ VERSION = "2.0.0.rc.7"
3
3
  end
@@ -17,3 +17,4 @@ describe "pub sub" do
17
17
  ::Albacore.windows?.should_not be_nil
18
18
  end
19
19
  end
20
+
@@ -7,7 +7,7 @@ describe 'build config' do
7
7
  subject do
8
8
  Albacore::Build::Config.new
9
9
  end
10
- %w[file= sln= target target= logging logging= prop cores cores=].each do |writer|
10
+ %w[file= sln= target target= logging logging= prop cores cores= tools_version tools_version=].each do |writer|
11
11
  it "should have property :#{writer}" do
12
12
  subject.respond_to?(:"#{writer}").should be_true
13
13
  end
@@ -19,9 +19,11 @@ describe 'build config' do
19
19
  describe 'when setting properties' do
20
20
  before do
21
21
  subject.logging = 'minimal'
22
+ subject.tools_version = '3.5'
22
23
  end
23
24
  it do
24
25
  subject.parameters.should include('/verbosity:minimal')
26
+ subject.parameters.should include('/toolsversion:3.5')
25
27
  end
26
28
  end
27
29
  end
@@ -40,6 +42,7 @@ describe 'when running with sln' do
40
42
 
41
43
  before do
42
44
  cfg.sln = 'src/HelloWorld.sln'
45
+ cfg.target = %w|Clean Build|
43
46
  cmd.execute
44
47
  end
45
48
 
@@ -51,7 +54,7 @@ describe 'when running with sln' do
51
54
  subject.executable.should eq('xbuild')
52
55
  end
53
56
  it do
54
- subject.parameters.should eq(%W|/verbosity:minimal #{path 'src/HelloWorld.sln'}|)
57
+ subject.parameters.should eq(%W|/verbosity:minimal #{path 'src/HelloWorld.sln'} /target:Clean;Build|)
55
58
  end
56
59
  it do
57
60
  subject.is_mono_command?.should be_false
@@ -151,7 +151,6 @@ XML
151
151
  end
152
152
  end
153
153
 
154
-
155
154
  describe "when reading xml from a fsproj file into Project/Metadata" do
156
155
  let :projfile do
157
156
  curr = File.dirname(__FILE__)
@@ -189,7 +188,6 @@ describe "when reading xml from a fsproj file into Project/Metadata" do
189
188
  end
190
189
  end
191
190
 
192
-
193
191
  describe Albacore::NugetModel::Package, "overriding metadata" do
194
192
  let :p1 do
195
193
  p = Albacore::NugetModel::Package.new.with_metadata do |m|
@@ -347,6 +345,12 @@ describe "creating nuget on dependent proj file" do
347
345
  end
348
346
 
349
347
  describe 'Release-only output' do
348
+ # In this case we only have a Release output, and the nuget should pick the
349
+ # single one that exists.
350
+ # The idea is that we should succeed rather than fail, to remove friction, but
351
+ # there should also be a warning about it in the output; that an OutputPath
352
+ # was selected from a specific configuration that wasn't configured in the
353
+ # task type.
350
354
  let :projfile do
351
355
  curr = File.dirname(__FILE__)
352
356
  File.join curr, "testdata", "EmptyProject", "EmptyProject.csproj"
@@ -0,0 +1,117 @@
1
+ require 'albacore/paths'
2
+
3
+ describe ::Albacore::Paths.method(:join), 'when joining path segments' do
4
+ let :s do
5
+ Paths.separator
6
+ end
7
+
8
+ let :sample do
9
+ subject.call(*%w|a b c|)
10
+ end
11
+
12
+ let :abc do
13
+ 'a' + s + 'b' + s + 'c'
14
+ end
15
+
16
+ it 'should return id' do
17
+ subject.call('abc').to_s.should eq('abc')
18
+ end
19
+
20
+ it 'should return with proper separator' do
21
+ sample.to_s.should eq('a' + s + 'b' + s + 'c')
22
+ end
23
+
24
+ it 'should be joinable' do
25
+ sample.join('d').to_s.should include(s)
26
+ end
27
+
28
+ it 'should be +-able' do
29
+ (sample + 'd').to_s.should include(s)
30
+ end
31
+
32
+ it 'can join with *' do
33
+ subject.call('a').join('*/').to_s.should eq('a' + s + '*' + s)
34
+ end
35
+
36
+ it 'accepts multiple paths' do
37
+ subject.call('a', 'b', 'c').to_s.should eq(abc)
38
+ end
39
+
40
+ it 'returns something accepting multiple paths' do
41
+ subject.call('a', 'b', 'c').join('d', 'e').to_s.should eq(abc + s + 'd' + s + 'e')
42
+ end
43
+
44
+ it 'should be presentable in "unix" style' do
45
+ sample.as_unix.to_s.should_not include('\\')
46
+ end
47
+
48
+ it 'should handle joining on a type like itself' do
49
+ sample.join(sample).to_s.should eq(abc + s + abc)
50
+ sample.join(sample, sample)
51
+ end
52
+
53
+ it 'should handle +-ing on a type like itself' do
54
+ sample + sample
55
+ end
56
+
57
+ it 'should handle joining with a Pathname' do
58
+ pending "don't know why not working" if Albacore.windows?
59
+ (sample.join Pathname.new('x')).should eq(Paths::PathnameWrap.new(abc + s + 'x'))
60
+ end
61
+
62
+ it 'should handle +-ing with a Pathname' do
63
+ pending "don't know why not working" if Albacore.windows?
64
+ (sample + Pathname.new('x')).should eq(Paths::PathnameWrap.new(abc + s + 'x'))
65
+ end
66
+
67
+ it do
68
+ sample.should respond_to(:hash)
69
+ end
70
+
71
+ it do
72
+ sample.should respond_to(:eql?)
73
+ end
74
+
75
+ it 'joins with identity' do
76
+ subject.call(Paths::PathnameWrap.new(abc)).to_s.should eq(abc)
77
+ end
78
+
79
+ it 'joins with others' do
80
+ sample.join(Paths::PathnameWrap.new(abc)).to_s.should eq(abc + s + abc)
81
+ end
82
+ end
83
+
84
+ describe ::Albacore::Paths.method(:join_str), 'when joining path segments' do
85
+ let :s do
86
+ Paths.separator
87
+ end
88
+
89
+ it 'id' do
90
+ subject.call('.').should eq('.')
91
+ end
92
+
93
+ it 'id slash' do
94
+ subject.call('.', '/').should eq(s)
95
+ end
96
+
97
+ it 'id slash win' do
98
+ subject.call('.', '\\').should eq(s)
99
+ end
100
+
101
+ it 'id slash with root' do
102
+ subject.call('.', '/', '/b').should eq(s + 'b')
103
+ end
104
+
105
+ it 'id slash with root win' do
106
+ subject.call('.', '\\', '\\b').should eq(s + 'b')
107
+ end
108
+
109
+ it 'id double slash' do
110
+ subject.call('.', 'b/', 'c/').should eq('b' + s + 'c' + s)
111
+ end
112
+
113
+ it 'id double slash win' do
114
+ subject.call('.', 'b\\', 'c\\').should eq('b' + s + 'c' + s)
115
+ end
116
+ end
117
+
@@ -3,24 +3,62 @@ require 'albacore/semver'
3
3
  require 'albacore/project'
4
4
 
5
5
  describe Albacore::Project, "when loading packages.config" do
6
- subject {
6
+ subject do
7
7
  p = File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
8
8
  #puts "path: #{p}"
9
9
  Albacore::Project.new(p)
10
- }
11
- let(:nlog) { subject.declared_packages.find { |p| p.id == 'NLog' } }
12
- it("should have three packages") { subject.declared_packages.length.should == 3 }
13
- it("should contain NLog") { nlog.should_not be_nil }
14
- it("should have a four number on NLog") { nlog.version.should eq("2.0.0.2000") }
15
- it("should have a semver number") { nlog.semver.should eq(Albacore::SemVer.new(2, 0, 0)) }
10
+ end
11
+ let :nlog do
12
+ subject.declared_packages.find { |p| p.id == 'NLog' }
13
+ end
14
+ it 'should have an OutputPath' do
15
+ subject.output_path('Debug').should_not be_nil
16
+ end
17
+ it 'should have the correct OutputPath' do
18
+ subject.output_path('Debug').should eq('bin\\Debug\\')
19
+ end
20
+ it 'should also have a Release OutputPath' do
21
+ subject.output_path('Release').should eq('bin\\Release\\')
22
+ subject.try_output_path('Release').should eq('bin\\Release\\')
23
+ end
24
+ it 'should raise "ConfigurationNotFoundEror" if not found' do
25
+ begin
26
+ subject.output_path('wazaaa')
27
+ rescue ::Albacore::ConfigurationNotFoundError
28
+ end
29
+ end
30
+ it 'should return nil with #try_output_path(conf)' do
31
+ subject.try_output_path('weeeo').should be_nil
32
+ end
33
+ it "should have three packages" do
34
+ subject.declared_packages.length.should == 3
35
+ end
36
+ it "should contain NLog" do
37
+ nlog.should_not be_nil
38
+ end
39
+ it "should have a four number on NLog" do
40
+ nlog.version.should eq("2.0.0.2000")
41
+ end
42
+ it "should have a semver number" do
43
+ nlog.semver.should eq(Albacore::SemVer.new(2, 0, 0))
44
+ end
16
45
  end
17
46
 
18
47
  describe Albacore::Project, "when reading project file" do
19
- subject {
48
+ subject do
20
49
  p = File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
21
50
  Albacore::Project.new(p)
22
- }
23
- let(:library1) { subject.included_files.find { |p| p.include == 'Library1.fs' } }
24
- it("should contain library1") { library1.should_not be_nil }
25
-
51
+ end
52
+ let :library1 do
53
+ subject.included_files.find { |p| p.include == 'Library1.fs' }
54
+ end
55
+ it "should contain library1" do
56
+ library1.should_not be_nil
57
+ end
58
+ end
59
+ describe Albacore::Project, 'when given a PathnameWrap' do
60
+ it 'should allow argument of PathnameWrap' do
61
+ require 'albacore/paths'
62
+ Albacore::Project.new(Paths::PathnameWrap.new(File.expand_path('../testdata/Project/Project.fsproj', __FILE__)))
63
+ end
26
64
  end
@@ -0,0 +1,21 @@
1
+ require 'albacore/paths'
2
+ require 'albacore/rake_overrides'
3
+
4
+ describe 'when overriding rake' do
5
+ it 'has string return value by default' do
6
+ ::Rake.old_original_dir.should be_an_instance_of String
7
+ end
8
+
9
+ it 'should override Rake#original_dir so that includes separator chars' do
10
+ # assume we never test from root of file system:
11
+ ::Rake.original_dir.should include(Paths.separator)
12
+ end
13
+
14
+ it 'should have #original_dir_path' do
15
+ ::Rake.should respond_to(:original_dir_path)
16
+ end
17
+
18
+ it 'should have #original_dir_path().to_s include the separator' do
19
+ ::Rake.original_dir_path.to_s.should include(Paths.separator)
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ require 'albacore'
2
+
3
+ describe 'absolutely nothing' do
4
+ it 'should pass' do ; end
5
+ end
@@ -23,6 +23,15 @@
23
23
  <WarningLevel>3</WarningLevel>
24
24
  <DocumentationFile>bin\Debug\Project.xml</DocumentationFile>
25
25
  </PropertyGroup>
26
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseXanna|AnyCPU' ">
27
+ <DebugType>pdbonly</DebugType>
28
+ <Optimize>true</Optimize>
29
+ <Tailcalls>true</Tailcalls>
30
+ <OutputPath>bin\Release\</OutputPath>
31
+ <DefineConstants>TRACE</DefineConstants>
32
+ <WarningLevel>3</WarningLevel>
33
+ <DocumentationFile>bin\Release\Project.xml</DocumentationFile>
34
+ </PropertyGroup>
26
35
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27
36
  <DebugType>pdbonly</DebugType>
28
37
  <Optimize>true</Optimize>
@@ -49,4 +58,4 @@
49
58
  <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
50
59
  </PropertyGroup>
51
60
  <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
52
- </Project>
61
+ </Project>
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: 2.0.0.rc.6
4
+ version: 2.0.0.rc.7
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-12 00:00:00.000000000 Z
13
+ date: 2014-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -189,7 +189,6 @@ files:
189
189
  - Guardfile
190
190
  - README.md
191
191
  - Rakefile
192
- - albacore-2.0.0.rc.5.gem
193
192
  - albacore.gemspec
194
193
  - lib/albacore.rb
195
194
  - lib/albacore/albacore_module.rb
@@ -208,6 +207,7 @@ files:
208
207
  - lib/albacore/nuget_model.rb
209
208
  - lib/albacore/paths.rb
210
209
  - lib/albacore/project.rb
210
+ - lib/albacore/rake_overrides.rb
211
211
  - lib/albacore/semver.rb
212
212
  - lib/albacore/task_types/asmver.rb
213
213
  - lib/albacore/task_types/asmver/cpp.rb
@@ -242,6 +242,7 @@ files:
242
242
  - spec/nuget_model_spec.rb
243
243
  - spec/nugets_pack_spec.rb
244
244
  - spec/nugets_restore_spec.rb
245
+ - spec/paths_spec.rb
245
246
  - spec/project_spec.rb
246
247
  - spec/projectlint/added_but_not_on_filesystem/aproject.csproj
247
248
  - spec/projectlint/correct/File.cs
@@ -254,7 +255,9 @@ files:
254
255
  - spec/projectlint/on_filesystem_but_not_added/Image.txt
255
256
  - spec/projectlint/on_filesystem_but_not_added/aproject.csproj
256
257
  - spec/projectlint_spec.rb
258
+ - spec/rake_overrides_spec.rb
257
259
  - spec/shared_contexts.rb
260
+ - spec/smoke_require_spec.rb
258
261
  - spec/smoke_spec.rb
259
262
  - spec/spec_helper.rb
260
263
  - spec/support/Nuget/NuGet.exe
@@ -324,7 +327,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
324
327
  version: '0'
325
328
  segments:
326
329
  - 0
327
- hash: -4498584903254051555
330
+ hash: 1819249028440337935
328
331
  required_rubygems_version: !ruby/object:Gem::Requirement
329
332
  none: false
330
333
  requirements:
@@ -351,6 +354,7 @@ test_files:
351
354
  - spec/nuget_model_spec.rb
352
355
  - spec/nugets_pack_spec.rb
353
356
  - spec/nugets_restore_spec.rb
357
+ - spec/paths_spec.rb
354
358
  - spec/project_spec.rb
355
359
  - spec/projectlint/added_but_not_on_filesystem/aproject.csproj
356
360
  - spec/projectlint/correct/File.cs
@@ -363,7 +367,9 @@ test_files:
363
367
  - spec/projectlint/on_filesystem_but_not_added/Image.txt
364
368
  - spec/projectlint/on_filesystem_but_not_added/aproject.csproj
365
369
  - spec/projectlint_spec.rb
370
+ - spec/rake_overrides_spec.rb
366
371
  - spec/shared_contexts.rb
372
+ - spec/smoke_require_spec.rb
367
373
  - spec/smoke_spec.rb
368
374
  - spec/spec_helper.rb
369
375
  - spec/support/Nuget/NuGet.exe
Binary file