albacore 2.0.0.rc.2 → 2.0.0.rc.3
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 +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
data/README.md
CHANGED
@@ -1,202 +1,262 @@
|
|
1
|
-
# Albacore Clean Slate
|
2
|
-
|
3
|
-
[](http://travis-ci.org/Albacore/albacore)
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
require '
|
45
|
-
|
46
|
-
require 'albacore
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
p.
|
75
|
-
|
76
|
-
p.
|
77
|
-
|
78
|
-
|
79
|
-
m.
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
```
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
1
|
+
# Albacore Clean Slate
|
2
|
+
|
3
|
+
[](http://travis-ci.org/Albacore/albacore)
|
4
|
+
|
5
|
+
Version 2.0 of Albacore.
|
6
|
+
|
7
|
+
This branch is the next official version. It is currently being used for
|
8
|
+
numerous builds for us and is free of known bugs. It works on RMI 1.9.3.
|
9
|
+
|
10
|
+
gem install albacore --prerelease
|
11
|
+
|
12
|
+
## Getting Started
|
13
|
+
|
14
|
+
In a command prompt, run:
|
15
|
+
|
16
|
+
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
|
17
|
+
|
18
|
+
Then start a new powershell, cygwin or mingw32 shell. You can now install the
|
19
|
+
Ruby framework:
|
20
|
+
|
21
|
+
cinst ruby.devkit
|
22
|
+
|
23
|
+
Now, restart your shell or reload its path variable. You now have rake
|
24
|
+
installed. Now you can install Albacore, the collection of tasktypes, tasks and
|
25
|
+
extension points aimed to make your life as a .Net developer easier:
|
26
|
+
|
27
|
+
gem install bundler
|
28
|
+
|
29
|
+
Bundler is a tool that fetches gems for you. Now, specify what ruby gems your
|
30
|
+
build will use. Create a new file, named `Gemfile`. This file should look like
|
31
|
+
this:
|
32
|
+
|
33
|
+
source 'http://rubygems.org'
|
34
|
+
gem 'albacore', '2.0.0.rc.2'
|
35
|
+
|
36
|
+
Now, install albacore from this repository by running:
|
37
|
+
|
38
|
+
bundle
|
39
|
+
|
40
|
+
In order to build your project, you need to create a `Rakefile`, with contents
|
41
|
+
like these:
|
42
|
+
|
43
|
+
``` ruby
|
44
|
+
require 'bundler/setup'
|
45
|
+
|
46
|
+
require 'albacore'
|
47
|
+
require 'albacore/tasks/versionizer'
|
48
|
+
require 'albacore/ext/teamcity'
|
49
|
+
|
50
|
+
Albacore::Tasks::Versionizer.new :versioning
|
51
|
+
|
52
|
+
desc 'Perform fast build (warn: doesn\'t d/l deps)'
|
53
|
+
build :quick_build do |b|
|
54
|
+
b.logging = 'detailed'
|
55
|
+
b.sln = 'src/MyProj.sln'
|
56
|
+
end
|
57
|
+
|
58
|
+
desc 'restore all nugets as per the packages.config files'
|
59
|
+
nugets_restore :restore do |p|
|
60
|
+
p.out = 'src/packages'
|
61
|
+
p.exe = 'buildsupport/NuGet.exe'
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'Perform full build'
|
65
|
+
build :build => [:versioning, :restore] do |b|
|
66
|
+
b.sln = 'src/MyProj.sln'
|
67
|
+
# alt: b.file = 'src/MyProj.sln'
|
68
|
+
end
|
69
|
+
|
70
|
+
directory 'build/pkg'
|
71
|
+
|
72
|
+
desc 'package nugets - finds all projects and package them'
|
73
|
+
nugets_pack :create_nugets => ['build/pkg', :versioning, :build] do |p|
|
74
|
+
p.files = FileList['src/**/*.{csproj,fsproj,nuspec}'].
|
75
|
+
exclude(/Tests/)
|
76
|
+
p.out = 'build/pkg'
|
77
|
+
p.exe = 'buildsupport/NuGet.exe'
|
78
|
+
p.with_metadata do |m|
|
79
|
+
m.description = 'A cool nuget'
|
80
|
+
m.authors = 'Henrik'
|
81
|
+
m.version = ENV['NUGET_VERSION']
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
task :default => :create_nugets
|
86
|
+
```
|
87
|
+
|
88
|
+
You can now run:
|
89
|
+
|
90
|
+
rake
|
91
|
+
|
92
|
+
## Contributing
|
93
|
+
|
94
|
+
1. Create a feature branch with your change:
|
95
|
+
a. With unit test
|
96
|
+
b. With feature
|
97
|
+
1. Send a PR with that feature branch to this branch
|
98
|
+
a. Make sure TravisCI is OK with it
|
99
|
+
b. Describe your PR in English.
|
100
|
+
|
101
|
+
## Task Types
|
102
|
+
|
103
|
+
Task types are the pre-built factories for rake tasks. They often take care of
|
104
|
+
what's slightly more complex, beyond just invoking commands.
|
105
|
+
|
106
|
+
### Docs: build
|
107
|
+
|
108
|
+
TBD
|
109
|
+
|
110
|
+
### Docs: nugets_pack
|
111
|
+
|
112
|
+
TBD
|
113
|
+
|
114
|
+
#### #no_project_dependencies
|
115
|
+
|
116
|
+
Cancel following of references between projects that cause nugets_pack to find and add as nuget dependencies, linked projects.
|
117
|
+
|
118
|
+
```
|
119
|
+
# TODO
|
120
|
+
```
|
121
|
+
|
122
|
+
### Docs: nugets_restore
|
123
|
+
|
124
|
+
TBD
|
125
|
+
|
126
|
+
### Docs: asmver
|
127
|
+
|
128
|
+
Generate a single file with assembly attributes. Code comments in example below
|
129
|
+
mention output in F#.
|
130
|
+
|
131
|
+
``` ruby
|
132
|
+
asmver :asmver do |a|
|
133
|
+
a.file_path = 'src/Version.fs' # required, no default
|
134
|
+
a.namespace = 'Hello.World' # required for F#, defaults to empty string '' for C#
|
135
|
+
# optional
|
136
|
+
a.attributes assembly_title: 'Hello.World', # generates: [<AssemblyTitle("Hello.World")>]
|
137
|
+
assembly_version: '0.1.2', # generates: [<AssemblyVersion("0.1.2")>]
|
138
|
+
my_product_attr: 'Hello world', # generates: [<MyProductAttr("Hello World")>]
|
139
|
+
a.out = StringIO.new # optional, don't use it this way: takes an IO/Stream
|
140
|
+
end
|
141
|
+
```
|
142
|
+
|
143
|
+
### Docs: test_runner
|
144
|
+
|
145
|
+
TBD
|
146
|
+
|
147
|
+
### Docs: nugets_authentication
|
148
|
+
|
149
|
+
TBD
|
150
|
+
|
151
|
+
## Tasks
|
152
|
+
|
153
|
+
Tasks are things you can include that create singleton ruby tasks that are
|
154
|
+
pre-named and pre-made. As opposed to the task types, these are 'includeable'.
|
155
|
+
More info can be found in the
|
156
|
+
[README](https://github.com/Albacore/albacore/blob/clean_slate/lib/albacore/tasks/README.md).
|
157
|
+
|
158
|
+
### Versionizer
|
159
|
+
|
160
|
+
Helper for reading a `.semver` file and moving information from that file, as
|
161
|
+
well as information from the git commit being built upon, to the execution of
|
162
|
+
rake/albacore.
|
163
|
+
|
164
|
+
Defines/sets ENV vars:
|
165
|
+
|
166
|
+
* BUILD_VERSION
|
167
|
+
* NUGET_VERSION
|
168
|
+
* FORMAL_VERSION
|
169
|
+
|
170
|
+
BUILD_VERSION s constructed as such: `.semver-file -> %Major.%minor.%patch%special.git-sha1`.
|
171
|
+
|
172
|
+
NUGET_VERSION leaves out the git commit hash.
|
173
|
+
|
174
|
+
FORMAL_VERSION uses only the integers 'major', 'minor' and 'patch'.
|
175
|
+
|
176
|
+
Publishes symbol `:build_version`.
|
177
|
+
|
178
|
+
``` ruby
|
179
|
+
Albacore::Tasks::Versionizer.new :versioning
|
180
|
+
```
|
181
|
+
|
182
|
+
## Tools
|
183
|
+
|
184
|
+
Tools are auxilliary items in albacore. They do not have the same amount of
|
185
|
+
testing and are more often one-off utilities. Most of these should be moved to
|
186
|
+
being commands in an albacore binary.
|
187
|
+
|
188
|
+
### Docs: csprojfiles
|
189
|
+
|
190
|
+
Checks the difference between the filesystem and the files referenced in a
|
191
|
+
csproj, to make sure that they match. Run as a part of a CI build.
|
192
|
+
|
193
|
+
``` ruby
|
194
|
+
desc "Check the difference between the filesystem and the files referenced in a csproj"
|
195
|
+
csprojfiles do |f|
|
196
|
+
# Files to ignore
|
197
|
+
# for instance if you have source control specific files that are not supposed to be in the project
|
198
|
+
f.ignore_files = [/.*\.srccontrol/]
|
199
|
+
f.project = "src/MyMvcSite/MyMvcSite.csproj"
|
200
|
+
end
|
201
|
+
```
|
202
|
+
|
203
|
+
When you run this task it will report any differences between the filesystem and
|
204
|
+
the csproj file.
|
205
|
+
|
206
|
+
Why is this important? It's important to know what resources will be deployed.
|
207
|
+
For instance if you have added an image. If you forgot to include the image in
|
208
|
+
the .csproj, it will show up while developing but not when you do a web
|
209
|
+
deployment (i.e. a release).
|
210
|
+
|
211
|
+
It could also be that you have deleted a file, but forgotten to save the project
|
212
|
+
when you send your latest commit to source control…
|
213
|
+
|
214
|
+
How do you use it? The best way is to have it on a CI server in order to get a
|
215
|
+
notification whenever it detects deviations.
|
216
|
+
|
217
|
+
The task will fail with a message and rake will return with an non zero exit
|
218
|
+
code. For instance if a file is missing from csproj and another from the
|
219
|
+
filesystem:
|
220
|
+
|
221
|
+
- Files in src/MyMvcSite/MyMvcSite.csproj but not on filesystem:
|
222
|
+
file_missing_on_filesystem.cshtml
|
223
|
+
+ Files not in src/MyMvcSite/MyMvcSite.csproj but on filesystem:
|
224
|
+
file_missing_in_csproj.png
|
225
|
+
|
226
|
+
## Ideas:
|
227
|
+
|
228
|
+
When building multiple configurations,
|
229
|
+
Build tasks should be invoked with different parameters
|
230
|
+
According to the graph of tasks to be executed
|
231
|
+
|
232
|
+
``` ruby
|
233
|
+
require 'albacore'
|
234
|
+
|
235
|
+
Albacore.vary_by_parameters do |params|
|
236
|
+
# write to dynamic method
|
237
|
+
params.Configuration = ['Debug-Tests', 'Release']
|
238
|
+
end
|
239
|
+
|
240
|
+
build :b do |b|
|
241
|
+
b.vary_by_param 'Configuration'
|
242
|
+
end
|
243
|
+
|
244
|
+
nugets_pack :p => :b do |p|
|
245
|
+
# ...
|
246
|
+
end
|
247
|
+
|
248
|
+
task :default => :p
|
249
|
+
```
|
250
|
+
|
251
|
+
Creating two runs
|
252
|
+
* `:b[Debug-Tests] => :p => :default` and
|
253
|
+
* `:b[Release] => :p => :default`
|
254
|
+
|
255
|
+
where only :b is invoked twice, but :p and :default are only invoked only once
|
256
|
+
each.
|
257
|
+
|
258
|
+
---
|
259
|
+
|
260
|
+
When building services and/or web sites,
|
261
|
+
The bundling task_type should take care of packaging for deployment
|
262
|
+
|