albacore 2.0.0.rc.7 → 2.0.0.rc.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -170,19 +170,37 @@ end
170
170
 
171
171
  ### Docs: nugets_pack
172
172
 
173
- TBD
173
+ ```
174
+ nugets_pack :create_nugets do |p|
175
+ p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
176
+ exclude(/Tests/)
177
+ p.out = 'build/pkg'
178
+ p.exe = 'buildsupport/NuGet.exe'
179
+ p.with_metadata do |m|
180
+ m.description = 'A cool nuget'
181
+ m.authors = 'Henrik'
182
+ m.version = ENV['NUGET_VERSION']
183
+ end
184
+ p.with_package do |p|
185
+ p.add_file 'file/relative/to/proj', 'lib/net40'
186
+ end
187
+ end
188
+ ```
174
189
 
175
- #### #no_project_dependencies
190
+ #### nugets_pack Config##no_project_dependencies
176
191
 
177
192
  Cancel following of references between projects that cause nugets_pack to find and add as nuget dependencies, linked projects.
178
193
 
179
- ```
180
- # TODO
181
- ```
182
-
183
194
  ### Docs: nugets_restore
184
195
 
185
- TBD
196
+ Enables nuget restore throughout the solution.
197
+
198
+ ```
199
+ nugets_restore :restore do |p|
200
+ p.out = 'src/packages'
201
+ p.exe = 'buildsupport/NuGet.exe'
202
+ end
203
+ ```
186
204
 
187
205
  ### Docs: asmver
188
206
 
@@ -203,7 +221,13 @@ end
203
221
 
204
222
  ### Docs: test_runner
205
223
 
206
- TBD
224
+ ```
225
+ test_runner :tests do |tests|
226
+ tests.files = FileList['**/*.Tests/bin/Release/*.Tests.dll'] # dll files with test
227
+ tests.exe = 'src/packages/NUnit.Runners.2.5.3/tools/nunit-console.exe' # executable to run tests with
228
+ tests.copy_local # when running from network share
229
+ end
230
+ ```
207
231
 
208
232
  ### Docs: nugets_authentication
209
233
 
@@ -28,7 +28,6 @@ EOF
28
28
  s.add_dependency 'semver2', '~> 3.3'
29
29
  s.add_dependency 'ProcessPilot', '~> 2.0'
30
30
  s.add_dependency 'highline', '~> 1.6'
31
- s.add_dependency 'rubyzip', '=0.9.9'
32
31
 
33
32
  s.add_development_dependency 'rubygems-tasks', '~>0.2'
34
33
  s.add_development_dependency 'rspec', '>= 2.13'
@@ -68,13 +68,13 @@ module Albacore
68
68
  def system *cmd, &block
69
69
  raise ArgumentError, "cmd is nil" if cmd.nil? # don't allow nothing to be passed
70
70
  opts = Map.options((Hash === cmd.last) ? cmd.pop : {}). # same arg parsing as rake
71
- apply(
72
- silent: false,
73
- output: true,
74
- work_dir: FileUtils.pwd,
75
- out: Albacore.application.output,
76
- err: Albacore.application.output_err,
77
- clr_command: false)
71
+ apply({
72
+ :silent => false,
73
+ :output => true,
74
+ :work_dir => FileUtils.pwd,
75
+ :out => Albacore.application.output,
76
+ :err => Albacore.application.output_err,
77
+ :clr_command => false })
78
78
 
79
79
  exe, pars, printable, block = prepare_command cmd, (opts.get('clr_command')), &block
80
80
 
@@ -101,16 +101,13 @@ module Albacore
101
101
 
102
102
  debug 'execute the new process, letting it write to the write FD (file descriptor)'
103
103
  @pid = Process.spawn(*[exe, *pars],
104
- out: write,
105
- # err: ewrite,
106
- chdir: opts.get(:work_dir))
104
+ { :out => write,
105
+ #:err => ewrite,
106
+ :chdir => opts.get(:work_dir) })
107
107
 
108
108
  debug 'waiting for process completion'
109
109
  _, status = Process.wait2 @pid
110
110
 
111
- #debug 'waiting for thread completion'
112
- #@out_thread.join
113
-
114
111
  return block.call(status.success? && inmem.string, status, inmem.string)
115
112
  end
116
113
  end
@@ -66,11 +66,7 @@ module Albacore
66
66
  Albacore.define_task *args do
67
67
  c = Albacore::TestRunner::Config.new
68
68
  yield c
69
-
70
- c.files.each { |dll|
71
- command = Albacore::TestRunner::Cmd.new c.work_dir, c.exe, c.parameters, dll
72
- Albacore::TestRunner::Task.new(command).execute
73
- }
69
+ Albacore::TestRunner::Task.new(c.opts).execute
74
70
  end
75
71
  end
76
72
 
@@ -2,10 +2,13 @@ require 'albacore'
2
2
 
3
3
  module Albacore
4
4
  module Ext
5
+
5
6
  # The teamcity module writes appropriate build-script "interaction messages"
6
7
  # (see http://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-artPublishing)
7
8
  # to STDOUT.
9
+ #
8
10
  module TeamCity
11
+
9
12
  # Escaped the progress message
10
13
  # (see http://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ServiceMessages)
11
14
  # The Unicode symbol escape is not implemented
@@ -17,16 +20,18 @@ module Albacore
17
20
  # | (vertical bar) ||
18
21
  # [ (opening bracket) |[
19
22
  # ] (closing bracket) |]
23
+ #
20
24
  def self.escape message
21
25
  message.gsub(/([\[|\]|\|'])/, '|\1').gsub(/\n/, '|n').gsub(/\r/, '|r')
22
26
  end
27
+
23
28
  def self.configure
24
29
  Albacore.subscribe :artifact do |artifact|
25
30
  ::Albacore.puts "##teamcity[publishArtifacts '#{artifact.location}']"
26
31
  end
27
32
  Albacore.subscribe :build_version do |version|
28
33
  # tell teamcity our decision
29
- ::Albacore.puts "##teamcity[buildNumber '#{version.build_version}']"
34
+ ::Albacore.puts "##teamcity[buildNumber '#{version.build_number}']"
30
35
  end
31
36
  Albacore.subscribe :progress do |p|
32
37
  # tell teamcity of our progress
@@ -41,13 +46,17 @@ module Albacore
41
46
  finish_progress p.message
42
47
  end
43
48
  end
49
+
44
50
  private
51
+
45
52
  PROGRESS_QUEUE = []
53
+
46
54
  # Starts a new progress block
47
55
  def self.start_progress(name)
48
56
  PROGRESS_QUEUE.push name
49
57
  ::Albacore.puts "##teamcity[progressStart '#{escape name}']"
50
58
  end
59
+
51
60
  # Finishes the progress block and all child progress blocks
52
61
  def self.finish_progress(name = '')
53
62
  loop do
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ module Albacore
4
+ # a package encapsulates the properties of a set package with a
5
+ # distinct path, version and id
6
+ class Package
7
+
8
+ # id of the package as known by nuget
9
+ attr_reader :id
10
+
11
+ # path of the package in question
12
+ attr_reader :path
13
+
14
+ # create a new package with the given id and path
15
+ def initialize id, path
16
+ @id = id
17
+ @path = path
18
+ end
19
+
20
+ def to_s
21
+ "Package[#{path}]"
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'albacore/package'
3
+
4
+ module Albacore
5
+ # a package repository is a location where the nugets or wraps are stored
6
+ class PackageRepo
7
+ include Logging
8
+
9
+ # initialize that package repository with a path to all the packages
10
+ def initialize path
11
+ @path = path
12
+ end
13
+
14
+ # find the latest package based on the package id
15
+ def find_latest pkg_id
16
+ trace "finding latest from #{@path}, id: #{pkg_id}"
17
+ sorted = Dir.glob(File.join(@path, "#{pkg_id}*/**/*.dll")) # find the latest
18
+ path = sorted.first
19
+ Package.new pkg_id, path
20
+ end
21
+ end
22
+ end
23
+
@@ -1,6 +1,7 @@
1
1
  require 'nokogiri'
2
2
  require 'albacore/logging'
3
3
  require 'albacore/semver'
4
+ require 'albacore/package_repo'
4
5
 
5
6
  module Albacore
6
7
 
@@ -58,12 +59,21 @@ module Albacore
58
59
  nil
59
60
  end
60
61
 
62
+ # This is the output path if the project file doens't have a configured
63
+ # 'Configuration' condition like all default project files have that come
64
+ # from Visual Studio/Xamarin Studio.
61
65
  def fallback_output_path
62
66
  fallback = @proj_xml_node.css("Project PropertyGroup OutputPath").first
63
67
  condition = fallback.parent['Condition'] || 'No \'Condition\' specified'
64
68
  warn "chose an OutputPath in: '#{self}' for Configuration: <#{condition}> [albacore: project]"
65
69
  fallback.inner_text
66
70
  end
71
+
72
+ # Gets the relative location (to the project base path) of the dll
73
+ # that it will output
74
+ def output_dll conf
75
+ Paths.join(output_path(conf) || fallback_output_path, "#{asmname}.dll")
76
+ end
67
77
 
68
78
  # find the NodeList reference list
69
79
  def find_refs
@@ -122,7 +132,7 @@ module Albacore
122
132
  # returns enumerable Package
123
133
  def find_packages
124
134
  declared_packages.collect do |package|
125
- guess = PackageRepo.new('./src/packages').find_latest package['id']
135
+ guess = ::Albacore::PackageRepo.new('./src/packages').find_latest package.id
126
136
  debug "#{name}: guess: #{guess} [albacore: project]"
127
137
  guess
128
138
  end
@@ -134,8 +144,9 @@ module Albacore
134
144
  end
135
145
 
136
146
  # save the xml
137
- def save
138
- File.open(path, 'w') { |f| @proj_xml_node.write_xml_to f }
147
+ def save(output = nil)
148
+ output = path unless output
149
+ File.open(output, 'w') { |f| @proj_xml_node.write_xml_to f }
139
150
  end
140
151
 
141
152
  # get the path of 'packages.config'
@@ -12,9 +12,18 @@ module Albacore::Asmver
12
12
  def build_attribute_re(attr_name)
13
13
  /^\[assembly: #{attr_name}(.+)/
14
14
  end
15
+
16
+ def namespace_start ns
17
+ "namespace #{ns.gsub /\./, '::'} {"
18
+ end
19
+
20
+ def namespace_end
21
+ "}\n"
22
+ end
15
23
 
16
24
  def build_using_statement(namespace)
17
25
  "using namespace #{namespace.gsub(/\./, '::')};"
18
26
  end
27
+
19
28
  end
20
29
  end
@@ -14,6 +14,14 @@ module Albacore::Asmver
14
14
  /^\<assembly: #{attr_name}(.+)/i
15
15
  end
16
16
 
17
+ def namespace_start ns
18
+ ""
19
+ end
20
+
21
+ def namespace_end
22
+ ""
23
+ end
24
+
17
25
  # override
18
26
  def comment_singleline_token
19
27
  '\''
@@ -1,5 +1,8 @@
1
- require 'rake'
2
1
  require 'set'
2
+ require 'map'
3
+ require 'tmpdir'
4
+ require 'fileutils'
5
+ require 'pathname'
3
6
  require 'albacore/cmd_config'
4
7
  require 'albacore/cross_platform_cmd'
5
8
 
@@ -10,15 +13,45 @@ module Albacore
10
13
  def initialize work_dir, executable, parameters, file
11
14
  @work_dir, @executable = work_dir, executable
12
15
  @parameters = parameters.to_a.unshift(file)
13
- mono_command
14
16
  end
17
+
15
18
  def execute
16
- system @executable, @parameters, :work_dir => @work_dir
19
+ system @executable,
20
+ @parameters,
21
+ :work_dir => @work_dir,
22
+ :clr_command => true
17
23
  end
18
24
  end
25
+
26
+ # the configuration object for the test runner
19
27
  class Config
20
28
  include CmdConfig
29
+
30
+ # give this property the list of dlls you want to test
21
31
  attr_writer :files
32
+
33
+ # constructor, no parameters
34
+ def initialize
35
+ @copy_local = false
36
+ @files = []
37
+ end
38
+
39
+ # gets the configured options
40
+ def opts
41
+ Map.new(
42
+ :files => files,
43
+ :copy_local => @copy_local,
44
+ :exe => @exe)
45
+ end
46
+
47
+ # mark that it should be possible to copy the test files local
48
+ # -- this is great if you are running a VM and the host disk is
49
+ # mapped as a network drive, which crashes some test runners
50
+ def copy_local
51
+ @copy_local = true
52
+ end
53
+
54
+ private
22
55
  def files
23
56
  if @files.respond_to? :each
24
57
  @files
@@ -27,12 +60,51 @@ module Albacore
27
60
  end
28
61
  end
29
62
  end
63
+
30
64
  class Task
31
- def initialize command_line
32
- @command_line = command_line
65
+ include Logging
66
+
67
+ def initialize opts
68
+ @opts = opts
33
69
  end
70
+
34
71
  def execute
35
- @command_line.execute
72
+ raise ArgumentError, 'missing :exe' unless @opts.get :exe
73
+ raise ArgumentError, 'missing :files' unless @opts.get :files
74
+ @opts.get(:files).each do |dll|
75
+ raise ArgumentError, "could not find test dll '#{dll}' in dir #{FileUtils.pwd}" unless File.exists? dll
76
+ execute_tests_for dll
77
+ end
78
+ end
79
+
80
+ private
81
+ def execute_tests_for dll
82
+ handle_directory dll, @opts.get(:exe) do |dir, exe|
83
+ filename = File.basename dll
84
+ cmd = Albacore::TestRunner::Cmd.new dir, exe, @opts.get(:parameters, []), filename
85
+ cmd.execute
86
+ end
87
+ end
88
+ def handle_directory dll, exe, &block
89
+ if @opts.get(:copy_local)
90
+ Dir.mktmpdir 'alba-test' do |dir|
91
+ sut, runners = Paths.join(dir, 'sut').to_s, Paths.join(dir, 'runners').to_s
92
+ [sut, runners].each { |d| FileUtils.mkdir_p d }
93
+
94
+ sut_glob = Paths.join(File.dirname(dll), '*').as_unix.to_s
95
+ debug { "copying recursively from #{sut_glob} [test_runner #handle_directory]" }
96
+ FileUtils.cp_r(Dir.glob(sut_glob), sut, :verbose => true)
97
+
98
+ runners_glob = Paths.join(File.dirname(exe), '*').as_unix.to_s
99
+ debug { "copying the runners form #{runners_glob} [test_runner #handle_directory]" }
100
+ FileUtils.cp_r(Dir.glob(runners_glob), runners, :verbose => true)
101
+
102
+ # call back with the new paths
103
+ yield [sut, Paths.join(runners, File.basename(exe)).to_s]
104
+ end
105
+ else
106
+ yield [File.dirname(dll), exe]
107
+ end
36
108
  end
37
109
  end
38
110
  end
@@ -22,28 +22,39 @@ module Albacore
22
22
  #
23
23
  def self.new *sym
24
24
  ver = XSemVer::SemVer.find
25
- revision = (ENV['BUILD_NUMBER'] || ver.patch).to_i
26
- ver = XSemVer::SemVer.new(ver.major, ver.minor, revision, ver.special)
25
+ ver.patch = (ENV['BUILD_NUMBER'] || ver.patch).to_i
26
+ version_data = versions(ver, &method(:commit_data))
27
27
 
28
- # extensible number w/ git hash
29
- ENV['BUILD_VERSION'] = ver.format("%M.%m.%p%s") + ".#{commit_data()[0]}"
30
-
31
- # nuget (not full semver 2.0.0-rc.1 support) see http://nuget.codeplex.com/workitem/1796
32
- ENV['NUGET_VERSION'] = ver.format("%M.%m.%p%s")
33
-
34
- # purely M.m.p format
35
- ENV['FORMAL_VERSION'] = "#{ XSemVer::SemVer.new(ver.major, ver.minor, revision).format "%M.%m.%p"}"
36
-
37
- body = proc {
38
- Albacore.publish :build_version, OpenStruct.new(
39
- :build_number => revision,
40
- :build_version => ENV['BUILD_VERSION'],
41
- :semver => ver,
42
- :formal_version => ENV['FORMAL_VERSION']
43
- )
44
- }
28
+ Albacore.subscribe :build_version do |data|
29
+ ENV['BUILD_VERSION'] = data.build_version
30
+ ENV['NUGET_VERSION'] = data.nuget_version
31
+ ENV['FORMAL_VERSION'] = data.formal_version
32
+ ENV['LONG_VERSION'] = data.long_version
33
+ end
45
34
 
46
- Albacore.define_task *sym, &body
35
+ Albacore.define_task(*sym) do
36
+ Albacore.publish :build_version, OpenStruct.new(version_data)
37
+ end
38
+ end
39
+
40
+ def self.versions semver, &commit_data
41
+ {
42
+ # just a monotonic inc
43
+ :build_number => semver.patch,
44
+ :semver => semver,
45
+
46
+ # purely M.m.p format
47
+ :formal_version => "#{ XSemVer::SemVer.new(semver.major, semver.minor, semver.patch).format "%M.%m.%p"}",
48
+
49
+ # four-numbers version, useful if you're dealing with COM/Windows
50
+ :long_version => "#{semver.format '%M.%m.%p'}.0",
51
+
52
+ # extensible number w/ git hash
53
+ :build_version => semver.format("%M.%m.%p%s") + ".#{yield[0]}",
54
+
55
+ # nuget (not full semver 2.0.0-rc.1 support) see http://nuget.codeplex.com/workitem/1796
56
+ :nuget_version => semver.format("%M.%m.%p%s")
57
+ }
47
58
  end
48
59
 
49
60
  # load the commit data
@@ -53,10 +64,10 @@ module Albacore
53
64
  begin
54
65
  commit = `git rev-parse --short HEAD`.chomp()[0,6]
55
66
  git_date = `git log -1 --date=iso --pretty=format:%ad`
56
- commit_date = DateTime.parse( git_date ).strftime("%Y-%m-%d %H%M%S")
57
- rescue Exception => e
67
+ commit_date = DateTime.parse( git_date ).strftime("%Y-%m-%d %H:%M:%S")
68
+ rescue
58
69
  commit = (ENV['BUILD_VCS_NUMBER'] || "000000")[0,6]
59
- commit_date = Time.new.strftime("%Y-%m-%d %H%M%S")
70
+ commit_date = Time.new.strftime("%Y-%m-%d %H:%M:%S")
60
71
  end
61
72
  [commit, commit_date]
62
73
  end
@@ -5,39 +5,10 @@ require 'pathname'
5
5
  require 'rake'
6
6
  require 'albacore/logging'
7
7
  require 'albacore/project'
8
+ require 'albacore/package'
9
+ require 'albacore/package_repo'
8
10
 
9
11
  module Albacore::Tools
10
- # a package repository is a location where the nugets or wraps are stored
11
- class PackageRepo
12
- include Logging
13
- # initialize that package repository with a path to all the packages
14
- def initialize path
15
- @path = path
16
- end
17
- # find the latest package based on the package id
18
- def find_latest pkg_id
19
- trace "finding latest from #{@path}, id: #{pkg_id}"
20
- sorted = Dir.glob(File.join(@path, "#{pkg_id}*/**/*.dll")) # find the latest
21
- path = sorted.first
22
- Package.new pkg_id, path
23
- end
24
- end
25
-
26
- # a package encapsulates the properties of a set package with a
27
- # distinct path, version and id
28
- class Package
29
- attr_reader :id, :path
30
- def initialize id, path
31
- @id = id
32
- @path = path
33
- end
34
- def path
35
- @path
36
- end
37
- def to_s
38
- "Package[#{@path}]"
39
- end
40
- end
41
12
 
42
13
  # a tuple of a package and a ref
43
14
  class MatchedRef
@@ -46,7 +17,6 @@ module Albacore::Tools
46
17
  @package, @ref = package, ref
47
18
  end
48
19
  end
49
-
50
20
 
51
21
  module RestoreHintPaths
52
22
  class Config
@@ -1,3 +1,3 @@
1
1
  module Albacore
2
- VERSION = "2.0.0.rc.7"
2
+ VERSION = "2.0.0.rc.8"
3
3
  end
@@ -5,15 +5,18 @@ include Albacore::Asmver
5
5
 
6
6
  %w|Fs Vb Cpp Cs|.each do |lang|
7
7
  require "albacore/task_types/asmver/#{lang.downcase}"
8
+
8
9
  describe "the #{lang} engine" do
9
10
  subject do
10
11
  "Albacore::Asmver::#{lang}".split('::').inject(Object) { |o, c| o.const_get c }.new
11
12
  end
13
+
12
14
  %w|build_attribute build_named_parameters build_positional_parameters build_using_statement build_comment namespace_end namespace_start|.each do |m|
13
15
  it "should have a public API ##{m.to_s}" do
14
16
  should respond_to(:"#{m}")
15
17
  end
16
18
  end
19
+
17
20
  describe 'when building version attribute' do
18
21
  let :version do
19
22
  subject.build_attribute 'AssemblyVersion', '0.2.3'
@@ -28,6 +31,7 @@ include Albacore::Asmver
28
31
  version.should include('assembly: ')
29
32
  end
30
33
  end
34
+
31
35
  describe 'when building using statement' do
32
36
  let :using do
33
37
  subject.build_using_statement 'System.Runtime.CompilerServices'
@@ -36,6 +40,7 @@ include Albacore::Asmver
36
40
  using.should =~ /System.{1,2}Runtime.{1,2}CompilerServices/
37
41
  end
38
42
  end
43
+
39
44
  describe 'when building named parameters' do
40
45
  let :plist do
41
46
  subject.build_named_parameters milk_cows: true, birds_fly: false, hungry_server: 'sad server'
@@ -44,6 +49,7 @@ include Albacore::Asmver
44
49
  plist.should =~ /milk_cows .{1,2} true. birds_fly .{1,2} false. hungry_server .{1,2} "sad server"/
45
50
  end
46
51
  end
52
+
47
53
  describe 'when building positional parameters' do
48
54
  let :plist do
49
55
  subject.build_positional_parameters ((%w|a b c hello|) << false)
@@ -52,6 +58,7 @@ include Albacore::Asmver
52
58
  plist.should eq('"a", "b", "c", "hello", false')
53
59
  end
54
60
  end
61
+
55
62
  describe 'when building single line comment' do
56
63
  let :comment do
57
64
  subject.build_comment 'this is my comment'
@@ -70,6 +77,7 @@ include Albacore::Asmver
70
77
  comment.should =~ expected
71
78
  end
72
79
  end
80
+
73
81
  describe 'when building a multi-line comment' do
74
82
  let :comment do
75
83
  subject.build_comment %{This is a very interesting comment
@@ -97,8 +105,28 @@ on many lines}
97
105
  comment.should eq(expected)
98
106
  end
99
107
  end
108
+
109
+ describe 'when building namespace' do
110
+ let :ns do
111
+ subject.send :namespace_start, 'This.Ns.Here'
112
+ end
113
+ it 'should include the string verbatim' do
114
+ ns =~ /This\.Ns\.Here/
115
+ end
116
+ let :expected do
117
+ { 'Fs' => %r{namespace This\.Ns\.Here},
118
+ 'Vb' => %r{^$},
119
+ 'Cs' => %r{^$},
120
+ 'Cpp' => %r{namespace This::Ns::Here \{}
121
+ }[lang]
122
+ end
123
+ it 'should include the correct syntax for single line comment' do
124
+ ns.should =~ expected
125
+ end
126
+ end
100
127
  end
101
128
  end
129
+
102
130
  describe FileGenerator do
103
131
  subject do FileGenerator.new(Fs.new, 'MyNamespace.Here', {}) end
104
132
  it do
@@ -108,6 +136,7 @@ describe FileGenerator do
108
136
  FileGenerator.new(Fs.new, '', {})
109
137
  end
110
138
  end
139
+
111
140
  describe FileGenerator, 'when generating F# file' do
112
141
  before :all do
113
142
  @out = StringIO.new
@@ -153,6 +182,7 @@ describe FileGenerator, 'when generating F# file' do
153
182
  generated.should =~ /\(\)(\r\n?|\n)$/m
154
183
  end
155
184
  end
185
+
156
186
  describe FileGenerator do
157
187
  before :all do
158
188
  @out = StringIO.new
@@ -0,0 +1,10 @@
1
+ require 'albacore/package_repo'
2
+
3
+ describe ::Albacore::PackageRepo do
4
+ subject do
5
+ PackageRepo.new '.'
6
+ end
7
+ it 'can find latest amongst a number of packages in the repo' do
8
+ should respond_to(:find_latest)
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ require 'albacore/package'
2
+
3
+ describe ::Albacore::Package do
4
+ subject do
5
+ Package.new 'NLog', 'path/to/asm.dll'
6
+ end
7
+ it do
8
+ should respond_to :id
9
+ end
10
+ it do
11
+ should respond_to :path
12
+ end
13
+ it do
14
+ should respond_to :to_s
15
+ end
16
+ it 'has id' do
17
+ subject.id.should eq 'NLog'
18
+ end
19
+ it 'has path' do
20
+ subject.path.should eq 'path/to/asm.dll'
21
+ end
22
+ it 'formats with #to_s' do
23
+ subject.to_s.should eq 'Package[path/to/asm.dll]'
24
+ end
25
+ end
@@ -45,9 +45,11 @@ describe Albacore::Project, "when loading packages.config" do
45
45
  end
46
46
 
47
47
  describe Albacore::Project, "when reading project file" do
48
+ def project_path
49
+ File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
50
+ end
48
51
  subject do
49
- p = File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
50
- Albacore::Project.new(p)
52
+ Albacore::Project.new project_path
51
53
  end
52
54
  let :library1 do
53
55
  subject.included_files.find { |p| p.include == 'Library1.fs' }
@@ -55,7 +57,42 @@ describe Albacore::Project, "when reading project file" do
55
57
  it "should contain library1" do
56
58
  library1.should_not be_nil
57
59
  end
60
+
61
+ describe 'public API' do
62
+ it do
63
+ subject.should respond_to(:name)
64
+ end
65
+ it do
66
+ subject.should respond_to(:asmname)
67
+ end
68
+ it do
69
+ subject.should respond_to(:version)
70
+ end
71
+ it do
72
+ subject.should respond_to(:authors)
73
+ end
74
+ it 'should have five referenced assemblies' do
75
+ subject.find_refs.length.should eq(5)
76
+ end
77
+ it 'knows about referenced packages' do
78
+ subject.should respond_to(:declared_packages)
79
+ end
80
+ it 'knows about referenced projects' do
81
+ subject.should respond_to(:declared_projects)
82
+ end
83
+ it 'should have three referenced packages' do
84
+ expected = %w|Intelliplan.Util Newtonsoft.Json NLog|
85
+ subject.find_packages.map(&:id).should eq(expected)
86
+ end
87
+
88
+ # TODO: check whether output is DLL or EXE or something else
89
+ it 'should know its output dll' do
90
+ should respond_to :output_dll
91
+ subject.output_dll('Release').should eq(Paths.join 'bin', 'Release', 'Project.dll')
92
+ end
93
+ end
58
94
  end
95
+
59
96
  describe Albacore::Project, 'when given a PathnameWrap' do
60
97
  it 'should allow argument of PathnameWrap' do
61
98
  require 'albacore/paths'
@@ -1,5 +1,6 @@
1
1
  require 'albacore'
2
2
  require 'albacore/tasks/versionizer'
3
+ require 'xsemver'
3
4
 
4
5
  describe 'adding versionizer to a class' do
5
6
  class VersioniserUsage
@@ -15,3 +16,49 @@ describe 'adding versionizer to a class' do
15
16
  end
16
17
  end
17
18
  end
19
+
20
+ describe 'finding build versions' do
21
+ subject do
22
+ ver = XSemVer::SemVer.new(1, 2, 3, 'deadbeef')
23
+ ::Albacore::Tasks::Versionizer.versions ver do
24
+ ['123456', '2014-02-27 16:55:55']
25
+ end
26
+ end
27
+
28
+ it 'should return a hash' do
29
+ subject.should be_a(Hash)
30
+ end
31
+
32
+ it 'should return the correct build number' do
33
+ subject[:build_number].should eq(3)
34
+ end
35
+
36
+ it 'should return the same semver' do
37
+ subject[:semver].should eq(::XSemVer::SemVer.new(1, 2, 3, 'deadbeef'))
38
+ end
39
+
40
+ it 'should return the correct long_version' do
41
+ subject[:long_version].should eq('1.2.3.0')
42
+ end
43
+
44
+ it 'should return the correct formal_version' do
45
+ subject[:formal_version].should eq('1.2.3')
46
+ end
47
+
48
+ it 'should return a build_version' do
49
+ subject[:build_version].should_not be_nil
50
+ end
51
+
52
+ it 'should return a build_version with correct hash/special substring' do
53
+ subject[:build_version].should eq('1.2.3-deadbeef.123456')
54
+ end
55
+
56
+ it 'should return a nuget_version' do
57
+ subject[:nuget_version].should_not be_nil
58
+ end
59
+
60
+ it 'should return a proper semver nuget version' do
61
+ subject[:nuget_version].should eq('1.2.3-deadbeef')
62
+ end
63
+ end
64
+
@@ -0,0 +1,38 @@
1
+ require 'albacore/task_types/test_runner'
2
+ require 'map'
3
+
4
+ describe ::Albacore::TestRunner::Config do
5
+ it do
6
+ should respond_to :opts
7
+ end
8
+ it do
9
+ should respond_to :files=
10
+ end
11
+ it do
12
+ should_not respond_to :files
13
+ end
14
+ it do
15
+ should respond_to :copy_local
16
+ end
17
+ it do
18
+ should respond_to :exe=
19
+ end
20
+ end
21
+
22
+ describe ::Albacore::TestRunner::Cmd do
23
+ subject do
24
+ ::Albacore::TestRunner::Cmd.new 'work_dir', 'run-tests.exe', %w[params go here], 'lib.tests.dll'
25
+ end
26
+ it do
27
+ should respond_to :execute
28
+ end
29
+ end
30
+
31
+ describe ::Albacore::TestRunner::Task do
32
+ subject do
33
+ ::Albacore::TestRunner::Task.new Map.new
34
+ end
35
+ it do
36
+ should respond_to :execute
37
+ end
38
+ 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: 2.0.0.rc.7
4
+ version: 2.0.0.rc.8
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-02-13 00:00:00.000000000 Z
13
+ date: 2014-03-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -124,22 +124,6 @@ dependencies:
124
124
  - - ~>
125
125
  - !ruby/object:Gem::Version
126
126
  version: '1.6'
127
- - !ruby/object:Gem::Dependency
128
- name: rubyzip
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
- requirements:
132
- - - '='
133
- - !ruby/object:Gem::Version
134
- version: 0.9.9
135
- type: :runtime
136
- prerelease: false
137
- version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
- requirements:
140
- - - '='
141
- - !ruby/object:Gem::Version
142
- version: 0.9.9
143
127
  - !ruby/object:Gem::Dependency
144
128
  name: rubygems-tasks
145
129
  requirement: !ruby/object:Gem::Requirement
@@ -205,6 +189,8 @@ files:
205
189
  - lib/albacore/facts.rb
206
190
  - lib/albacore/logging.rb
207
191
  - lib/albacore/nuget_model.rb
192
+ - lib/albacore/package.rb
193
+ - lib/albacore/package_repo.rb
208
194
  - lib/albacore/paths.rb
209
195
  - lib/albacore/project.rb
210
196
  - lib/albacore/rake_overrides.rb
@@ -242,6 +228,8 @@ files:
242
228
  - spec/nuget_model_spec.rb
243
229
  - spec/nugets_pack_spec.rb
244
230
  - spec/nugets_restore_spec.rb
231
+ - spec/package_repo_spec.rb
232
+ - spec/package_spec.rb
245
233
  - spec/paths_spec.rb
246
234
  - spec/project_spec.rb
247
235
  - spec/projectlint/added_but_not_on_filesystem/aproject.csproj
@@ -275,6 +263,7 @@ files:
275
263
  - spec/support/returnstatus/returnstatus.pdb
276
264
  - spec/support/sh_interceptor.rb
277
265
  - spec/tasks/versionizer_spec.rb
266
+ - spec/test_runner_spec.rb
278
267
  - spec/testdata/.gitignore
279
268
  - spec/testdata/DebugProject/.gitignore
280
269
  - spec/testdata/DebugProject/Degbu.fsproj
@@ -327,7 +316,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
316
  version: '0'
328
317
  segments:
329
318
  - 0
330
- hash: 1819249028440337935
319
+ hash: 3238636988153789761
331
320
  required_rubygems_version: !ruby/object:Gem::Requirement
332
321
  none: false
333
322
  requirements:
@@ -354,6 +343,8 @@ test_files:
354
343
  - spec/nuget_model_spec.rb
355
344
  - spec/nugets_pack_spec.rb
356
345
  - spec/nugets_restore_spec.rb
346
+ - spec/package_repo_spec.rb
347
+ - spec/package_spec.rb
357
348
  - spec/paths_spec.rb
358
349
  - spec/project_spec.rb
359
350
  - spec/projectlint/added_but_not_on_filesystem/aproject.csproj
@@ -387,6 +378,7 @@ test_files:
387
378
  - spec/support/returnstatus/returnstatus.pdb
388
379
  - spec/support/sh_interceptor.rb
389
380
  - spec/tasks/versionizer_spec.rb
381
+ - spec/test_runner_spec.rb
390
382
  - spec/testdata/.gitignore
391
383
  - spec/testdata/DebugProject/.gitignore
392
384
  - spec/testdata/DebugProject/Degbu.fsproj