albacore 2.8.0 → 3.0.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/albacore/cli.rb +2 -2
- data/lib/albacore/dsl.rb +2 -42
- data/lib/albacore/nuget_model.rb +173 -67
- data/lib/albacore/paket.rb +20 -5
- data/lib/albacore/paths.rb +1 -0
- data/lib/albacore/project.rb +228 -45
- data/lib/albacore/task_types/nugets_pack.rb +73 -425
- data/lib/albacore/task_types/sql_cmd.rb +1 -1
- data/lib/albacore/tasks/release.rb +2 -2
- data/lib/albacore/version.rb +1 -1
- data/spec/dsl_spec.rb +1 -1
- data/spec/nuget_model_spec.rb +208 -79
- data/spec/nugets_pack_spec.rb +1 -353
- data/spec/paket_spec.rb +51 -2
- data/spec/project_spec.rb +118 -43
- data/spec/shared_contexts.rb +28 -14
- data/spec/testdata/Project/Project.fsproj +1 -1
- data/spec/testdata/console-core-argu/.gitignore +4 -0
- data/spec/testdata/console-core-argu/.paket/Paket.Restore.targets +239 -0
- data/spec/testdata/console-core-argu/.paket/paket.exe +0 -0
- data/spec/testdata/console-core-argu/.paket/paket.targets +72 -0
- data/spec/testdata/console-core-argu/ConsoleArgu.fsproj +12 -0
- data/spec/testdata/console-core-argu/Library.fs +31 -0
- data/spec/testdata/console-core-argu/build.sh +4 -0
- data/spec/testdata/console-core-argu/paket.dependencies +3 -0
- data/spec/testdata/console-core-argu/paket.lock +565 -0
- data/spec/testdata/console-core-argu/paket.references +2 -0
- data/spec/testdata/console-core-argu/paket.template +1 -0
- metadata +26 -16
- data/lib/albacore/app_spec.rb +0 -229
- data/lib/albacore/cpack_app_spec.rb +0 -135
- data/lib/albacore/task_types/nugets.rb +0 -8
- data/lib/albacore/task_types/nugets_restore.rb +0 -181
- data/spec/app_spec_spec.rb +0 -147
- data/spec/fpm_app_spec_spec.rb +0 -157
- data/spec/nugets_find_gem_exe_spec.rb +0 -21
- data/spec/nugets_restore_spec.rb +0 -77
data/spec/nugets_pack_spec.rb
CHANGED
@@ -5,356 +5,4 @@ require 'shared_contexts'
|
|
5
5
|
require 'support/sh_interceptor'
|
6
6
|
require 'albacore'
|
7
7
|
require 'albacore/task_types/nugets_pack'
|
8
|
-
require 'albacore/nuget_model'
|
9
|
-
|
10
|
-
include ::Albacore::NugetsPack
|
11
|
-
|
12
|
-
# The .NET Framework / .NET Standard specified by default
|
13
|
-
DEFAULT_FRAMEWORK = 'net461'
|
14
|
-
|
15
|
-
class ConfigFac
|
16
|
-
def self.create id, curr, target, gen_symbols = true
|
17
|
-
cfg = Albacore::NugetsPack::Config.new
|
18
|
-
cfg.target = target
|
19
|
-
cfg.configuration = 'Debug'
|
20
|
-
cfg.files = Dir.glob(File.join(curr, 'testdata', 'Project', '*.fsproj'))
|
21
|
-
cfg.out = 'spec/testdata/pkg'
|
22
|
-
cfg.exe = 'NuGet.exe'
|
23
|
-
cfg.with_metadata do |m|
|
24
|
-
m.id = id
|
25
|
-
m.authors = 'haf'
|
26
|
-
m.owners = 'haf owner'
|
27
|
-
m.description = 'a nice lib'
|
28
|
-
m.language = 'Danish'
|
29
|
-
m.project_url = 'https://github.com/haf/Reasonable'
|
30
|
-
m.license_url = 'https://github.com/haf/README.md'
|
31
|
-
m.version = '0.2.3'
|
32
|
-
m.release_notes = %{
|
33
|
-
v10.0.0:
|
34
|
-
- Some notes
|
35
|
-
}
|
36
|
-
m.require_license_acceptance = false
|
37
|
-
|
38
|
-
m.add_dependency 'Abc.Package', '>= 1.0.2'
|
39
|
-
m.add_framework_dependency 'System.Transactions', '4.0.0'
|
40
|
-
end
|
41
|
-
cfg.gen_symbols if gen_symbols # files: *.{pdb,dll,all compiled files}
|
42
|
-
cfg
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
shared_context 'pack_config' do
|
47
|
-
let :id do
|
48
|
-
'Sample.Nuget'
|
49
|
-
end
|
50
|
-
let :curr do
|
51
|
-
File.dirname(__FILE__)
|
52
|
-
end
|
53
|
-
let :config do
|
54
|
-
cfg = ConfigFac.create id, curr, DEFAULT_FRAMEWORK, true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
shared_context 'pack_config no symbols' do
|
59
|
-
let :id do
|
60
|
-
'Sample.Nuget'
|
61
|
-
end
|
62
|
-
let :curr do
|
63
|
-
File.dirname(__FILE__)
|
64
|
-
end
|
65
|
-
let :config do
|
66
|
-
cfg = ConfigFac.create id, curr, DEFAULT_FRAMEWORK, false
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe Albacore::NugetsPack::Config, 'when setting #nuget_gem_exe' do
|
71
|
-
it 'should be set to path that exists' do
|
72
|
-
subject.nuget_gem_exe
|
73
|
-
expect(subject.exe).to be_a String
|
74
|
-
expect(File.exists?( subject.exe)).to be true
|
75
|
-
end
|
76
|
-
end
|
77
|
-
# testing the command for nuget
|
78
|
-
|
79
|
-
describe Cmd, "when calling #execute" do
|
80
|
-
|
81
|
-
include_context 'path testing'
|
82
|
-
|
83
|
-
let :cmd do
|
84
|
-
Cmd.new 'NuGet.exe', config.opts()
|
85
|
-
end
|
86
|
-
|
87
|
-
subject do
|
88
|
-
cmd.extend ShInterceptor
|
89
|
-
cmd.execute './spec/testdata/example.nuspec', './spec/testdata/example.symbols.nuspec'
|
90
|
-
#puts "## INVOCATIONS:"
|
91
|
-
#cmd.invocations.each do |i|
|
92
|
-
# puts "#{i}"
|
93
|
-
#end
|
94
|
-
cmd
|
95
|
-
end
|
96
|
-
|
97
|
-
describe "first invocation" do
|
98
|
-
include_context 'pack_config'
|
99
|
-
it "should run the correct executable" do
|
100
|
-
expect(subject.mono_command(0)).to eq('NuGet.exe')
|
101
|
-
end
|
102
|
-
it "should include the correct parameters" do
|
103
|
-
expect(subject.mono_parameters(0)).to eq(%W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} ./spec/testdata/example.nuspec])
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe "second invocation" do
|
108
|
-
include_context 'pack_config'
|
109
|
-
it "should include -Symbols" do
|
110
|
-
expect(subject.mono_parameters(1)).to eq(%W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} -Symbols ./spec/testdata/example.symbols.nuspec])
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "without symbols" do
|
115
|
-
include_context 'pack_config no symbols'
|
116
|
-
subject do
|
117
|
-
cmd.extend ShInterceptor
|
118
|
-
cmd.execute './spec/testdata/example.nuspec'
|
119
|
-
cmd
|
120
|
-
end
|
121
|
-
it 'should not include -Symbols' do
|
122
|
-
expect(subject.mono_parameters(0)).to eq(%W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} ./spec/testdata/example.nuspec])
|
123
|
-
end
|
124
|
-
it 'should not have a second invocation' do
|
125
|
-
expect(subject.invocations.length).to eq(1)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
describe Cmd, 'when calling :get_nuget_path_of' do
|
131
|
-
include_context 'pack_config'
|
132
|
-
|
133
|
-
subject do
|
134
|
-
Cmd.new 'NuGet.exe', config.opts()
|
135
|
-
end
|
136
|
-
|
137
|
-
let :sample1 do
|
138
|
-
<<EXAMPLE_OUTPUT
|
139
|
-
Attempting to build package from 'MyNuget.Package.nuspec'.
|
140
|
-
Successfully created package 'Y:\\Shared\\build\\pkg\\MyNuget.Package.1.0.0.nupkg'.
|
141
|
-
Successfully created package 'Y:\\Shared\\build\\pkg\\MyNuget.Package.1.0.0.symbols.nupkg'.
|
142
|
-
EXAMPLE_OUTPUT
|
143
|
-
end
|
144
|
-
|
145
|
-
let :sample2 do
|
146
|
-
<<EXAMPLE_OUTPUT
|
147
|
-
Attempting to build package from 'MyNuget.Package.nuspec'.
|
148
|
-
Successfully created package '/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0.nupkg'.
|
149
|
-
Successfully created package '/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0.symbols.nupkg'.
|
150
|
-
EXAMPLE_OUTPUT
|
151
|
-
end
|
152
|
-
|
153
|
-
let :sample3 do
|
154
|
-
<<EXAMPLE_OUTPUT
|
155
|
-
Attempting to build package from 'MyNuget.Package.nuspec'.
|
156
|
-
Successfully created package '/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0-alpha3.nupkg'.
|
157
|
-
Successfully created package '/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0-alpha3.symbols.nupkg'.
|
158
|
-
EXAMPLE_OUTPUT
|
159
|
-
end
|
160
|
-
|
161
|
-
let :sample4 do
|
162
|
-
<<EXAMPLE_OUTPUT
|
163
|
-
Attempting to build package from 'MyNuget.Package.nuspec'.
|
164
|
-
Successfully created package '/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0-alpha.nupkg'.
|
165
|
-
EXAMPLE_OUTPUT
|
166
|
-
end
|
167
|
-
|
168
|
-
let :sample5 do
|
169
|
-
<<EXAMPLE_OUTPUT
|
170
|
-
Attempting to build package from 'Fröken.nuspec'.
|
171
|
-
Successfully created package '/home/xyz/Shared/build/pkg/Fröken.1.0.0-alpha.nupkg'.
|
172
|
-
EXAMPLE_OUTPUT
|
173
|
-
end
|
174
|
-
|
175
|
-
it "should match sample1 with last nupkg mentioned" do
|
176
|
-
match = subject.send(:get_nuget_path_of) { sample1 }
|
177
|
-
expect(match).to eq('Y:\\Shared\\build\\pkg\\MyNuget.Package.1.0.0.symbols.nupkg')
|
178
|
-
end
|
179
|
-
|
180
|
-
it 'should match sample2 with last nupkg mentioned' do
|
181
|
-
match = subject.send(:get_nuget_path_of) { sample2 }
|
182
|
-
expect(match).to eq('/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0.symbols.nupkg')
|
183
|
-
end
|
184
|
-
|
185
|
-
it 'should match sample3 with last nupkg mentioned' do
|
186
|
-
match = subject.send(:get_nuget_path_of) { sample3 }
|
187
|
-
expect(match).to eq('/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0-alpha3.symbols.nupkg')
|
188
|
-
end
|
189
|
-
|
190
|
-
it 'should match sample4 with last nupkg mentioned' do
|
191
|
-
match = subject.send(:get_nuget_path_of) { sample4 }
|
192
|
-
expect(match).to eq('/home/xyz/Shared/build/pkg/MyNuget.Package.1.0.0-alpha.nupkg')
|
193
|
-
end
|
194
|
-
|
195
|
-
it 'should match sample5 despite non-ASCII' do
|
196
|
-
match = subject.send(:get_nuget_path_of) { sample5 }
|
197
|
-
expect(match).to eq('/home/xyz/Shared/build/pkg/Fröken.1.0.0-alpha.nupkg')
|
198
|
-
end
|
199
|
-
end
|
200
|
-
|
201
|
-
# testing nuspec task
|
202
|
-
|
203
|
-
describe NuspecTask, "when testing public interface" do
|
204
|
-
include_context 'pack_config'
|
205
|
-
include_context 'path testing'
|
206
|
-
|
207
|
-
it "accepts .nuspec files" do
|
208
|
-
expect(NuspecTask.accept?('some.nuspec')).to be true
|
209
|
-
end
|
210
|
-
|
211
|
-
let (:cmd) do
|
212
|
-
Cmd.new 'NuGet.exe', config.opts()
|
213
|
-
end
|
214
|
-
|
215
|
-
subject do
|
216
|
-
cmd
|
217
|
-
end
|
218
|
-
|
219
|
-
before do
|
220
|
-
cmd.extend(ShInterceptor)
|
221
|
-
task = NuspecTask.new cmd, config, './spec/testdata/example.nuspec'
|
222
|
-
task.execute
|
223
|
-
end
|
224
|
-
|
225
|
-
it "should run the correct executable" do
|
226
|
-
expect(subject.mono_command).to eq 'NuGet.exe'
|
227
|
-
end
|
228
|
-
it "should give the correct parameters" do
|
229
|
-
expect(subject.mono_parameters).to eq %W[Pack -OutputDirectory #{path 'spec/testdata/pkg'} ./spec/testdata/example.nuspec]
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
# testing project task
|
234
|
-
|
235
|
-
describe ProjectTask, 'when target framework is specified' do
|
236
|
-
include_context 'pack_config no symbols'
|
237
|
-
include_context 'package_metadata_dsl'
|
238
|
-
|
239
|
-
it "sanity: should have config with target=#{DEFAULT_FRAMEWORK}" do
|
240
|
-
expect(config.opts().get(:target)).to eq(DEFAULT_FRAMEWORK)
|
241
|
-
end
|
242
|
-
|
243
|
-
let :projfile do
|
244
|
-
curr = File.dirname(__FILE__)
|
245
|
-
File.join curr, "testdata", "Project", "Project.fsproj"
|
246
|
-
end
|
247
|
-
|
248
|
-
subject do
|
249
|
-
proj = Albacore::Project.new projfile
|
250
|
-
ProjectTask.new( config.opts() ).send(:create_nuspec, proj, [])[0] # index0 first nuspec Alabacore::Package
|
251
|
-
end
|
252
|
-
|
253
|
-
has_file 'bin/Debug/Project.dll', "lib/#{DEFAULT_FRAMEWORK}"
|
254
|
-
end
|
255
|
-
|
256
|
-
describe ProjectTask, 'when target framework is unspecified' do
|
257
|
-
include_context 'pack_config no symbols'
|
258
|
-
include_context 'package_metadata_dsl'
|
259
|
-
|
260
|
-
let :projfile do
|
261
|
-
curr = File.dirname(__FILE__)
|
262
|
-
File.join curr, "testdata", "Project", "Project.fsproj"
|
263
|
-
end
|
264
|
-
let :vanilla_config do
|
265
|
-
cfg = ConfigFac.create id, curr, '', false
|
266
|
-
end
|
267
|
-
subject do
|
268
|
-
proj = Albacore::Project.new projfile
|
269
|
-
ProjectTask.new( vanilla_config.opts() ).send(:create_nuspec, proj, [])[0] # index0 first nuspec Alabacore::Package
|
270
|
-
end
|
271
|
-
|
272
|
-
has_file 'bin/Debug/Project.dll', 'lib/net45'
|
273
|
-
end
|
274
|
-
|
275
|
-
describe ProjectTask, "when testing public interface" do
|
276
|
-
let :projfile do
|
277
|
-
curr = File.dirname(__FILE__)
|
278
|
-
File.join curr, "testdata", "Project.fsproj"
|
279
|
-
end
|
280
|
-
it "can be created" do
|
281
|
-
ProjectTask.new(Map.new(:files => [projfile]))
|
282
|
-
end
|
283
|
-
it "rejects .nuspec files" do
|
284
|
-
expect(ProjectTask.accept?('some.nuspec')).to eq false
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
describe ProjectTask, "creating nuget from proj file" do
|
289
|
-
let(:cmdo) { Hash.new }
|
290
|
-
|
291
|
-
subject do
|
292
|
-
ProjectTask.new(config.opts()) do |cmd|
|
293
|
-
cmd.extend ShInterceptor
|
294
|
-
cmdo[:cmd] = cmd
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
before :each do
|
299
|
-
subject.execute
|
300
|
-
end
|
301
|
-
|
302
|
-
describe 'when generating symbols' do
|
303
|
-
include_context 'pack_config'
|
304
|
-
it 'should have generated a nuspec' do
|
305
|
-
expect(cmdo[:cmd].mono_parameters(0)[-1]).to include('Sample.Nuget.nuspec')
|
306
|
-
end
|
307
|
-
it 'should have generated a symbol nuspec' do
|
308
|
-
expect(cmdo[:cmd].mono_parameters(1)[-1]).to include('Sample.Nuget.symbols.nuspec')
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
describe 'when not generating symbols' do
|
313
|
-
include_context 'pack_config no symbols'
|
314
|
-
it 'should have generated a nuspec' do
|
315
|
-
expect(cmdo[:cmd].mono_parameters(0)[-1]).to include('Sample.Nuget.nuspec')
|
316
|
-
end
|
317
|
-
it 'should have done no further calls' do
|
318
|
-
expect(cmdo[:cmd].invocations.length).to eq(1)
|
319
|
-
end
|
320
|
-
it 'should have no further invocations' do
|
321
|
-
begin
|
322
|
-
cmdo[:cmd].mono_parameters(1)
|
323
|
-
rescue RuntimeError
|
324
|
-
end
|
325
|
-
end
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
describe ProjectTask, "path_to should accept both relative and absolute paths" do
|
330
|
-
let :proj_task do
|
331
|
-
curr = File.dirname(__FILE__)
|
332
|
-
ProjectTask.new(Map.new(
|
333
|
-
:files => [File.join( curr, "testdata", "Project.fsproj")],
|
334
|
-
:original_path => "/original_path/"))
|
335
|
-
end
|
336
|
-
it "should use original_path to resolve path" do
|
337
|
-
expect(proj_task.path_to( "./bin/something.exe", "./tmp/")).to eq "/original_path/bin/something.exe"
|
338
|
-
end
|
339
|
-
it "should return the absolute path when the path to the exe is absolute" do
|
340
|
-
expect(proj_task.path_to( "/bin/something.exe", "./tmp/")).to eq "/bin/something.exe"
|
341
|
-
end
|
342
|
-
end
|
343
|
-
|
344
|
-
describe 'encoding functions' do
|
345
|
-
it 'should throw InvalidByteSequenceError by default' do
|
346
|
-
# http://www.ruby-doc.org/core-2.1.3/String.html#method-i-encode
|
347
|
-
begin
|
348
|
-
# it's "valid US-ASCII" from the POV of #encode unless
|
349
|
-
# #force_encoding is used
|
350
|
-
[0xef].pack('C*').force_encoding('US-ASCII').encode 'utf-8'
|
351
|
-
fail 'should throw invalid byte sequence error, because it\'s NOT US-ASCII'
|
352
|
-
rescue Encoding::InvalidByteSequenceError
|
353
|
-
# yep
|
354
|
-
end
|
355
|
-
end
|
356
|
-
it 'should be replaceable' do
|
357
|
-
subj = [0xef].pack('C*').encode 'utf-8', undef: :replace, invalid: :replace, replace: ''
|
358
|
-
expect(subj).to eq ''
|
359
|
-
end
|
360
|
-
end
|
8
|
+
require 'albacore/nuget_model'
|
data/spec/paket_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'albacore/paket'
|
2
2
|
|
3
|
-
describe Albacore::Paket do
|
3
|
+
describe Albacore::Paket, "simple example" do
|
4
4
|
let :file do
|
5
5
|
%{NUGET
|
6
6
|
remote: https://www.nuget.org/api/v2
|
@@ -20,10 +20,13 @@ describe Albacore::Paket do
|
|
20
20
|
NuGet.CommandLine (2.8.5)
|
21
21
|
}
|
22
22
|
end
|
23
|
-
describe '
|
23
|
+
describe 'old lockfile' do
|
24
24
|
let :references do
|
25
25
|
Hash[subject.parse_paket_lock(file.split(/\n|\r\n/))]
|
26
26
|
end
|
27
|
+
it 'has Aether' do
|
28
|
+
expect(references['Aether'].version).to eq '6.0'
|
29
|
+
end
|
27
30
|
it 'has FParsec' do
|
28
31
|
expect(references['FParsec'].version).to eq '1.0.1'
|
29
32
|
end
|
@@ -48,3 +51,49 @@ describe Albacore::Paket do
|
|
48
51
|
end
|
49
52
|
end
|
50
53
|
end
|
54
|
+
|
55
|
+
describe Albacore::Paket, "netcore lockfile" do
|
56
|
+
let :path do
|
57
|
+
File.expand_path('../testdata/console-core-argu/paket.lock', __FILE__)
|
58
|
+
end
|
59
|
+
|
60
|
+
let :references do
|
61
|
+
arr = File.open(path, 'r') do |io|
|
62
|
+
Albacore::Paket.parse_paket_lock(io.readlines.map(&:chomp))
|
63
|
+
end
|
64
|
+
Hash[arr]
|
65
|
+
end
|
66
|
+
|
67
|
+
it "file exists" do
|
68
|
+
expect(File.exists?(path)).to be true
|
69
|
+
end
|
70
|
+
|
71
|
+
it "has items" do
|
72
|
+
expect(references.length).to_not be_zero
|
73
|
+
end
|
74
|
+
|
75
|
+
%w|Argu FSharp.Core|.each do |r|
|
76
|
+
it "has #{r}" do
|
77
|
+
expect(references[r]).to_not be_nil
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe Albacore::Paket, "dependencies file" do
|
83
|
+
let :path do
|
84
|
+
File.expand_path('../testdata/console-core-argu/paket.dependencies', __FILE__)
|
85
|
+
end
|
86
|
+
|
87
|
+
let :references do
|
88
|
+
arr = File.open(path, 'r') do |io|
|
89
|
+
Albacore::Paket.parse_dependencies_file(io.readlines.map(&:chomp))
|
90
|
+
end
|
91
|
+
Hash[arr.map{ |x| [x,x] }]
|
92
|
+
end
|
93
|
+
|
94
|
+
%w|Argu FSharp.Core|.each do |r|
|
95
|
+
it "has #{r}" do
|
96
|
+
expect(references[r]).to_not be_nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/spec/project_spec.rb
CHANGED
@@ -3,58 +3,72 @@ require 'albacore/semver'
|
|
3
3
|
require 'albacore/project'
|
4
4
|
require 'albacore/paths'
|
5
5
|
|
6
|
-
describe Albacore::Project
|
6
|
+
describe Albacore::Project do
|
7
7
|
subject do
|
8
8
|
p = File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
|
9
9
|
#puts "path: #{p}"
|
10
10
|
Albacore.create_project(p)
|
11
11
|
end
|
12
|
-
let :nlog do
|
13
|
-
subject.declared_packages.find { |p| p.id == 'NLog' }
|
14
|
-
end
|
15
12
|
|
16
|
-
it '
|
13
|
+
it 'has #guid' do
|
17
14
|
expect(subject.guid).to match /^[A-F0-9]{8}(?:-[A-F0-9]{4}){3}-[A-F0-9]{12}$/i
|
18
15
|
end
|
19
16
|
|
17
|
+
it 'has xmldoc?' do
|
18
|
+
expect(subject.xmldoc?).to be true
|
19
|
+
end
|
20
|
+
|
20
21
|
it 'assumption: can gsub("[\{\}]", "")' do
|
21
22
|
expect('{a}'.gsub(/[\{\}]/, '')).to eq 'a'
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
25
|
+
describe "#outputs" do
|
26
|
+
let :outputs do
|
27
|
+
subject.outputs 'Debug', 'net45'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'non-empty array' do
|
31
|
+
expect(outputs).to_not be_empty
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'a DLL' do
|
35
|
+
expect(outputs).to include(
|
36
|
+
Albacore::OutputArtifact.new 'bin/Debug/Project.dll', Albacore::OutputArtifact::LIBRARY
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise "ConfigurationNotFoundEror" if not found' do
|
41
|
+
begin
|
42
|
+
subject.outputs('UNKNOWN_Configuration', 'net451')
|
43
|
+
rescue ::Albacore::ConfigurationNotFoundError
|
44
|
+
end
|
38
45
|
end
|
39
46
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
47
|
+
|
48
|
+
describe "#declared_packages" do
|
49
|
+
it "has three" do
|
50
|
+
expect(subject.declared_packages.length).to eq 3
|
51
|
+
end
|
52
|
+
|
53
|
+
let :nlog do
|
54
|
+
subject.declared_packages.find { |p| p.id == 'NLog' }
|
55
|
+
end
|
56
|
+
|
57
|
+
it "contains NLog" do
|
58
|
+
expect(nlog).to_not be_nil
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should have a four number on NLog" do
|
62
|
+
expect(nlog.version).to eq("2.0.0.2000")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should have a semver number" do
|
66
|
+
expect(nlog.semver).to eq(Albacore::SemVer.new(2, 0, 0))
|
67
|
+
end
|
54
68
|
end
|
55
69
|
end
|
56
70
|
|
57
|
-
describe Albacore::Project, "
|
71
|
+
describe Albacore::Project, "reading project file" do
|
58
72
|
def project_path
|
59
73
|
File.expand_path('../testdata/Project/Project.fsproj', __FILE__)
|
60
74
|
end
|
@@ -62,14 +76,18 @@ describe Albacore::Project, "when reading project file" do
|
|
62
76
|
subject do
|
63
77
|
Albacore.create_project project_path
|
64
78
|
end
|
79
|
+
|
65
80
|
let :library1 do
|
66
81
|
subject.included_files.find { |p| p.include == 'Library1.fs' }
|
67
82
|
end
|
83
|
+
|
68
84
|
it "should contain library1" do
|
69
85
|
expect(library1).to_not be_nil
|
70
86
|
end
|
87
|
+
|
71
88
|
it 'should contain the target framework' do
|
72
|
-
expect(subject.target_framework).to eq "
|
89
|
+
expect(subject.target_framework).to eq "net451"
|
90
|
+
expect(subject.target_frameworks).to eq %w|net451|
|
73
91
|
end
|
74
92
|
|
75
93
|
describe 'public API' do
|
@@ -100,33 +118,87 @@ describe Albacore::Project, "when reading project file" do
|
|
100
118
|
it 'should have five referenced assemblies' do
|
101
119
|
expect(subject.find_refs.length).to eq 5
|
102
120
|
end
|
121
|
+
|
103
122
|
it 'knows about referenced packages' do
|
104
123
|
expect(subject).to respond_to :declared_packages
|
105
124
|
end
|
125
|
+
|
106
126
|
it 'knows about referenced projects' do
|
107
127
|
expect(subject).to respond_to :declared_projects
|
108
128
|
end
|
129
|
+
|
109
130
|
it 'should have three referenced packages' do
|
110
131
|
expected = %w|Intelliplan.Util Newtonsoft.Json NLog|
|
111
132
|
expect(subject.find_packages.map(&:id)).to eq(expected)
|
112
133
|
end
|
134
|
+
end
|
135
|
+
end
|
113
136
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
137
|
+
describe Albacore::Project, "for netcore" do
|
138
|
+
def project_path
|
139
|
+
File.expand_path('../testdata/console-core-argu/ConsoleArgu.fsproj', __FILE__)
|
140
|
+
end
|
141
|
+
|
142
|
+
subject do
|
143
|
+
Albacore.create_project project_path
|
144
|
+
end
|
145
|
+
|
146
|
+
it "#id" do
|
147
|
+
expect(subject.id).to eq 'ConsoleArgu'
|
148
|
+
end
|
149
|
+
|
150
|
+
it "#name" do
|
151
|
+
expect(subject.name).to eq 'ConsoleArgu'
|
152
|
+
end
|
153
|
+
|
154
|
+
it "#asmname" do
|
155
|
+
expect(subject.asmname).to eq 'ConsoleArgu'
|
156
|
+
end
|
157
|
+
|
158
|
+
it "#proj_filename_noext" do
|
159
|
+
expect(subject.proj_filename_noext).to eq 'ConsoleArgu'
|
160
|
+
end
|
161
|
+
|
162
|
+
it '#netcore?' do
|
163
|
+
expect(subject.netcore?).to eq true
|
164
|
+
end
|
165
|
+
|
166
|
+
it '#target_frameworks' do
|
167
|
+
expect(subject.target_frameworks).to eq %w|netstandard2.0 net461|
|
168
|
+
end
|
169
|
+
|
170
|
+
it '#outputs' do
|
171
|
+
expected = [
|
172
|
+
Albacore::OutputArtifact.new(
|
173
|
+
'bin/Release/netstandard2.0/ConsoleArgu.dll',
|
174
|
+
Albacore::OutputArtifact::LIBRARY),
|
175
|
+
|
176
|
+
Albacore::OutputArtifact.new(
|
177
|
+
'bin/Release/netstandard2.0/ConsoleArgu.xml',
|
178
|
+
Albacore::OutputArtifact::XMLDOC)
|
179
|
+
]
|
180
|
+
expect(subject.outputs('Release', 'netstandard2.0')).to eq expected
|
181
|
+
end
|
182
|
+
|
183
|
+
it '#paket_packages' do
|
184
|
+
dps = subject.declared_packages.group_by { |d| d.id }
|
185
|
+
expect(dps).to_not be_empty
|
186
|
+
|
187
|
+
h = Hash[dps]
|
188
|
+
expect(h).to_not be_empty
|
189
|
+
expect(h['FSharp.Core'].length).to eq(2)
|
190
|
+
expect(h['Argu'].length).to eq(2)
|
119
191
|
end
|
120
192
|
end
|
121
193
|
|
122
|
-
describe Albacore::Project, '
|
194
|
+
describe Albacore::Project, 'with PathnameWrap' do
|
123
195
|
it 'should allow argument of PathnameWrap' do
|
124
196
|
require 'albacore/paths'
|
125
197
|
Albacore.create_project(Paths::PathnameWrap.new(File.expand_path('../testdata/Project/Project.fsproj', __FILE__)))
|
126
198
|
end
|
127
199
|
end
|
128
|
-
describe Albacore::Project do
|
129
200
|
|
201
|
+
describe Albacore::Project, "with AssemblyInfo.cs" do
|
130
202
|
it 'should read version from AssemblyInfo.cs' do
|
131
203
|
p = '../testdata/csharp/Exemplar/Exemplar/Exemplar.csproj'
|
132
204
|
project = Albacore.create_project(Paths::PathnameWrap.new(File.expand_path(p, __FILE__)))
|
@@ -134,6 +206,7 @@ describe Albacore::Project do
|
|
134
206
|
expected = '1.0.0.0'
|
135
207
|
expect(expected).to eq(result)
|
136
208
|
end
|
209
|
+
|
137
210
|
it 'should read version from AssemblyInfo.cs in ModifiedAssemblyVersion' do
|
138
211
|
p = '../testdata/csharp/ModifiedAssemblyVersion/ModifiedAssemblyVersion/ModifiedAssemblyVersion.csproj'
|
139
212
|
project = Albacore.create_project(Paths::PathnameWrap.new(File.expand_path(p, __FILE__)))
|
@@ -141,6 +214,7 @@ describe Albacore::Project do
|
|
141
214
|
expected = '2.0.0.0'
|
142
215
|
expect(expected).to eq(result)
|
143
216
|
end
|
217
|
+
|
144
218
|
it 'should return 1.0.0.0 when AssemblyVersion is not found' do
|
145
219
|
p = '../testdata/Project/Project.fsproj'
|
146
220
|
project = Albacore.create_project(Paths::PathnameWrap.new(File.expand_path(p, __FILE__)))
|
@@ -148,14 +222,15 @@ describe Albacore::Project do
|
|
148
222
|
expected = '1.0.0.0'
|
149
223
|
expect(expected).to eq(result)
|
150
224
|
end
|
225
|
+
|
151
226
|
it 'properties_path should return project base path if assemblyinfo not found' do
|
152
227
|
p = '../testdata/Project/Project.fsproj'
|
153
228
|
project = Albacore.create_project(Paths::PathnameWrap.new(File.expand_path(p, __FILE__)))
|
154
229
|
result = project.assembly_info_path
|
155
230
|
expected = File.dirname(project.path)
|
156
231
|
expect(expected).to eq(result)
|
157
|
-
|
158
232
|
end
|
233
|
+
|
159
234
|
it 'properties path should return project base path if both are equivalent' do
|
160
235
|
p = '../testdata/Project/Project.fsproj'
|
161
236
|
project = Albacore.create_project(Paths::PathnameWrap.new(File.expand_path(p, __FILE__)))
|