bozo-scripts 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/bozo/hooks/octopus_create_release.rb +67 -67
- data/lib/bozo/packagers/nuget.rb +257 -234
- data/lib/bozo/test_runners/nunit.rb +165 -160
- data/lib/bozo/test_runners/nunit3.rb +94 -94
- data/lib/bozo/tools/octopustools.rb +47 -47
- data/lib/bozo_scripts.rb +38 -38
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZGIyNzM2MDhmY2YwNjM4ODE5MWMzNTdkNTVkZGVkYTNlNjIxYWZkZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTZhZDZhYWUzN2Q0NTFlOTQ5M2E3NmM3YTYyYjRhMzU5MTEzNzMxMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTYxN2ZjNGNmNDcyMGQ4OTczNjlmMTk4MjMyMzVhMDI1MTNjMWE0NWUwMTIx
|
10
|
+
ZmVlNWRmYjEyMTZkYjU5ZDFlZmQyZjYxZTFiOWU2YmFhZWNhOTM3YTQzMWE2
|
11
|
+
M2JjOGQwZDhjM2Q0NDljMTE0OTIzODY1YzMxNTgxODQyMTM4ZDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZmFiMWJhZDgxMmI4MDRjMGJkMjE3ZTlmMTk2OTQ3YzEyOTdjNGNjMTNmNDkz
|
14
|
+
ZjliNmQ3Y2UyODc2MWI3MTRmY2E4ZGYyYzVjMTQzNGJlZDNmM2ZiY2YwZTM0
|
15
|
+
YTQ5NDdmYmQ5OGViMjBhMjU5YWM5YmEyODFjYzEyNGVlOGVmZmQ=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.13.0
|
@@ -1,68 +1,68 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
# Hook to create a release in Octopus.
|
4
|
-
class OctopusCreateRelease
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@deploy_to = nil
|
8
|
-
@display_progress = false
|
9
|
-
end
|
10
|
-
|
11
|
-
def required_tools
|
12
|
-
:octopus_tools
|
13
|
-
end
|
14
|
-
|
15
|
-
# Specify the name of the Octopus Deploy project to create a release for.
|
16
|
-
def project(value)
|
17
|
-
@octopus_project = value
|
18
|
-
end
|
19
|
-
|
20
|
-
# The server address of Octopus.
|
21
|
-
def server(value)
|
22
|
-
@octopus_server = value
|
23
|
-
end
|
24
|
-
|
25
|
-
# The api key to authorise to Octopus with.
|
26
|
-
def api_key(value)
|
27
|
-
@octopus_api_key = value
|
28
|
-
end
|
29
|
-
|
30
|
-
# Specify the environment in Octopus to deploy to.
|
31
|
-
def deploy_to(value)
|
32
|
-
@deploy_to = value
|
33
|
-
end
|
34
|
-
|
35
|
-
# Write the deployment log from Octopus. If false
|
36
|
-
# then the hook does not wait for the release to complete.
|
37
|
-
def display_progress(value)
|
38
|
-
@display_progress = value
|
39
|
-
end
|
40
|
-
|
41
|
-
def post_publish
|
42
|
-
return unless build_server?
|
43
|
-
log_info "Creating release in Octopus for #{env['BUILD_VERSION_FULL']}"
|
44
|
-
|
45
|
-
args = []
|
46
|
-
args << File.expand_path(File.join('build', 'tools', 'octopustools', 'Octo.exe'))
|
47
|
-
args << 'create-release'
|
48
|
-
args << "--project \"#{@octopus_project}\""
|
49
|
-
args << "--version #{env['BUILD_VERSION_FULL']}"
|
50
|
-
args << "--packageversion #{env['BUILD_VERSION_FULL']}"
|
51
|
-
args << "--server #{@octopus_server}"
|
52
|
-
args << ['--apiKey', Bozo::SensitiveValue.new(@octopus_api_key)]
|
53
|
-
args << "--releaseNotes \"[Build #{env['BUILD_VERSION_FULL']}](#{env['BUILD_URL']})\""
|
54
|
-
|
55
|
-
if @display_progress
|
56
|
-
args << '--progress'
|
57
|
-
end
|
58
|
-
|
59
|
-
if @deploy_to
|
60
|
-
args << "--deployto=#{@deploy_to}"
|
61
|
-
end
|
62
|
-
|
63
|
-
execute_command :octo, args
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
# Hook to create a release in Octopus.
|
4
|
+
class OctopusCreateRelease
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@deploy_to = nil
|
8
|
+
@display_progress = false
|
9
|
+
end
|
10
|
+
|
11
|
+
def required_tools
|
12
|
+
:octopus_tools
|
13
|
+
end
|
14
|
+
|
15
|
+
# Specify the name of the Octopus Deploy project to create a release for.
|
16
|
+
def project(value)
|
17
|
+
@octopus_project = value
|
18
|
+
end
|
19
|
+
|
20
|
+
# The server address of Octopus.
|
21
|
+
def server(value)
|
22
|
+
@octopus_server = value
|
23
|
+
end
|
24
|
+
|
25
|
+
# The api key to authorise to Octopus with.
|
26
|
+
def api_key(value)
|
27
|
+
@octopus_api_key = value
|
28
|
+
end
|
29
|
+
|
30
|
+
# Specify the environment in Octopus to deploy to.
|
31
|
+
def deploy_to(value)
|
32
|
+
@deploy_to = value
|
33
|
+
end
|
34
|
+
|
35
|
+
# Write the deployment log from Octopus. If false
|
36
|
+
# then the hook does not wait for the release to complete.
|
37
|
+
def display_progress(value)
|
38
|
+
@display_progress = value
|
39
|
+
end
|
40
|
+
|
41
|
+
def post_publish
|
42
|
+
return unless build_server?
|
43
|
+
log_info "Creating release in Octopus for #{env['BUILD_VERSION_FULL']}"
|
44
|
+
|
45
|
+
args = []
|
46
|
+
args << File.expand_path(File.join('build', 'tools', 'octopustools', 'Octo.exe'))
|
47
|
+
args << 'create-release'
|
48
|
+
args << "--project \"#{@octopus_project}\""
|
49
|
+
args << "--version #{env['BUILD_VERSION_FULL']}"
|
50
|
+
args << "--packageversion #{env['BUILD_VERSION_FULL']}"
|
51
|
+
args << "--server #{@octopus_server}"
|
52
|
+
args << ['--apiKey', Bozo::SensitiveValue.new(@octopus_api_key)]
|
53
|
+
args << "--releaseNotes \"[Build #{env['BUILD_VERSION_FULL']}](#{env['BUILD_URL']})\""
|
54
|
+
|
55
|
+
if @display_progress
|
56
|
+
args << '--progress'
|
57
|
+
end
|
58
|
+
|
59
|
+
if @deploy_to
|
60
|
+
args << "--deployto=#{@deploy_to}"
|
61
|
+
end
|
62
|
+
|
63
|
+
execute_command :octo, args
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
68
|
end
|
data/lib/bozo/packagers/nuget.rb
CHANGED
@@ -1,234 +1,257 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
|
3
|
-
module Bozo::Packagers
|
4
|
-
|
5
|
-
class Nuget
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
@libraries = []
|
9
|
-
@executables = []
|
10
|
-
@websites = []
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
@executables
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
def
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
doc.
|
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
|
-
args
|
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
|
-
|
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
|
-
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Bozo::Packagers
|
4
|
+
|
5
|
+
class Nuget
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@libraries = []
|
9
|
+
@executables = []
|
10
|
+
@websites = []
|
11
|
+
@resources = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def destination(destination)
|
15
|
+
@destination = destination
|
16
|
+
end
|
17
|
+
|
18
|
+
def library(project, *extfiles)
|
19
|
+
@libraries << LibraryPackage.new(project, extfiles, self)
|
20
|
+
end
|
21
|
+
|
22
|
+
def library_with_option(project, opts = {})
|
23
|
+
@libraries << LibraryPackage.new(project, opts[:extfiles], self, opts[:excluded_references])
|
24
|
+
end
|
25
|
+
|
26
|
+
def executable(project)
|
27
|
+
@executables << ExecutablePackage.new(project)
|
28
|
+
end
|
29
|
+
|
30
|
+
def resource(project, base_directory)
|
31
|
+
@resources << ResourcePackage.new(project, base_directory)
|
32
|
+
end
|
33
|
+
|
34
|
+
def website(project)
|
35
|
+
@websites << WebsitePackage.new(project)
|
36
|
+
end
|
37
|
+
|
38
|
+
def required_tools
|
39
|
+
:nuget
|
40
|
+
end
|
41
|
+
|
42
|
+
def project_url(url)
|
43
|
+
@project_url = url
|
44
|
+
end
|
45
|
+
|
46
|
+
def license_url(url)
|
47
|
+
@license_url = url
|
48
|
+
end
|
49
|
+
|
50
|
+
def author(author)
|
51
|
+
@author = author
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_s
|
55
|
+
"Publish projects with nuget #{@libraries | @executables | @websites} to #{@destination}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def execute
|
59
|
+
@libraries.each {|project| package project}
|
60
|
+
@executables.each {|project| package project}
|
61
|
+
@websites.each {|project| package project}
|
62
|
+
@resources.each {|project| package project}
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns the version that the package should be given.
|
66
|
+
def package_version
|
67
|
+
env['BUILD_VERSION_FULL']
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def package(project)
|
73
|
+
spec_path = generate_specification(project)
|
74
|
+
create_package(project.name, spec_path, true)
|
75
|
+
end
|
76
|
+
|
77
|
+
def generate_specification(project)
|
78
|
+
log_debug "Generating specification for #{project.name}"
|
79
|
+
builder = Nokogiri::XML::Builder.new do |doc|
|
80
|
+
doc.package(:xmlns => "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd") do
|
81
|
+
doc.metadata do
|
82
|
+
doc.id project.name
|
83
|
+
doc.version_ package_version
|
84
|
+
doc.authors @author
|
85
|
+
doc.description project.name
|
86
|
+
doc.projectUrl @project_url
|
87
|
+
doc.licenseUrl @license_url
|
88
|
+
doc.dependencies do
|
89
|
+
project.dependencies.each do |dep|
|
90
|
+
doc.dependency(dep)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
doc.files do
|
95
|
+
project.files.each do |file|
|
96
|
+
doc.file(file)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
spec_path = File.expand_path(File.join('temp', 'nuget', "#{project.name}.nuspec"))
|
102
|
+
FileUtils.mkdir_p File.dirname(spec_path)
|
103
|
+
File.open(spec_path, 'w+') {|f| f.write(builder.to_xml)}
|
104
|
+
spec_path
|
105
|
+
end
|
106
|
+
|
107
|
+
def create_package(project, spec_path, omit_analysis = false)
|
108
|
+
args = []
|
109
|
+
|
110
|
+
dist_dir = File.expand_path(File.join('dist', 'nuget'))
|
111
|
+
|
112
|
+
args << File.expand_path(File.join('build', 'tools', 'nuget', 'NuGet.exe'))
|
113
|
+
args << 'pack'
|
114
|
+
args << "\"#{spec_path}\""
|
115
|
+
args << '-OutputDirectory'
|
116
|
+
args << "\"#{dist_dir}\""
|
117
|
+
args << '-NoPackageAnalysis' if omit_analysis
|
118
|
+
|
119
|
+
# Ensure the directory is there because Nuget won't make it
|
120
|
+
FileUtils.mkdir_p dist_dir
|
121
|
+
|
122
|
+
log_debug "Creating nuget package for #{project}"
|
123
|
+
|
124
|
+
execute_command :nuget, args
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
class ResourcePackage
|
132
|
+
def initialize(project, base_directory)
|
133
|
+
@name = project
|
134
|
+
@base_directory = base_directory
|
135
|
+
end
|
136
|
+
|
137
|
+
def name
|
138
|
+
@name
|
139
|
+
end
|
140
|
+
|
141
|
+
def dependencies
|
142
|
+
[]
|
143
|
+
end
|
144
|
+
|
145
|
+
def files
|
146
|
+
[{:src => File.expand_path(File.join(@base_directory, '**', '*.*')).gsub(/\//, '\\')}]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
class ExecutablePackage
|
151
|
+
def initialize(project)
|
152
|
+
@name = project
|
153
|
+
end
|
154
|
+
|
155
|
+
def name
|
156
|
+
@name
|
157
|
+
end
|
158
|
+
|
159
|
+
def dependencies
|
160
|
+
[]
|
161
|
+
end
|
162
|
+
|
163
|
+
def files
|
164
|
+
[{:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', '*.*')).gsub(/\//, '\\')}]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
class LibraryPackage
|
169
|
+
|
170
|
+
def initialize(project, extfiles, nuget, excluded_references = [])
|
171
|
+
@name = project
|
172
|
+
@nuget = nuget
|
173
|
+
@extfiles = extfiles
|
174
|
+
@excluded_references = excluded_references
|
175
|
+
end
|
176
|
+
|
177
|
+
def name
|
178
|
+
@name
|
179
|
+
end
|
180
|
+
|
181
|
+
def dependencies
|
182
|
+
project_reference_dependencies + nuget_dependencies
|
183
|
+
end
|
184
|
+
|
185
|
+
def files
|
186
|
+
files = []
|
187
|
+
|
188
|
+
%w{dll pdb xml}.map do |extension|
|
189
|
+
files << {:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', "#{@name}.#{extension}")).gsub(/\//, '\\'), :target => 'lib'}
|
190
|
+
end
|
191
|
+
|
192
|
+
@extfiles.map do |file|
|
193
|
+
files << {:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', file)).gsub(/\//, '\\'), :target => 'lib'}
|
194
|
+
end
|
195
|
+
|
196
|
+
files
|
197
|
+
end
|
198
|
+
|
199
|
+
private
|
200
|
+
|
201
|
+
def project_reference_dependencies
|
202
|
+
doc = Nokogiri::XML(File.open(project_file))
|
203
|
+
|
204
|
+
doc.xpath('//proj:Project/proj:ItemGroup/proj:ProjectReference/proj:Name', {"proj" => "http://schemas.microsoft.com/developer/msbuild/2003"}).map do |node|
|
205
|
+
{:id => node.text, :version => "[#{@nuget.package_version}]"}
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
# get dependencies from packages.config
|
210
|
+
def nuget_dependencies
|
211
|
+
package_file = packages_file
|
212
|
+
return [] unless File.exist? package_file
|
213
|
+
|
214
|
+
doc = Nokogiri::XML(File.open(package_file))
|
215
|
+
|
216
|
+
doc.xpath('//packages/package').map do |node|
|
217
|
+
{:id => node[:id], :version => "[#{node[:version]}]"} unless @excluded_references.include? node[:id]
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def packages_file
|
222
|
+
find_file_in_project 'packages.config'
|
223
|
+
end
|
224
|
+
|
225
|
+
def project_file
|
226
|
+
find_file_in_project "#{@name}.csproj"
|
227
|
+
end
|
228
|
+
|
229
|
+
def find_file_in_project(file_name)
|
230
|
+
file = File.expand_path(File.join('src', 'csharp', @name, file_name))
|
231
|
+
file = File.expand_path(File.join('test', 'csharp', @name, file_name)) unless File.exist? file
|
232
|
+
file
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
|
237
|
+
class WebsitePackage
|
238
|
+
|
239
|
+
def initialize(project)
|
240
|
+
@name = project
|
241
|
+
end
|
242
|
+
|
243
|
+
def name
|
244
|
+
@name
|
245
|
+
end
|
246
|
+
|
247
|
+
def dependencies
|
248
|
+
[]
|
249
|
+
end
|
250
|
+
|
251
|
+
def files
|
252
|
+
[{:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', '*.*')).gsub(/\//, '\\')}]
|
253
|
+
end
|
254
|
+
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|