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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzQ5OWIxOTExNDk1MDU1MTNhYWU3MGNhZmQ0NmRhM2RkNmU1ZTkwYg==
4
+ ZGIyNzM2MDhmY2YwNjM4ODE5MWMzNTdkNTVkZGVkYTNlNjIxYWZkZQ==
5
5
  data.tar.gz: !binary |-
6
- MzljY2RkYTRmYjQ1NzlhMWY1MmNkZjMxNzBlZGM4ZDYyNjM3YWY1ZA==
6
+ OTZhZDZhYWUzN2Q0NTFlOTQ5M2E3NmM3YTYyYjRhMzU5MTEzNzMxMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzYzOTgyZWVmN2M2MzllZDNlZGVmYzA2ZWIyOGEwYThlNjNkMTdjMDc0Mzhi
10
- ZDIwYTNkZmMyZGU0MmNmYjI0YzM1NGEzMWRlMTgyNTczMjg3MDBmYmI0ZWZh
11
- NjY2NjBhNmU4YzJmYTNjNWI2MDJlNDgxYWM4MmMzMmVkYzVhMmY=
9
+ OTYxN2ZjNGNmNDcyMGQ4OTczNjlmMTk4MjMyMzVhMDI1MTNjMWE0NWUwMTIx
10
+ ZmVlNWRmYjEyMTZkYjU5ZDFlZmQyZjYxZTFiOWU2YmFhZWNhOTM3YTQzMWE2
11
+ M2JjOGQwZDhjM2Q0NDljMTE0OTIzODY1YzMxNTgxODQyMTM4ZDU=
12
12
  data.tar.gz: !binary |-
13
- OGFiN2ExOGNkOWRjYmQ2YjNmMjM0MzAwMWRmODk1YTA3ZjBlODllOGRjZTQ0
14
- MWY2MjJmZmY2Yzc4NzVkNzA0MDg2NTQ0MDcwN2Q5OGE4ZjVhNjJhMGI4ZTg0
15
- OTkzYzY1OGRlZDMxMjhhYjQyOThhZjE5ZTFhYjYxZjcyM2I0NGQ=
13
+ ZmFiMWJhZDgxMmI4MDRjMGJkMjE3ZTlmMTk2OTQ3YzEyOTdjNGNjMTNmNDkz
14
+ ZjliNmQ3Y2UyODc2MWI3MTRmY2E4ZGYyYzVjMTQzNGJlZDNmM2ZiY2YwZTM0
15
+ YTQ5NDdmYmQ5OGViMjBhMjU5YWM5YmEyODFjYzEyNGVlOGVmZmQ=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.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
@@ -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
- end
12
-
13
- def destination(destination)
14
- @destination = destination
15
- end
16
-
17
- def library(project, *extfiles)
18
- @libraries << LibraryPackage.new(project, extfiles, self)
19
- end
20
-
21
- def library_with_option(project, opts = {})
22
- @libraries << LibraryPackage.new(project, opts[:extfiles], self, opts[:excluded_references])
23
- end
24
-
25
- def executable(project)
26
- @executables << ExecutablePackage.new(project)
27
- end
28
-
29
- def website(project)
30
- @websites << WebsitePackage.new(project)
31
- end
32
-
33
- def required_tools
34
- :nuget
35
- end
36
-
37
- def project_url(url)
38
- @project_url = url
39
- end
40
-
41
- def license_url(url)
42
- @license_url = url
43
- end
44
-
45
- def author(author)
46
- @author = author
47
- end
48
-
49
- def to_s
50
- "Publish projects with nuget #{@libraries | @executables | @websites} to #{@destination}"
51
- end
52
-
53
- def execute
54
- @libraries.each {|project| package project}
55
- @executables.each {|project| package project}
56
- @websites.each {|project| package project}
57
- end
58
-
59
- # Returns the version that the package should be given.
60
- def package_version
61
- env['BUILD_VERSION_FULL']
62
- end
63
-
64
- private
65
-
66
- def package(project)
67
- spec_path = generate_specification(project)
68
- create_package(project.name, spec_path, true)
69
- end
70
-
71
- def generate_specification(project)
72
- log_debug "Generating specification for #{project.name}"
73
- builder = Nokogiri::XML::Builder.new do |doc|
74
- doc.package(:xmlns => "http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd") do
75
- doc.metadata do
76
- doc.id project.name
77
- doc.version_ package_version
78
- doc.authors @author
79
- doc.description project.name
80
- doc.projectUrl @project_url
81
- doc.licenseUrl @license_url
82
- doc.dependencies do
83
- project.dependencies.each do |dep|
84
- doc.dependency(dep)
85
- end
86
- end
87
- end
88
- doc.files do
89
- project.files.each do |file|
90
- doc.file(file)
91
- end
92
- end
93
- end
94
- end
95
- spec_path = File.expand_path(File.join('temp', 'nuget', "#{project.name}.nuspec"))
96
- FileUtils.mkdir_p File.dirname(spec_path)
97
- File.open(spec_path, 'w+') {|f| f.write(builder.to_xml)}
98
- spec_path
99
- end
100
-
101
- def create_package(project, spec_path, omit_analysis = false)
102
- args = []
103
-
104
- dist_dir = File.expand_path(File.join('dist', 'nuget'))
105
-
106
- args << File.expand_path(File.join('build', 'tools', 'nuget', 'NuGet.exe'))
107
- args << 'pack'
108
- args << "\"#{spec_path}\""
109
- args << '-OutputDirectory'
110
- args << "\"#{dist_dir}\""
111
- args << '-NoPackageAnalysis' if omit_analysis
112
-
113
- # Ensure the directory is there because Nuget won't make it
114
- FileUtils.mkdir_p dist_dir
115
-
116
- log_debug "Creating nuget package for #{project}"
117
-
118
- execute_command :nuget, args
119
- end
120
-
121
- end
122
-
123
- private
124
-
125
- class ExecutablePackage
126
-
127
- def initialize(project)
128
- @name = project
129
- end
130
-
131
- def name
132
- @name
133
- end
134
-
135
- def dependencies
136
- []
137
- end
138
-
139
- def files
140
- [{:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', '*.*')).gsub(/\//, '\\')}]
141
- end
142
-
143
- end
144
-
145
- class LibraryPackage
146
-
147
- def initialize(project, extfiles, nuget, excluded_references = [])
148
- @name = project
149
- @nuget = nuget
150
- @extfiles = extfiles
151
- @excluded_references = excluded_references
152
- end
153
-
154
- def name
155
- @name
156
- end
157
-
158
- def dependencies
159
- project_reference_dependencies + nuget_dependencies
160
- end
161
-
162
- def files
163
- files = []
164
-
165
- %w{dll pdb xml}.map do |extension|
166
- files << {:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', "#{@name}.#{extension}")).gsub(/\//, '\\'), :target => 'lib'}
167
- end
168
-
169
- @extfiles.map do |file|
170
- files << {:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', file)).gsub(/\//, '\\'), :target => 'lib'}
171
- end
172
-
173
- files
174
- end
175
-
176
- private
177
-
178
- def project_reference_dependencies
179
- doc = Nokogiri::XML(File.open(project_file))
180
-
181
- doc.xpath('//proj:Project/proj:ItemGroup/proj:ProjectReference/proj:Name', {"proj" => "http://schemas.microsoft.com/developer/msbuild/2003"}).map do |node|
182
- {:id => node.text, :version => "[#{@nuget.package_version}]"}
183
- end
184
- end
185
-
186
- # get dependencies from packages.config
187
- def nuget_dependencies
188
- package_file = packages_file
189
- return [] unless File.exist? package_file
190
-
191
- doc = Nokogiri::XML(File.open(package_file))
192
-
193
- doc.xpath('//packages/package').map do |node|
194
- {:id => node[:id], :version => "[#{node[:version]}]"} unless @excluded_references.include? node[:id]
195
- end
196
- end
197
-
198
- def packages_file
199
- find_file_in_project 'packages.config'
200
- end
201
-
202
- def project_file
203
- find_file_in_project "#{@name}.csproj"
204
- end
205
-
206
- def find_file_in_project(file_name)
207
- file = File.expand_path(File.join('src', 'csharp', @name, file_name))
208
- file = File.expand_path(File.join('test', 'csharp', @name, file_name)) unless File.exist? file
209
- file
210
- end
211
-
212
- end
213
-
214
- class WebsitePackage
215
-
216
- def initialize(project)
217
- @name = project
218
- end
219
-
220
- def name
221
- @name
222
- end
223
-
224
- def dependencies
225
- []
226
- end
227
-
228
- def files
229
- [{:src => File.expand_path(File.join('temp', 'msbuild', @name, '**', '*.*')).gsub(/\//, '\\')}]
230
- end
231
-
232
- end
233
-
234
- end
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