albacore 2.0.0.rc.2 → 2.0.0.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +262 -202
- data/albacore.gemspec +1 -0
- data/lib/albacore.rb +3 -0
- data/lib/albacore/albacore_module.rb +6 -0
- data/lib/albacore/nuget_model.rb +7 -1
- data/lib/albacore/task_types/asmver.rb +11 -4
- data/lib/albacore/task_types/asmver/file_generator.rb +17 -10
- data/lib/albacore/task_types/build.rb +196 -192
- data/lib/albacore/task_types/nugets_pack.rb +22 -5
- data/lib/albacore/tasks/README.md +3 -1
- data/lib/albacore/tools.rb +4 -0
- data/lib/albacore/version.rb +1 -1
- data/spec/asmver_spec.rb +17 -13
- data/spec/nuget_model_spec.rb +19 -63
- data/spec/nugets_pack_spec.rb +42 -14
- data/spec/shared_contexts.rb +59 -0
- data/spec/spec_helper.rb +1 -1
- metadata +17 -5
@@ -99,8 +99,11 @@ module Albacore
|
|
99
99
|
# p.files = FileList['src/**/*.csproj']
|
100
100
|
# p.out = 'build/pkg'
|
101
101
|
# p.exe = 'buildsupport/NuGet.exe'
|
102
|
-
# p.
|
102
|
+
# p.with_metadata do |m|
|
103
|
+
# m.version = ENV['NUGET_VERSION']
|
104
|
+
# end
|
103
105
|
# p.gen_symbols
|
106
|
+
# p.no_project_dependencies
|
104
107
|
# end
|
105
108
|
class Config
|
106
109
|
include CmdConfig
|
@@ -109,7 +112,7 @@ module Albacore
|
|
109
112
|
# the output directory to place the newfangled nugets in
|
110
113
|
attr_path :out
|
111
114
|
|
112
|
-
# the .net target (e.g. net40,
|
115
|
+
# the .net target (e.g. net40, mono20, mono3, etc)
|
113
116
|
attr_writer :target
|
114
117
|
|
115
118
|
# sets the files to search
|
@@ -123,6 +126,7 @@ module Albacore
|
|
123
126
|
@package = Albacore::NugetModel::Package.new
|
124
127
|
@target = 'net40'
|
125
128
|
@symbols = false
|
129
|
+
@project_dependencies = true
|
126
130
|
fill_required
|
127
131
|
end
|
128
132
|
|
@@ -141,6 +145,12 @@ module Albacore
|
|
141
145
|
@symbols = true
|
142
146
|
end
|
143
147
|
|
148
|
+
# call this if you want to cancel 'smart' scanning of the *proj
|
149
|
+
# file for its dependencies
|
150
|
+
def no_project_dependencies
|
151
|
+
@project_dependencies = false
|
152
|
+
end
|
153
|
+
|
144
154
|
# gets the options specified for the task, used from the task
|
145
155
|
def opts
|
146
156
|
files = @files.respond_to?(:each) ? @files : [@files]
|
@@ -157,6 +167,7 @@ module Albacore
|
|
157
167
|
:target => @target,
|
158
168
|
:files => @files,
|
159
169
|
:configuration => @configuration,
|
170
|
+
:project_dependencies => @project_dependencies,
|
160
171
|
:original_path => FileUtils.pwd
|
161
172
|
})
|
162
173
|
end
|
@@ -247,14 +258,18 @@ module Albacore
|
|
247
258
|
|
248
259
|
def create_nuspec proj, knowns
|
249
260
|
version = @opts.get(:package).metadata.version
|
261
|
+
project_dependencies = @opts.get(:project_dependencies, true)
|
262
|
+
target = @opts.get :target
|
250
263
|
|
251
|
-
trace "creating NON-SYMBOL package for #{proj.name} [nugets pack: task]"
|
264
|
+
trace "creating NON-SYMBOL package for #{proj.name}, targeting #{target} [nugets pack: task]"
|
252
265
|
nuspec = Albacore::NugetModel::Package.from_xxproj proj,
|
253
266
|
symbols: false,
|
254
267
|
verify_files: true,
|
268
|
+
dotnet_version: target,
|
255
269
|
known_projects: knowns,
|
256
270
|
version: version,
|
257
|
-
configuration: (@opts.get(:configuration))
|
271
|
+
configuration: (@opts.get(:configuration)),
|
272
|
+
project_dependencies: project_dependencies
|
258
273
|
|
259
274
|
# take data from package as configured in Rakefile, choosing what is in
|
260
275
|
# Rakefile over what is in projfile.
|
@@ -266,9 +281,11 @@ module Albacore
|
|
266
281
|
nuspec_symbols = Albacore::NugetModel::Package.from_xxproj proj,
|
267
282
|
symbols: true,
|
268
283
|
verify_files: true,
|
284
|
+
dotnet_version: target,
|
269
285
|
known_projects: knowns,
|
270
286
|
version: version,
|
271
|
-
configuration: (@opts.get(:configuration))
|
287
|
+
configuration: (@opts.get(:configuration)),
|
288
|
+
project_dependencies: project_dependencies
|
272
289
|
|
273
290
|
nuspec_symbols = nuspec_symbols.merge_with @opts.get(:package)
|
274
291
|
trace { "nuspec symbols: #{nuspec_symbols.to_s} [nugets pack: task]" }
|
@@ -5,7 +5,9 @@ with tasks. Files should be named after the tasks they 'create'.
|
|
5
5
|
|
6
6
|
For example, in a Rakefile, you can write:
|
7
7
|
|
8
|
-
```ruby
|
8
|
+
``` ruby
|
9
|
+
Albacore::Tasks::Versionizer.new :versioning
|
10
|
+
```
|
9
11
|
|
10
12
|
to create a new task, named `:versioning` that you can then depend on from other
|
11
13
|
tasks.
|
data/lib/albacore/version.rb
CHANGED
data/spec/asmver_spec.rb
CHANGED
@@ -100,9 +100,7 @@ on many lines}
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
describe FileGenerator do
|
103
|
-
subject do
|
104
|
-
FileGenerator.new(Fs.new, 'MyNamespace.Here', {})
|
105
|
-
end
|
103
|
+
subject do FileGenerator.new(Fs.new, 'MyNamespace.Here', {}) end
|
106
104
|
it do
|
107
105
|
subject.should respond_to(:generate)
|
108
106
|
end
|
@@ -111,16 +109,19 @@ describe FileGenerator do
|
|
111
109
|
end
|
112
110
|
end
|
113
111
|
describe FileGenerator, 'when generating F# file' do
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
before :all do
|
113
|
+
@out = StringIO.new
|
114
|
+
subject = FileGenerator.new(Fs.new, 'My.Fs.Ns', {})
|
115
|
+
subject.generate @out,
|
116
|
+
com_visible: false,
|
119
117
|
assembly_title: 'My.Ns',
|
120
118
|
assembly_version: '0.1.2',
|
121
119
|
custom_thing: %w|a b c|,
|
122
120
|
named_thing: { :b => 3, :c => 'hi' }
|
123
121
|
end
|
122
|
+
let :generated do
|
123
|
+
@out.string
|
124
|
+
end
|
124
125
|
it 'should include namespace' do
|
125
126
|
generated.should =~ /namespace My\.Fs\.Ns(\r\n?|\n)/
|
126
127
|
end
|
@@ -153,16 +154,19 @@ describe FileGenerator, 'when generating F# file' do
|
|
153
154
|
end
|
154
155
|
end
|
155
156
|
describe FileGenerator do
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
157
|
+
before :all do
|
158
|
+
@out = StringIO.new
|
159
|
+
subject = FileGenerator.new(Cs.new, '', {})
|
160
|
+
subject.generate @out,
|
161
|
+
com_visible: false,
|
161
162
|
assembly_title: 'My.Asm',
|
162
163
|
assembly_version: '0.1.2',
|
163
164
|
custom_thing: %w|a b c|,
|
164
165
|
named_thing: { :b => 3, :c => 'hi' }
|
165
166
|
end
|
167
|
+
let :generated do
|
168
|
+
@out.string
|
169
|
+
end
|
166
170
|
it 'should not include \'namespace\'' do
|
167
171
|
generated.should_not include('namespace')
|
168
172
|
end
|
data/spec/nuget_model_spec.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'shared_contexts'
|
2
3
|
require 'albacore/paths'
|
3
4
|
require 'albacore/nuget_model'
|
4
5
|
|
5
6
|
describe Albacore::NugetModel::Metadata do
|
6
|
-
[:id, :version, :authors, :description, :language, :project_url, :license_url, :release_notes, :owners, :require_license_acceptance, :copyright, :tags, :dependencies, :framework_assemblies].each do |prop|
|
7
|
+
[:id, :version, :authors, :description, :summary, :language, :project_url, :license_url, :release_notes, :owners, :require_license_acceptance, :copyright, :tags, :dependencies, :framework_assemblies].each do |prop|
|
7
8
|
it "responds to :#{prop}" do
|
8
9
|
subject.should respond_to(prop)
|
9
10
|
end
|
@@ -78,6 +79,7 @@ describe Albacore::NugetModel::Package, "from XML" do
|
|
78
79
|
<owners>Ms.Example</owners>
|
79
80
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
80
81
|
<description>Example package</description>
|
82
|
+
<summary>Example package summary</summary>
|
81
83
|
<releaseNotes>Used for specs</releaseNotes>
|
82
84
|
<copyright>none</copyright>
|
83
85
|
<tags>example spec</tags>
|
@@ -126,7 +128,7 @@ XML
|
|
126
128
|
end
|
127
129
|
|
128
130
|
# on Windows this fails due to replacement of path separators (by design)
|
129
|
-
unless ::
|
131
|
+
unless ::Albacore.windows?
|
130
132
|
it "should generate the same (semantic) XML as above" do
|
131
133
|
Nokogiri::XML(subject.to_xml, &:noblanks).to_xml.should eq(Nokogiri::XML(StringIO.new(xml), &:noblanks).to_xml)
|
132
134
|
end
|
@@ -150,63 +152,6 @@ XML
|
|
150
152
|
end
|
151
153
|
|
152
154
|
|
153
|
-
shared_context 'metadata_dsl' do
|
154
|
-
let :m do
|
155
|
-
subject.metadata
|
156
|
-
end
|
157
|
-
|
158
|
-
def self.has_value sym, e
|
159
|
-
it "should have overridden #{sym}, to be #{e}" do
|
160
|
-
m.send(sym).should eq e
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
def self.has_dep name, version
|
165
|
-
it "has dependency on '#{name}'" do
|
166
|
-
m.dependencies.has_key?(name).should be_true
|
167
|
-
end
|
168
|
-
it "overrode dependency on '#{name}'" do
|
169
|
-
m.dependencies[name].version.should eq version
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
def self.has_not_dep name
|
174
|
-
it "does not have a dependency on #{name}" do
|
175
|
-
m.dependencies.has_key?(name).should be_false
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def self.has_file src, target, exclude = nil
|
180
|
-
src, target = norm(src), norm(target)
|
181
|
-
it "has file[#{src}] (should not be nil)" do
|
182
|
-
file = subject.files.find { |f| f.src == src }
|
183
|
-
# puts "## ALL FILES ##"
|
184
|
-
# subject.files.each do |f|
|
185
|
-
# puts "subject.files: #{subject.files}, index of: #{subject.files.find_index { |f| f.src == src }}"
|
186
|
-
# puts "#{f.inspect}"
|
187
|
-
# end
|
188
|
-
file.should_not be_nil
|
189
|
-
end
|
190
|
-
|
191
|
-
it "has file[#{src}].target == '#{target}'" do
|
192
|
-
file = subject.files.find { |f| f.src == src }
|
193
|
-
file.target.should eq target
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
def self.has_not_file src
|
198
|
-
src = norm src
|
199
|
-
it "has not file[#{src}]" do
|
200
|
-
file = subject.files.find { |f| f.src == src }
|
201
|
-
file.should be_nil
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
def self.norm str
|
206
|
-
Albacore::Paths.normalise_slashes str
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
155
|
describe "when reading xml from a fsproj file into Project/Metadata" do
|
211
156
|
let :projfile do
|
212
157
|
curr = File.dirname(__FILE__)
|
@@ -216,7 +161,7 @@ describe "when reading xml from a fsproj file into Project/Metadata" do
|
|
216
161
|
Albacore::NugetModel::Package.from_xxproj_file projfile
|
217
162
|
end
|
218
163
|
|
219
|
-
include_context '
|
164
|
+
include_context 'package_metadata_dsl'
|
220
165
|
|
221
166
|
it "should find Name element" do
|
222
167
|
m.id.should eq 'Project'
|
@@ -267,7 +212,7 @@ describe Albacore::NugetModel::Package, "overriding metadata" do
|
|
267
212
|
p1.merge_with p2
|
268
213
|
end
|
269
214
|
|
270
|
-
include_context '
|
215
|
+
include_context 'package_metadata_dsl'
|
271
216
|
|
272
217
|
describe "when overriding:" do
|
273
218
|
has_value :id, 'A.B.C'
|
@@ -296,7 +241,7 @@ describe "creating nuget (not symbols) from dependent proj file" do
|
|
296
241
|
:configuration => 'Debug'
|
297
242
|
end
|
298
243
|
|
299
|
-
include_context '
|
244
|
+
include_context 'package_metadata_dsl'
|
300
245
|
|
301
246
|
# from fsproj
|
302
247
|
has_dep 'Sample.Core', '2.3.0'
|
@@ -309,6 +254,17 @@ describe "creating nuget (not symbols) from dependent proj file" do
|
|
309
254
|
# actual nuspec contents
|
310
255
|
has_file 'bin/Debug/Sample.Commands.dll', 'lib/net40'
|
311
256
|
has_file 'bin/Debug/Sample.Commands.xml', 'lib/net40'
|
257
|
+
|
258
|
+
describe 'when dotnet_version is set' do
|
259
|
+
subject do
|
260
|
+
Albacore::NugetModel::Package.from_xxproj_file projfile,
|
261
|
+
known_projects: %w[Sample.Core],
|
262
|
+
dotnet_version: 'mono32'
|
263
|
+
end
|
264
|
+
# actual nuspec contents
|
265
|
+
has_file 'bin/Debug/Sample.Commands.dll', 'lib/mono32'
|
266
|
+
has_file 'bin/Debug/Sample.Commands.xml', 'lib/mono32'
|
267
|
+
end
|
312
268
|
end
|
313
269
|
|
314
270
|
describe "creating nuget on dependent proj file" do
|
@@ -328,7 +284,7 @@ describe "creating nuget on dependent proj file" do
|
|
328
284
|
Albacore::NugetModel::Package.from_xxproj_file projfile, opts
|
329
285
|
end
|
330
286
|
|
331
|
-
include_context '
|
287
|
+
include_context 'package_metadata_dsl'
|
332
288
|
|
333
289
|
describe 'without project_dependencies' do
|
334
290
|
# just as the opts in the main describe says...
|
data/spec/nugets_pack_spec.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'shared_contexts'
|
2
3
|
require 'support/sh_interceptor'
|
3
4
|
require 'albacore'
|
4
5
|
require 'albacore/task_types/nugets_pack'
|
6
|
+
require 'albacore/nuget_model'
|
7
|
+
|
8
|
+
include ::Albacore::NugetsPack
|
5
9
|
|
6
10
|
class ConfigFac
|
7
11
|
def self.create id, curr, gen_symbols = true
|
8
12
|
cfg = Albacore::NugetsPack::Config.new
|
9
|
-
cfg.target = '
|
13
|
+
cfg.target = 'mono32'
|
10
14
|
cfg.configuration = 'Debug'
|
11
15
|
cfg.files = Dir.glob(File.join(curr, 'testdata', 'Project', '*.fsproj'))
|
12
16
|
cfg.out = 'spec/testdata/pkg'
|
@@ -60,12 +64,12 @@ end
|
|
60
64
|
|
61
65
|
# testing the command for nuget
|
62
66
|
|
63
|
-
describe
|
67
|
+
describe Cmd, "when calling #execute" do
|
64
68
|
|
65
69
|
include_context 'path testing'
|
66
70
|
|
67
71
|
let :cmd do
|
68
|
-
|
72
|
+
Cmd.new 'NuGet.exe', config.opts()
|
69
73
|
end
|
70
74
|
|
71
75
|
subject do
|
@@ -111,11 +115,11 @@ describe Albacore::NugetsPack::Cmd, "when calling #execute" do
|
|
111
115
|
end
|
112
116
|
end
|
113
117
|
|
114
|
-
describe
|
118
|
+
describe Cmd, 'when calling :get_nuget_path_of' do
|
115
119
|
include_context 'pack_config'
|
116
120
|
|
117
121
|
subject do
|
118
|
-
|
122
|
+
Cmd.new 'NuGet.exe', config.opts()
|
119
123
|
end
|
120
124
|
|
121
125
|
let :sample1 do
|
@@ -145,17 +149,18 @@ EXAMPLE_OUTPUT
|
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
152
|
+
# testing nuspec task
|
148
153
|
|
149
|
-
describe
|
154
|
+
describe NuspecTask, "when testing public interface" do
|
150
155
|
include_context 'pack_config'
|
151
156
|
include_context 'path testing'
|
152
157
|
|
153
158
|
it "accepts .nuspec files" do
|
154
|
-
|
159
|
+
NuspecTask.accept?('some.nuspec').should be_true
|
155
160
|
end
|
156
161
|
|
157
162
|
let (:cmd) do
|
158
|
-
|
163
|
+
Cmd.new 'NuGet.exe', config.opts()
|
159
164
|
end
|
160
165
|
|
161
166
|
subject do
|
@@ -164,7 +169,7 @@ describe Albacore::NugetsPack::NuspecTask, "when testing public interface" do
|
|
164
169
|
|
165
170
|
before do
|
166
171
|
cmd.extend(ShInterceptor)
|
167
|
-
task =
|
172
|
+
task = NuspecTask.new cmd, config, './spec/testdata/example.nuspec'
|
168
173
|
task.execute
|
169
174
|
end
|
170
175
|
|
@@ -176,24 +181,47 @@ describe Albacore::NugetsPack::NuspecTask, "when testing public interface" do
|
|
176
181
|
end
|
177
182
|
end
|
178
183
|
|
179
|
-
|
184
|
+
# testing project task
|
185
|
+
|
186
|
+
describe ProjectTask do
|
187
|
+
include_context 'pack_config no symbols'
|
188
|
+
include_context 'package_metadata_dsl'
|
189
|
+
|
190
|
+
it 'sanity: should have config with target=mono32' do
|
191
|
+
config.opts().get(:target).should eq('mono32')
|
192
|
+
end
|
193
|
+
|
194
|
+
let :projfile do
|
195
|
+
curr = File.dirname(__FILE__)
|
196
|
+
File.join curr, "testdata", "Project", "Project.fsproj"
|
197
|
+
end
|
198
|
+
|
199
|
+
subject do
|
200
|
+
proj = Albacore::Project.new projfile
|
201
|
+
ProjectTask.new( config.opts() ).send(:create_nuspec, proj, [])[0] # index0 first nuspec Alabacore::Package
|
202
|
+
end
|
203
|
+
|
204
|
+
has_file 'bin/Debug/Project.dll', 'lib/mono32'
|
205
|
+
end
|
206
|
+
|
207
|
+
describe ProjectTask, "when testing public interface" do
|
180
208
|
let :projfile do
|
181
209
|
curr = File.dirname(__FILE__)
|
182
210
|
File.join curr, "testdata", "Project.fsproj"
|
183
211
|
end
|
184
212
|
it "can be created" do
|
185
|
-
|
213
|
+
ProjectTask.new(Map.new(:files => [projfile]))
|
186
214
|
end
|
187
215
|
it "rejects .nuspec files" do
|
188
|
-
|
216
|
+
ProjectTask.accept?('some.nuspec').should eq false
|
189
217
|
end
|
190
218
|
end
|
191
219
|
|
192
|
-
describe
|
220
|
+
describe ProjectTask, "creating nuget from proj file" do
|
193
221
|
let(:cmdo) { Hash.new }
|
194
222
|
|
195
223
|
subject do
|
196
|
-
|
224
|
+
ProjectTask.new(config.opts()) do |cmd|
|
197
225
|
cmd.extend ShInterceptor
|
198
226
|
cmdo[:cmd] = cmd
|
199
227
|
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'albacore/paths'
|
2
|
+
|
3
|
+
shared_context 'package_metadata_dsl' do
|
4
|
+
let :m do
|
5
|
+
subject.metadata
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.has_value sym, e
|
9
|
+
it "should have overridden #{sym}, to be #{e}" do
|
10
|
+
m.send(sym).should eq e
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.has_dep name, version
|
15
|
+
it "has dependency on '#{name}'" do
|
16
|
+
m.dependencies.has_key?(name).should be_true
|
17
|
+
end
|
18
|
+
it "overrode dependency on '#{name}'" do
|
19
|
+
m.dependencies[name].version.should eq version
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.has_not_dep name
|
24
|
+
it "does not have a dependency on #{name}" do
|
25
|
+
m.dependencies.has_key?(name).should be_false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.has_file src, target, exclude = nil
|
30
|
+
src, target = norm(src), norm(target)
|
31
|
+
it "has file[#{src}] (should not be nil)" do
|
32
|
+
file = subject.files.find { |f| f.src == src }
|
33
|
+
# puts "## ALL FILES ##"
|
34
|
+
# subject.files.each do |f|
|
35
|
+
# puts "subject.files: #{subject.files}, index of: #{subject.files.find_index { |f| f.src == src }}"
|
36
|
+
# puts "#{f.inspect}"
|
37
|
+
# end
|
38
|
+
file.should_not be_nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has file[#{src}].target == '#{target}'" do
|
42
|
+
file = subject.files.find { |f| f.src == src }
|
43
|
+
file.target.should eq target
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.has_not_file src
|
48
|
+
src = norm src
|
49
|
+
it "has not file[#{src}]" do
|
50
|
+
file = subject.files.find { |f| f.src == src }
|
51
|
+
file.should be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.norm str
|
56
|
+
Albacore::Paths.normalise_slashes str
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|