bozo-scripts 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE +18 -18
- data/VERSION +1 -1
- data/lib/bozo/compilers/msbuild.rb +299 -279
- data/lib/bozo/configuration.rb +154 -154
- data/lib/bozo/dependency_resolvers/bundler.rb +53 -53
- data/lib/bozo/dependency_resolvers/nuget.rb +85 -85
- data/lib/bozo/erubis_templating_coordinator.rb +127 -127
- data/lib/bozo/hooks/fxcop.rb +151 -151
- data/lib/bozo/hooks/git_commit_hashes.rb +11 -11
- data/lib/bozo/hooks/git_hub.rb +79 -79
- data/lib/bozo/hooks/git_tag_release.rb +22 -22
- data/lib/bozo/hooks/hipchat.rb +101 -101
- data/lib/bozo/hooks/jenkins.rb +18 -18
- data/lib/bozo/hooks/teamcity.rb +91 -91
- data/lib/bozo/hooks/timing.rb +40 -40
- data/lib/bozo/packagers/nuget.rb +226 -226
- data/lib/bozo/packagers/rubygems.rb +23 -23
- data/lib/bozo/preparers/common_assembly_info.rb +34 -34
- data/lib/bozo/preparers/file_templating.rb +152 -152
- data/lib/bozo/publishers/file_copy.rb +82 -82
- data/lib/bozo/publishers/rubygems.rb +17 -17
- data/lib/bozo/test_runners/dotcover.rb +157 -157
- data/lib/bozo/test_runners/nunit.rb +130 -130
- data/lib/bozo/test_runners/runit.rb +34 -34
- data/lib/bozo/version.rb +4 -4
- data/lib/bozo_scripts.rb +29 -29
- metadata +5 -23
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZWU0ZDc5OTZmMzg4ZGVhOTY4YThjODFjN2UxOTM4MDZiMjQ5OTY2Mw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YjBhYjc3MmJhZTdjOGQ5ZGE5Nzg2Y2Y2YzFlM2Y2N2ViNGUxODkzYg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
M2U0NTc5ZGZmZjkxOGY3OGM2Zjc5YjZjZTBjM2Q4ZWZhNzcxYjI5NDEwMjg5
|
10
|
+
ZGI0YTkyOTUwZWZhYTAyNDExZDc4OTE1ZmFlOGVmMmQyOTFhYjdjOTRmMmU4
|
11
|
+
MjYzZmM2N2QwZTc4MDcyZTJmNzIyNDQzZjQ3MDBjNWMwZGUzMGI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDVkYTgxMTBhM2ZjNjEzNjFkMzc4NjE0ZjMxMzNkNjMxMzI4OWMyMDI3NGE3
|
14
|
+
ZWE1Y2Q0MzliN2YxNWM1ZTAxZGUyYzY3ZTY2OWM3YjZhYmVjMTdmYjM3YzVm
|
15
|
+
ZTZlOWJmYWU1MjAzOGY1YjQyYzI4NDZiMzBkNTFhOTQxYzdkMjI=
|
data/LICENSE
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
Copyright (C) 2012 Zopa Ltd
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
-
this software and associated documentation files (the "Software"), to deal in
|
5
|
-
the Software without restriction, including without limitation the rights to
|
6
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
-
so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
1
|
+
Copyright (C) 2012 Zopa Ltd
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
19
|
SOFTWARE.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -1,279 +1,299 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
config
|
19
|
-
config[:
|
20
|
-
config
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
@config[:properties]
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
@targets
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
projects.
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
projects
|
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
|
-
args
|
191
|
-
|
192
|
-
args << '
|
193
|
-
args <<
|
194
|
-
args <<
|
195
|
-
args <<
|
196
|
-
|
197
|
-
config[:
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
end
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
end
|
265
|
-
|
266
|
-
def
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Bozo::Compilers
|
5
|
+
|
6
|
+
class Msbuild
|
7
|
+
|
8
|
+
def config_with_defaults
|
9
|
+
defaults = {
|
10
|
+
:version => 'v4.0.30319',
|
11
|
+
:framework => 'Framework64',
|
12
|
+
:properties => {:configuration => :release},
|
13
|
+
:max_cores => nil
|
14
|
+
}
|
15
|
+
|
16
|
+
default_targets = [:build]
|
17
|
+
|
18
|
+
config = defaults.merge @config
|
19
|
+
config[:targets] = (@targets or default_targets).clone
|
20
|
+
config[:websites_as_zip] = false
|
21
|
+
config
|
22
|
+
end
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
@config = {}
|
26
|
+
@exclude_projects = []
|
27
|
+
end
|
28
|
+
|
29
|
+
def version(version)
|
30
|
+
@config[:version] = version
|
31
|
+
end
|
32
|
+
|
33
|
+
def framework(framework)
|
34
|
+
@config[:framework] = framework
|
35
|
+
end
|
36
|
+
|
37
|
+
def solution(path)
|
38
|
+
@config[:solution] = path
|
39
|
+
end
|
40
|
+
|
41
|
+
def property(args)
|
42
|
+
@config[:properties] ||= {}
|
43
|
+
@config[:properties] = @config[:properties].merge(args)
|
44
|
+
end
|
45
|
+
|
46
|
+
def exclude_project(project_name)
|
47
|
+
@exclude_projects << project_name
|
48
|
+
end
|
49
|
+
|
50
|
+
def websites_as_zip?
|
51
|
+
@config[:websites_as_zip] = true
|
52
|
+
end
|
53
|
+
|
54
|
+
# Assign how many cores should be used by msbuild
|
55
|
+
#
|
56
|
+
# @param [Integer] cores
|
57
|
+
# The maximum number of cores to allow msbuild to use
|
58
|
+
def max_cores(cores)
|
59
|
+
@config[:max_cores] = cores
|
60
|
+
end
|
61
|
+
|
62
|
+
alias :properties :property
|
63
|
+
|
64
|
+
def target(target)
|
65
|
+
@targets ||= []
|
66
|
+
@targets << target
|
67
|
+
end
|
68
|
+
|
69
|
+
def to_s
|
70
|
+
config = configuration
|
71
|
+
"Compile with msbuild #{config[:version]} building #{config[:solution]} with properties #{config[:properties]} for targets #{config[:targets]}"
|
72
|
+
end
|
73
|
+
|
74
|
+
def without_stylecop
|
75
|
+
@config[:without_stylecop] = true
|
76
|
+
end
|
77
|
+
|
78
|
+
def configuration
|
79
|
+
config_with_defaults
|
80
|
+
end
|
81
|
+
|
82
|
+
def execute
|
83
|
+
projects = (project_files('test') | project_files('src')).map { |file| create_project file }
|
84
|
+
|
85
|
+
# Clean all the projects first.
|
86
|
+
projects.each do |project|
|
87
|
+
project.clean configuration
|
88
|
+
end
|
89
|
+
|
90
|
+
# Build all the projects so they can utilize each others artifacts.
|
91
|
+
projects.each do |project|
|
92
|
+
project.build configuration
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def project_files(directory)
|
97
|
+
project_file_matcher = File.expand_path(File.join(directory, 'csharp', '**', '*.csproj'))
|
98
|
+
Dir[project_file_matcher].select { |p| not @exclude_projects.include?(File.basename p, '.csproj') }
|
99
|
+
end
|
100
|
+
|
101
|
+
def required_tools
|
102
|
+
:stylecop unless @config[:without_stylecop]
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
# Creates a project based on the project_file type.
|
108
|
+
# Defaults to a class library project if it cannot be determined.
|
109
|
+
# @return [Project]
|
110
|
+
def create_project(project_file)
|
111
|
+
project_name = File.basename(project_file).gsub(/\.csproj$/, '')
|
112
|
+
log_debug project_name
|
113
|
+
|
114
|
+
project_class_for(project_file).new project_file, project_name
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [Class]
|
118
|
+
def project_class_for(project_file)
|
119
|
+
project_types = project_types_from project_file
|
120
|
+
web_app_type = '{349c5851-65df-11da-9384-00065b846f21}'
|
121
|
+
if tools_version(project_file) == "3.5"
|
122
|
+
project_types.include?(web_app_type) ? WebProject2008 : ClassLibrary
|
123
|
+
else
|
124
|
+
project_types.include?(web_app_type) ? WebProject2010 : ClassLibrary
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# @return [Array]
|
129
|
+
def project_types_from(project_file)
|
130
|
+
project_types = []
|
131
|
+
|
132
|
+
File.open(project_file) do |f|
|
133
|
+
element = Nokogiri::XML(f).css('Project PropertyGroup ProjectTypeGuids').first
|
134
|
+
project_types = element.content.split(';').map {|e| e.downcase } unless element.nil?
|
135
|
+
end
|
136
|
+
|
137
|
+
project_types
|
138
|
+
end
|
139
|
+
|
140
|
+
def tools_version(project_file)
|
141
|
+
tools_version = nil
|
142
|
+
|
143
|
+
File.open(project_file) do |f|
|
144
|
+
element = Nokogiri::XML(f).css('Project').first
|
145
|
+
tools_version = element['ToolsVersion'] unless element.nil?
|
146
|
+
end
|
147
|
+
|
148
|
+
tools_version
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
private
|
154
|
+
|
155
|
+
class Project
|
156
|
+
|
157
|
+
include Bozo::Runner
|
158
|
+
|
159
|
+
def initialize(project_file, project_name)
|
160
|
+
@project_file = project_file
|
161
|
+
@project_name = project_name
|
162
|
+
end
|
163
|
+
|
164
|
+
def build(configuration)
|
165
|
+
populate_config(configuration)
|
166
|
+
args = generate_args configuration
|
167
|
+
execute_command :msbuild, args
|
168
|
+
end
|
169
|
+
|
170
|
+
def clean(configuration)
|
171
|
+
configuration[:targets] = [:clean]
|
172
|
+
args = generate_args configuration
|
173
|
+
execute_command :msbuild, args
|
174
|
+
|
175
|
+
remove_obj_directory
|
176
|
+
end
|
177
|
+
|
178
|
+
def framework_version
|
179
|
+
framework_version = 'unknown'
|
180
|
+
|
181
|
+
File.open(@project_file) do |f|
|
182
|
+
framework_version = Nokogiri::XML(f).css('Project PropertyGroup TargetFrameworkVersion').first.content
|
183
|
+
framework_version = framework_version.sub('v', 'net').sub('.', '')
|
184
|
+
end
|
185
|
+
|
186
|
+
framework_version
|
187
|
+
end
|
188
|
+
|
189
|
+
def generate_args(config)
|
190
|
+
args = []
|
191
|
+
|
192
|
+
args << File.join(ENV['WINDIR'], 'Microsoft.NET', config[:framework], config[:version], 'msbuild.exe')
|
193
|
+
args << '/nologo'
|
194
|
+
args << '/verbosity:normal'
|
195
|
+
args << '/nodeReuse:false'
|
196
|
+
args << "/target:#{config[:targets].map{|t| t.to_s}.join(';')}"
|
197
|
+
args << "/maxcpucount" if config[:max_cores].nil? # let msbuild decide how many cores to use
|
198
|
+
args << "/maxcpucount:#{config[:max_cores]}" unless config[:max_cores].nil? # specifying the number of cores
|
199
|
+
|
200
|
+
config[:properties].each do |key, value|
|
201
|
+
args << "/property:#{key}=\"#{value}\""
|
202
|
+
end
|
203
|
+
|
204
|
+
args << "\"#{@project_file}\""
|
205
|
+
end
|
206
|
+
|
207
|
+
def windowsize_path(path)
|
208
|
+
path.gsub(/\//, '\\')
|
209
|
+
end
|
210
|
+
|
211
|
+
def location
|
212
|
+
File.expand_path(File.join('temp', 'msbuild', @project_name, framework_version))
|
213
|
+
end
|
214
|
+
|
215
|
+
private
|
216
|
+
|
217
|
+
def remove_obj_directory
|
218
|
+
if Dir.exists?(obj_directory)
|
219
|
+
log_info "Removing #{obj_directory}"
|
220
|
+
FileUtils.rm_rf obj_directory
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def obj_directory
|
225
|
+
File.join(project_path, 'obj')
|
226
|
+
end
|
227
|
+
|
228
|
+
def project_path
|
229
|
+
File.dirname(@project_file)
|
230
|
+
end
|
231
|
+
|
232
|
+
end
|
233
|
+
|
234
|
+
class ClassLibrary < Project
|
235
|
+
|
236
|
+
def populate_config(config)
|
237
|
+
config[:properties][:outputpath] = location + '/'
|
238
|
+
config[:properties][:solutiondir] = windowsize_path(File.expand_path('.') + '//')
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
|
243
|
+
class WebProject2010 < Project
|
244
|
+
|
245
|
+
def populate_config(config)
|
246
|
+
config[:targets] << :package
|
247
|
+
|
248
|
+
config[:properties][:packagelocation] = location + '/Site.zip'
|
249
|
+
config[:properties][:packageassinglefile] = true
|
250
|
+
|
251
|
+
config[:properties][:solutiondir] = windowsize_path(File.expand_path('.') + '//')
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
class WebProject2008 < Project
|
257
|
+
|
258
|
+
require 'zip/zip'
|
259
|
+
|
260
|
+
def build(configuration)
|
261
|
+
super
|
262
|
+
|
263
|
+
zip_website if configuration[:websites_as_zip]
|
264
|
+
end
|
265
|
+
|
266
|
+
def zip_website
|
267
|
+
zip_file = zip_location_dir 'Site.zip'
|
268
|
+
|
269
|
+
Dir["#{location}/**/**"].reject { |f| f == zip_file }.each do |file|
|
270
|
+
FileUtils.rm_rf file
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
def zip_location_dir(zip_file_name)
|
275
|
+
zip_path = location + "/#{zip_file_name}"
|
276
|
+
|
277
|
+
Zip::ZipFile.open(zip_path, Zip::ZipFile::CREATE) do |zipfile|
|
278
|
+
Dir["#{location}/**/**"].each do |file|
|
279
|
+
zipfile.add(file.sub(location + '/', ''), file)
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
zip_path
|
284
|
+
end
|
285
|
+
|
286
|
+
def populate_config(config)
|
287
|
+
config[:targets] << :'ResolveReferences'
|
288
|
+
config[:targets] << :'_CopyWebApplication'
|
289
|
+
|
290
|
+
config[:properties][:OutDir] = location + '/bin/'
|
291
|
+
config[:properties][:WebProjectOutputDir] = windowsize_path location
|
292
|
+
config[:properties][:_DebugSymbolsProduced] = false
|
293
|
+
|
294
|
+
config[:properties][:solutiondir] = windowsize_path(File.expand_path('.') + '//')
|
295
|
+
end
|
296
|
+
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|