bozo-scripts 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/bozo/hooks/octopus_create_release.rb +63 -0
- data/lib/bozo/tools/octopustools.rb +47 -0
- data/lib/bozo_scripts.rb +2 -0
- metadata +6 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.3
|
@@ -0,0 +1,63 @@
|
|
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
|
+
# Specify the name of the Octopus Deploy project to create a release for.
|
12
|
+
def project(value)
|
13
|
+
@octopus_project = value
|
14
|
+
end
|
15
|
+
|
16
|
+
# The server address of Octopus.
|
17
|
+
def server(value)
|
18
|
+
@octopus_server = value
|
19
|
+
end
|
20
|
+
|
21
|
+
# The api key to authorise to Octopus with.
|
22
|
+
def api_key(value)
|
23
|
+
@octopus_api_key = value
|
24
|
+
end
|
25
|
+
|
26
|
+
# Specify the environment in Octopus to deploy to.
|
27
|
+
def deploy_to(value)
|
28
|
+
@deploy_to = value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Write the deployment log from Octopus. If false
|
32
|
+
# then the hook does not wait for the release to complete.
|
33
|
+
def display_progress(value)
|
34
|
+
@display_progress = value
|
35
|
+
end
|
36
|
+
|
37
|
+
def post_publish
|
38
|
+
return unless build_server?
|
39
|
+
log_info "Creating release in Octopus for #{env['BUILD_VERSION_FULL']}"
|
40
|
+
|
41
|
+
args = []
|
42
|
+
args << 'create-release'
|
43
|
+
args << "--project \"#{@octopus_project}\""
|
44
|
+
args << "--version #{env['BUILD_VERSION_FULL']}"
|
45
|
+
args << "--package #{env['BUILD_VERSION_FULL']}"
|
46
|
+
args << "--server #{@octopus_server}"
|
47
|
+
args << "--apiKey #{@octopus_api_key}"
|
48
|
+
args << "--releaseNotes \"[Build #{env['BUILD_VERSION_FULL']}](#{env['BUILD_URL']})\""
|
49
|
+
|
50
|
+
if @display_progress
|
51
|
+
args << '--progress'
|
52
|
+
end
|
53
|
+
|
54
|
+
if @deploy_to
|
55
|
+
args << "--deployto=#{@deploy_to}"
|
56
|
+
end
|
57
|
+
|
58
|
+
execute_command :octo, args
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'zip/zipfilesystem'
|
3
|
+
|
4
|
+
module Bozo::Tools
|
5
|
+
class OctopusTools
|
6
|
+
|
7
|
+
# Creates a new instance.
|
8
|
+
def initialize
|
9
|
+
@url = 'https://download.octopusdeploy.com/octopus-tools/3.3.2/OctopusTools.3.3.2.zip'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Sets the source url for the Octopus Tools to be retrieved from
|
13
|
+
#
|
14
|
+
# @param [String] url
|
15
|
+
# A web server hosting the Octopus Tools
|
16
|
+
def source(url)
|
17
|
+
@url = url
|
18
|
+
end
|
19
|
+
|
20
|
+
# Retrieves the Octopus tools exe from the path
|
21
|
+
def retrieve(destination_path)
|
22
|
+
zip_file_path = download_path('OctopusTools.3.3.2.zip')
|
23
|
+
|
24
|
+
open(zip_file_path, 'wb') do |file|
|
25
|
+
file << open(@url).read
|
26
|
+
end
|
27
|
+
|
28
|
+
extract_zip(zip_file_path, destination_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def extract_zip(source, destination_path)
|
33
|
+
Zip::ZipFile.open(source) do |zip_file|
|
34
|
+
zip_file.each { |f|
|
35
|
+
f_path = File.join(destination_path, f.name)
|
36
|
+
FileUtils.mkdir_p(File.dirname(f_path))
|
37
|
+
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def download_path(source_name)
|
43
|
+
FileUtils.mkdir_p('temp')
|
44
|
+
File.join('temp', source_name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/bozo_scripts.rb
CHANGED
@@ -14,6 +14,7 @@ require 'bozo/hooks/git_tag_release'
|
|
14
14
|
require 'bozo/hooks/git_hub'
|
15
15
|
require 'bozo/hooks/hipchat'
|
16
16
|
require 'bozo/hooks/jenkins'
|
17
|
+
require 'bozo/hooks/octopus_create_release'
|
17
18
|
require 'bozo/hooks/teamcity'
|
18
19
|
require 'bozo/hooks/timing'
|
19
20
|
require 'bozo/packagers/rubygems'
|
@@ -33,4 +34,5 @@ require 'bozo/configuration'
|
|
33
34
|
require 'bozo/erubis_templating_coordinator'
|
34
35
|
require 'bozo/version'
|
35
36
|
require 'bozo/tools/nuget'
|
37
|
+
require 'bozo/tools/octopustools'
|
36
38
|
require 'bozo/tools/opencover'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bozo-scripts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-01-
|
13
|
+
date: 2016-01-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: nokogiri
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- lib/bozo/hooks/git_tag_release.rb
|
113
113
|
- lib/bozo/hooks/hipchat.rb
|
114
114
|
- lib/bozo/hooks/jenkins.rb
|
115
|
+
- lib/bozo/hooks/octopus_create_release.rb
|
115
116
|
- lib/bozo/hooks/teamcity.rb
|
116
117
|
- lib/bozo/hooks/timing.rb
|
117
118
|
- lib/bozo/packagers/nuget.rb
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- lib/bozo/test_runners/opencover.rb
|
129
130
|
- lib/bozo/test_runners/runit.rb
|
130
131
|
- lib/bozo/tools/nuget.rb
|
132
|
+
- lib/bozo/tools/octopustools.rb
|
131
133
|
- lib/bozo/tools/opencover.rb
|
132
134
|
- lib/bozo/version.rb
|
133
135
|
- lib/bozo_scripts.rb
|
@@ -147,7 +149,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
149
|
version: '0'
|
148
150
|
segments:
|
149
151
|
- 0
|
150
|
-
hash:
|
152
|
+
hash: -965351729
|
151
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
154
|
none: false
|
153
155
|
requirements:
|
@@ -156,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
158
|
version: '0'
|
157
159
|
segments:
|
158
160
|
- 0
|
159
|
-
hash:
|
161
|
+
hash: -965351729
|
160
162
|
requirements: []
|
161
163
|
rubyforge_project: bozo-scripts
|
162
164
|
rubygems_version: 1.8.29
|