albacore 2.0.0.rc.12 → 2.0.0.rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +35 -7
- data/lib/albacore/dsl.rb +12 -0
- data/lib/albacore/task_types/asmver.rb +120 -79
- data/lib/albacore/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -170,7 +170,7 @@ end
|
|
170
170
|
|
171
171
|
### Docs: nugets_pack
|
172
172
|
|
173
|
-
```
|
173
|
+
``` ruby
|
174
174
|
nugets_pack :create_nugets do |p|
|
175
175
|
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
|
176
176
|
exclude(/Tests/)
|
@@ -195,10 +195,11 @@ Cancel following of references between projects that cause nugets_pack to find a
|
|
195
195
|
|
196
196
|
Enables nuget restore throughout the solution.
|
197
197
|
|
198
|
-
```
|
198
|
+
``` ruby
|
199
199
|
nugets_restore :restore do |p|
|
200
|
-
p.out = 'src/packages'
|
201
|
-
p.exe = 'buildsupport/NuGet.exe'
|
200
|
+
p.out = 'src/packages' # required
|
201
|
+
p.exe = 'buildsupport/NuGet.exe' # required
|
202
|
+
p.list_spec = '**/packages.config' # optional
|
202
203
|
end
|
203
204
|
```
|
204
205
|
|
@@ -219,9 +220,36 @@ asmver :asmver do |a|
|
|
219
220
|
end
|
220
221
|
```
|
221
222
|
|
222
|
-
### Docs:
|
223
|
+
### Docs: asmver_files
|
223
224
|
|
224
225
|
```
|
226
|
+
desc 'create assembly infos'
|
227
|
+
asmver_files :assembly_info do |a|
|
228
|
+
a.files = FileList['**/*proj'] # optional, will find all projects recursively by default
|
229
|
+
|
230
|
+
# attributes are required:
|
231
|
+
a.attributes assembly_description: "My wonderful lib",
|
232
|
+
assembly_configuration: 'RELEASE',
|
233
|
+
assembly_company: 'Wonders Inc.',
|
234
|
+
assembly_copyright: "(c) #{Time.now.year} by John Doe",
|
235
|
+
assembly_version: ENV['LONG_VERSION'],
|
236
|
+
assembly_file_version: ENV['LONG_VERSION'],
|
237
|
+
assembly_informational_version: ENV['BUILD_VERSION']
|
238
|
+
|
239
|
+
# optional, not widely supported yet, as there's no way to read the attributes
|
240
|
+
# file an issue if you have a use-case
|
241
|
+
a.handle_config do |proj, conf|
|
242
|
+
# do something with configuration
|
243
|
+
# conf.attributes ...
|
244
|
+
end
|
245
|
+
end
|
246
|
+
```
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
### Docs: test_runner
|
251
|
+
|
252
|
+
``` ruby
|
225
253
|
test_runner :tests do |tests|
|
226
254
|
tests.files = FileList['**/*.Tests/bin/Release/*.Tests.dll'] # dll files with test
|
227
255
|
tests.exe = 'src/packages/NUnit.Runners.2.5.3/tools/nunit-console.exe' # executable to run tests with
|
@@ -317,7 +345,7 @@ in the archive, rather just its contents.
|
|
317
345
|
|
318
346
|
Usage:
|
319
347
|
|
320
|
-
```
|
348
|
+
``` ruby
|
321
349
|
dir_to_zip = "/tmp/input"
|
322
350
|
out_file = "/tmp/out.zip"
|
323
351
|
zf = Zippy.new dir_to_zip, out_file
|
@@ -326,7 +354,7 @@ zf.write
|
|
326
354
|
|
327
355
|
Or:
|
328
356
|
|
329
|
-
```
|
357
|
+
``` ruby
|
330
358
|
z = Zippy.new(directory_to_zip, output_file) { |f| f.include? 'html' }
|
331
359
|
z.write
|
332
360
|
```
|
data/lib/albacore/dsl.rb
CHANGED
@@ -19,6 +19,18 @@ module Albacore
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def asmver_files *args, &block
|
23
|
+
Albacore.define_task *args do
|
24
|
+
c = Albacore::Asmver::MultipleFilesConfig.new
|
25
|
+
yield c
|
26
|
+
|
27
|
+
c.configurations.each do |conf|
|
28
|
+
trace { "generating asmver for #{conf}" }
|
29
|
+
Albacore::Asmver::Task.new(conf.opts).execute
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
22
34
|
# a task for building sln or proj files - or just invoking something
|
23
35
|
# with MsBuild
|
24
36
|
def build *args, &block
|
@@ -1,79 +1,120 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'albacore/logging'
|
3
|
-
require 'albacore/cross_platform_cmd'
|
4
|
-
require 'albacore/cmd_config'
|
5
|
-
require 'albacore/errors/unfilled_property_error'
|
6
|
-
require 'albacore/
|
7
|
-
require 'albacore/task_types/asmver/
|
8
|
-
require 'albacore/task_types/asmver/
|
9
|
-
require 'albacore/task_types/asmver/
|
10
|
-
require 'albacore/task_types/asmver/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
1
|
+
require 'set'
|
2
|
+
require 'albacore/logging'
|
3
|
+
require 'albacore/cross_platform_cmd'
|
4
|
+
require 'albacore/cmd_config'
|
5
|
+
require 'albacore/errors/unfilled_property_error'
|
6
|
+
require 'albacore/project'
|
7
|
+
require 'albacore/task_types/asmver/cs'
|
8
|
+
require 'albacore/task_types/asmver/vb'
|
9
|
+
require 'albacore/task_types/asmver/cpp'
|
10
|
+
require 'albacore/task_types/asmver/fs'
|
11
|
+
require 'albacore/task_types/asmver/file_generator'
|
12
|
+
|
13
|
+
module Albacore
|
14
|
+
module Asmver
|
15
|
+
class MultipleFilesConfig
|
16
|
+
include ::Albacore::Logging
|
17
|
+
|
18
|
+
# list of xxproj files to iterate over
|
19
|
+
attr_writer :files
|
20
|
+
|
21
|
+
def attributes attrs
|
22
|
+
@attributes = attrs
|
23
|
+
end
|
24
|
+
|
25
|
+
# block should have signature: Project -> AsmVer::Config -> AsmVer::Config
|
26
|
+
# because you can use this block to change the configuration generated
|
27
|
+
def handle_config &block
|
28
|
+
@handle_config = block
|
29
|
+
end
|
30
|
+
|
31
|
+
def configurations
|
32
|
+
@files ||= FileList['**/*.{fsproj,csproj,vbproj}']
|
33
|
+
|
34
|
+
debug { "generating config for files: #{@files}" }
|
35
|
+
|
36
|
+
@files.map { |proj|
|
37
|
+
proj =~ /(\w\w)proj$/
|
38
|
+
[ $1, Project.new(proj) ]
|
39
|
+
}.map { |ext, proj|
|
40
|
+
attrs = @attributes.clone
|
41
|
+
attrs[:assembly_title] = proj.name
|
42
|
+
file_path = "#{proj.proj_path_base}/AssemblyVersionInfo.#{ext}"
|
43
|
+
cfg = Albacore::Asmver::Config.new file_path, proj.asmname, attrs
|
44
|
+
cfg = @handle_config.call(proj, cfg) if @handle_config
|
45
|
+
cfg
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Config
|
51
|
+
include CmdConfig
|
52
|
+
self.extend ConfigDSL
|
53
|
+
|
54
|
+
# the file name to write the assembly info to
|
55
|
+
attr_path_accessor :file_path
|
56
|
+
|
57
|
+
# the namespace to output into the version file
|
58
|
+
attr_writer :namespace
|
59
|
+
|
60
|
+
# (optional) output stream
|
61
|
+
attr_writer :out
|
62
|
+
|
63
|
+
# creates a new config with some pre-existing data
|
64
|
+
def initialize file_path = nil, namespace = nil, attributes = nil
|
65
|
+
@file_path, @namespace, @attributes = file_path, namespace, attributes
|
66
|
+
end
|
67
|
+
|
68
|
+
# the hash of attributes to write to the assembly info file
|
69
|
+
def attributes attrs
|
70
|
+
@attributes = attrs
|
71
|
+
end
|
72
|
+
|
73
|
+
def opts
|
74
|
+
raise Error, "#file_path is not set" unless (file_path or out)
|
75
|
+
ns = @namespace || '' # defaults to empty namespace if not set.
|
76
|
+
lang = lang_for file_path
|
77
|
+
m = Map.new attributes: @attributes,
|
78
|
+
namespace: ns,
|
79
|
+
file_path: @file_path,
|
80
|
+
language: lang
|
81
|
+
m[:out] = @out if @out
|
82
|
+
m
|
83
|
+
end
|
84
|
+
|
85
|
+
def to_s
|
86
|
+
"AsmVer::Config[#{file_path}]"
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
def lang_for path
|
91
|
+
mk = lambda { |lang| "Albacore::Asmver::#{lang}".split('::').inject(Object) { |o, c| o.const_get c }.new }
|
92
|
+
case File.extname path
|
93
|
+
when ".fs" then mk.call "Fs"
|
94
|
+
when ".cs" then mk.call "Cs"
|
95
|
+
when ".vb" then mk.call "Vb"
|
96
|
+
when ".cpp" then mk.call "Cpp"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
class Task
|
101
|
+
include Logging
|
102
|
+
def initialize opts
|
103
|
+
@opts = opts
|
104
|
+
end
|
105
|
+
def execute
|
106
|
+
lang = @opts.get :language
|
107
|
+
ns = @opts.get :namespace
|
108
|
+
attrs = @opts.get :attributes
|
109
|
+
out = @opts.get :out do
|
110
|
+
trace { "asmver being written at '#{@opts.get :file_path}' [asmver-task #execute]" }
|
111
|
+
File.open(@opts.get(:file_path), 'w')
|
112
|
+
end
|
113
|
+
::Albacore::Asmver::FileGenerator.new(lang, ns, @opts).generate out, attrs
|
114
|
+
trace { "asmver was written at '#{@opts.get :file_path}' [asmver-task #execute]" }
|
115
|
+
ensure
|
116
|
+
out.close if out
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
data/lib/albacore/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.0.rc.13
|
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-04-
|
13
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
@@ -317,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
317
317
|
version: '0'
|
318
318
|
segments:
|
319
319
|
- 0
|
320
|
-
hash:
|
320
|
+
hash: 799826362560465067
|
321
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
322
322
|
none: false
|
323
323
|
requirements:
|