bozo-scripts 0.15.0 → 0.16.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
- NTU4MGQ1ODczYjQ1ODQ4MzgzYTQ1MTM1OTMyYjY3MTY5NTJiOGZiZg==
4
+ NWNjM2I2MGQ0MzU5MzgzOWQ3YjEzZGVmZmY0MzNiMzJhYmNiZDNhOA==
5
5
  data.tar.gz: !binary |-
6
- YTljYWE4NGYxZTNhYzQzNGI1NDhmNzE4NzQyNGZmNWM1YTlkNGJmMQ==
6
+ YWFlOTYzMjdjNGRiMzJkMmRiZWQyZGIyMWMyOWU0NDUxNmMxOWJlNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjZmYjY3YTJlYjFkNTAwZjY5MTI1ZTc5YzEzNzU2MmQzOGU1MGI1NGMyNmQw
10
- NWY5ZTk1MjZjMTEwNGExNDExNzRkMzVmOWVkNWYyM2Q1YjFjNGZhNGRjYzk4
11
- MDk0ZGY0YmY1ZjAzNzg2NmE5ZWNjMTRmYTNkMTAxNzc3MTAxM2Q=
9
+ ZDNjMzFlMTZlYWI2ZmExNTg2Y2I0YzM0YmQ2NjA1MGE5NTg5NmNhNzYwNWQ3
10
+ NTE4YzUxMjZjZDNkY2I1MGFkZjRhNDcwOTlkYjRkNmEzNWNkYzU5M2QxNzk4
11
+ NWU1ZjE4ZWVhMjcxZjQ3NjM0NjVjYWQzODk4YjYwMGY1ZGVhYzg=
12
12
  data.tar.gz: !binary |-
13
- Y2I4YjFkY2U1YTQ5MTI4MWJkNzFjZWU3MTNlNDlmMjM2ZmZiZTY4MGM3YWE5
14
- ZGEyN2RkN2UyZGFhZjM0MzA0OTkzMDY5MDc5MWI0ZjkxNTU3ZWMzNzZlZDQ0
15
- MDQ1YWQ4N2UyY2NlYzI2YTgyMjgyN2E0OTViZTQ5ZWNkY2MyNTk=
13
+ YTY5MzhlYWIxOGYzNmFhNTY3ZGU5YmIxMGIwMzM5ZDIyMWQ2ZGMxYzQ0YjQ1
14
+ NDljZWZkNWI4OTcyYjBjNDBlOTdhMjRiYTI4OGNkY2ViMGQ2NGY5YmQ2NjAz
15
+ MDUzNDM0NDlmNDQzNDdiOGQyY2RkZjAxNjZjMWZiZGQ1ZDJlOWM=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.15.0
1
+ 0.16.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,257 +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
- @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
- dependencies = doc.xpath('//packages/package').map do |node|
217
- {:id => node[:id], :version => "[#{node[:version]}]"} unless (@excluded_references.include?(node[:id]) || node[:developmentDependency] == "true")
218
- end.compact
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
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
+ dependencies = doc.xpath('//packages/package').map do |node|
217
+ {:id => node[:id], :version => "[#{node[:version]}]"} unless (@excluded_references.include?(node[:id]) || node[:developmentDependency] == "true")
218
+ end.compact
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