bozo-scripts 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,12 +1,12 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
class GitCommitHashes
|
4
|
-
|
5
|
-
def post_dependencies
|
6
|
-
env['GIT_HASH'] = `git log -1 --format="%h"`.strip
|
7
|
-
env['GIT_HASH_FULL'] = `git log -1 --format="%H"`.strip
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
11
|
-
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
class GitCommitHashes
|
4
|
+
|
5
|
+
def post_dependencies
|
6
|
+
env['GIT_HASH'] = `git log -1 --format="%h"`.strip
|
7
|
+
env['GIT_HASH_FULL'] = `git log -1 --format="%H"`.strip
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
12
|
end
|
data/lib/bozo/hooks/git_hub.rb
CHANGED
@@ -1,79 +1,79 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
# Hooks for notifying GitHub of the build
|
4
|
-
#
|
5
|
-
# The following env variables are required
|
6
|
-
# - BUILD_URL
|
7
|
-
# - BUILD_NUMBER
|
8
|
-
#
|
9
|
-
# with_hook :git_hub do |h|
|
10
|
-
# h.token '.....'
|
11
|
-
# h.owner 'zopaUK'
|
12
|
-
# h.repo 'bozo-scripts'
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
class GitHub
|
16
|
-
require 'net/http'
|
17
|
-
require 'openssl'
|
18
|
-
require 'json'
|
19
|
-
|
20
|
-
def pre_build
|
21
|
-
submit_notification(:pending, "Build #{build_number} pending")
|
22
|
-
end
|
23
|
-
|
24
|
-
def post_build
|
25
|
-
submit_notification(:success, "Build #{build_number} succeeded")
|
26
|
-
end
|
27
|
-
|
28
|
-
def failed_build
|
29
|
-
submit_notification(:failure, "Build #{build_number} failed")
|
30
|
-
end
|
31
|
-
|
32
|
-
def token(token)
|
33
|
-
@token = token
|
34
|
-
end
|
35
|
-
|
36
|
-
def owner(owner)
|
37
|
-
@owner = owner
|
38
|
-
end
|
39
|
-
|
40
|
-
def repo(repo)
|
41
|
-
@repo = repo
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def build_url
|
47
|
-
env['BUILD_URL']
|
48
|
-
end
|
49
|
-
|
50
|
-
def build_number
|
51
|
-
env['BUILD_NUMBER']
|
52
|
-
end
|
53
|
-
|
54
|
-
def submit_notification(state, description)
|
55
|
-
return unless build_server?
|
56
|
-
|
57
|
-
log_info "Notifying GitHub of #{state} - #{description} - #{build_url}"
|
58
|
-
|
59
|
-
commit = `git rev-parse HEAD`
|
60
|
-
|
61
|
-
uri = URI("https://api.github.com/repos/#{@owner}/#{@repo}/statuses/#{commit}")
|
62
|
-
header = {
|
63
|
-
'Content-Type' => 'application/json',
|
64
|
-
'Authorization' => "token #{@token}",
|
65
|
-
'User-Agent' => 'Bozo GitHub notifier'
|
66
|
-
}
|
67
|
-
data = { state: state, description: description, target_url: build_url}.to_json
|
68
|
-
|
69
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
70
|
-
http.use_ssl = true
|
71
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
72
|
-
http.post(uri.request_uri, data, header)
|
73
|
-
|
74
|
-
log_info "Notified GitHub of #{state} - #{description} - #{build_url}"
|
75
|
-
end
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
# Hooks for notifying GitHub of the build
|
4
|
+
#
|
5
|
+
# The following env variables are required
|
6
|
+
# - BUILD_URL
|
7
|
+
# - BUILD_NUMBER
|
8
|
+
#
|
9
|
+
# with_hook :git_hub do |h|
|
10
|
+
# h.token '.....'
|
11
|
+
# h.owner 'zopaUK'
|
12
|
+
# h.repo 'bozo-scripts'
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
class GitHub
|
16
|
+
require 'net/http'
|
17
|
+
require 'openssl'
|
18
|
+
require 'json'
|
19
|
+
|
20
|
+
def pre_build
|
21
|
+
submit_notification(:pending, "Build #{build_number} pending")
|
22
|
+
end
|
23
|
+
|
24
|
+
def post_build
|
25
|
+
submit_notification(:success, "Build #{build_number} succeeded")
|
26
|
+
end
|
27
|
+
|
28
|
+
def failed_build
|
29
|
+
submit_notification(:failure, "Build #{build_number} failed")
|
30
|
+
end
|
31
|
+
|
32
|
+
def token(token)
|
33
|
+
@token = token
|
34
|
+
end
|
35
|
+
|
36
|
+
def owner(owner)
|
37
|
+
@owner = owner
|
38
|
+
end
|
39
|
+
|
40
|
+
def repo(repo)
|
41
|
+
@repo = repo
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def build_url
|
47
|
+
env['BUILD_URL']
|
48
|
+
end
|
49
|
+
|
50
|
+
def build_number
|
51
|
+
env['BUILD_NUMBER']
|
52
|
+
end
|
53
|
+
|
54
|
+
def submit_notification(state, description)
|
55
|
+
return unless build_server?
|
56
|
+
|
57
|
+
log_info "Notifying GitHub of #{state} - #{description} - #{build_url}"
|
58
|
+
|
59
|
+
commit = `git rev-parse HEAD`
|
60
|
+
|
61
|
+
uri = URI("https://api.github.com/repos/#{@owner}/#{@repo}/statuses/#{commit}")
|
62
|
+
header = {
|
63
|
+
'Content-Type' => 'application/json',
|
64
|
+
'Authorization' => "token #{@token}",
|
65
|
+
'User-Agent' => 'Bozo GitHub notifier'
|
66
|
+
}
|
67
|
+
data = { state: state, description: description, target_url: build_url}.to_json
|
68
|
+
|
69
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
70
|
+
http.use_ssl = true
|
71
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
72
|
+
http.post(uri.request_uri, data, header)
|
73
|
+
|
74
|
+
log_info "Notified GitHub of #{state} - #{description} - #{build_url}"
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
# Hook to tag a git repository when a release is published from a build
|
4
|
-
# server.
|
5
|
-
class GitTagRelease
|
6
|
-
|
7
|
-
def post_publish
|
8
|
-
return unless build_server?
|
9
|
-
log_info "Tagging repository for release #{version}"
|
10
|
-
|
11
|
-
tag_name = "rel-#{version}"
|
12
|
-
|
13
|
-
if `git tag`.split("\n").include? tag_name
|
14
|
-
raise Bozo::ConfigurationError.new "The tag #{tag_name} already exists"
|
15
|
-
end
|
16
|
-
|
17
|
-
execute_command :git, ['git', 'tag', tag_name]
|
18
|
-
execute_command :git, ['git', 'push', '--tags']
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
# Hook to tag a git repository when a release is published from a build
|
4
|
+
# server.
|
5
|
+
class GitTagRelease
|
6
|
+
|
7
|
+
def post_publish
|
8
|
+
return unless build_server?
|
9
|
+
log_info "Tagging repository for release #{version}"
|
10
|
+
|
11
|
+
tag_name = "rel-#{version}"
|
12
|
+
|
13
|
+
if `git tag`.split("\n").include? tag_name
|
14
|
+
raise Bozo::ConfigurationError.new "The tag #{tag_name} already exists"
|
15
|
+
end
|
16
|
+
|
17
|
+
execute_command :git, ['git', 'tag', tag_name]
|
18
|
+
execute_command :git, ['git', 'push', '--tags']
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
23
|
end
|
data/lib/bozo/hooks/hipchat.rb
CHANGED
@@ -1,102 +1,102 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
# Hooks for notifying Hipchat of the build
|
4
|
-
#
|
5
|
-
# The following env variables are required
|
6
|
-
# - BUILD_URL
|
7
|
-
# - BUILD_NAME
|
8
|
-
#
|
9
|
-
# with_hook :hipchat do |h|
|
10
|
-
# h.token '.....'
|
11
|
-
# h.room_id 'Dev'
|
12
|
-
# h.name 'Bozo'
|
13
|
-
# h.notify :failure
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
class Hipchat
|
17
|
-
require 'net/http'
|
18
|
-
require 'openssl'
|
19
|
-
require 'json'
|
20
|
-
|
21
|
-
COLOR_MAP = { pending: 'gray', success: 'green', failure: 'red' }
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
@name = 'Bozo'
|
25
|
-
@notify = []
|
26
|
-
end
|
27
|
-
|
28
|
-
def pre_build
|
29
|
-
submit_notification(:pending, "Building #{project_name}")
|
30
|
-
end
|
31
|
-
|
32
|
-
def post_build
|
33
|
-
submit_notification(:success, "Built #{project_name}")
|
34
|
-
end
|
35
|
-
|
36
|
-
def failed_build
|
37
|
-
submit_notification(:failure, "Failed to build #{project_name}")
|
38
|
-
end
|
39
|
-
|
40
|
-
def token(token)
|
41
|
-
@token = token
|
42
|
-
end
|
43
|
-
|
44
|
-
def room_id(room)
|
45
|
-
@room = room
|
46
|
-
end
|
47
|
-
|
48
|
-
def name(name)
|
49
|
-
@name = name
|
50
|
-
end
|
51
|
-
|
52
|
-
def notify(state)
|
53
|
-
@notify << state
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def build_url
|
59
|
-
env['BUILD_URL']
|
60
|
-
end
|
61
|
-
|
62
|
-
def build_number
|
63
|
-
env['BUILD_NUMBER']
|
64
|
-
end
|
65
|
-
|
66
|
-
def project_name
|
67
|
-
env['BUILD_NAME']
|
68
|
-
end
|
69
|
-
|
70
|
-
def submit_notification(state, description)
|
71
|
-
return unless build_server?
|
72
|
-
return unless @notify.include?(state)
|
73
|
-
|
74
|
-
log_info "Notifying Hipchat of #{state} - #{description} - #{build_url}"
|
75
|
-
|
76
|
-
message = "#{description} - <a href=\"#{build_url}\">view</a>"
|
77
|
-
|
78
|
-
uri = URI("https://api.hipchat.com/v1/rooms/message?format=json&auth_token=#{@token}")
|
79
|
-
header = {
|
80
|
-
'Content-Type' => 'application/x-www-form-urlencoded',
|
81
|
-
'User-Agent' => 'Bozo Hipchat notifier'
|
82
|
-
}
|
83
|
-
data = URI.encode_www_form({
|
84
|
-
room_id: @room,
|
85
|
-
from: @name,
|
86
|
-
message: message,
|
87
|
-
message_format: 'html',
|
88
|
-
color: COLOR_MAP[state],
|
89
|
-
notify: state == :failure ? '1' : '0'
|
90
|
-
})
|
91
|
-
|
92
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
93
|
-
http.use_ssl = true
|
94
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
95
|
-
http.post(uri.request_uri, data, header)
|
96
|
-
|
97
|
-
log_info "Notified Hipchat of #{state} - #{description} - #{build_url}"
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
# Hooks for notifying Hipchat of the build
|
4
|
+
#
|
5
|
+
# The following env variables are required
|
6
|
+
# - BUILD_URL
|
7
|
+
# - BUILD_NAME
|
8
|
+
#
|
9
|
+
# with_hook :hipchat do |h|
|
10
|
+
# h.token '.....'
|
11
|
+
# h.room_id 'Dev'
|
12
|
+
# h.name 'Bozo'
|
13
|
+
# h.notify :failure
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
class Hipchat
|
17
|
+
require 'net/http'
|
18
|
+
require 'openssl'
|
19
|
+
require 'json'
|
20
|
+
|
21
|
+
COLOR_MAP = { pending: 'gray', success: 'green', failure: 'red' }
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@name = 'Bozo'
|
25
|
+
@notify = []
|
26
|
+
end
|
27
|
+
|
28
|
+
def pre_build
|
29
|
+
submit_notification(:pending, "Building #{project_name}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def post_build
|
33
|
+
submit_notification(:success, "Built #{project_name}")
|
34
|
+
end
|
35
|
+
|
36
|
+
def failed_build
|
37
|
+
submit_notification(:failure, "Failed to build #{project_name}")
|
38
|
+
end
|
39
|
+
|
40
|
+
def token(token)
|
41
|
+
@token = token
|
42
|
+
end
|
43
|
+
|
44
|
+
def room_id(room)
|
45
|
+
@room = room
|
46
|
+
end
|
47
|
+
|
48
|
+
def name(name)
|
49
|
+
@name = name
|
50
|
+
end
|
51
|
+
|
52
|
+
def notify(state)
|
53
|
+
@notify << state
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def build_url
|
59
|
+
env['BUILD_URL']
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_number
|
63
|
+
env['BUILD_NUMBER']
|
64
|
+
end
|
65
|
+
|
66
|
+
def project_name
|
67
|
+
env['BUILD_NAME']
|
68
|
+
end
|
69
|
+
|
70
|
+
def submit_notification(state, description)
|
71
|
+
return unless build_server?
|
72
|
+
return unless @notify.include?(state)
|
73
|
+
|
74
|
+
log_info "Notifying Hipchat of #{state} - #{description} - #{build_url}"
|
75
|
+
|
76
|
+
message = "#{description} - <a href=\"#{build_url}\">view</a>"
|
77
|
+
|
78
|
+
uri = URI("https://api.hipchat.com/v1/rooms/message?format=json&auth_token=#{@token}")
|
79
|
+
header = {
|
80
|
+
'Content-Type' => 'application/x-www-form-urlencoded',
|
81
|
+
'User-Agent' => 'Bozo Hipchat notifier'
|
82
|
+
}
|
83
|
+
data = URI.encode_www_form({
|
84
|
+
room_id: @room,
|
85
|
+
from: @name,
|
86
|
+
message: message,
|
87
|
+
message_format: 'html',
|
88
|
+
color: COLOR_MAP[state],
|
89
|
+
notify: state == :failure ? '1' : '0'
|
90
|
+
})
|
91
|
+
|
92
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
93
|
+
http.use_ssl = true
|
94
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
95
|
+
http.post(uri.request_uri, data, header)
|
96
|
+
|
97
|
+
log_info "Notified Hipchat of #{state} - #{description} - #{build_url}"
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
102
|
end
|
data/lib/bozo/hooks/jenkins.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
module Bozo::Hooks
|
2
|
-
|
3
|
-
class Jenkins
|
4
|
-
|
5
|
-
def pre_build
|
6
|
-
if Jenkins.hosted_in_jenkins?
|
7
|
-
env['BUILD_URL'] = ENV['BUILD_URL']
|
8
|
-
env['BUILD_NUMBER'] = ENV['BUILD_NUMBER']
|
9
|
-
env['BUILD_NAME'] = ENV['JOB_NAME']
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.hosted_in_jenkins?
|
14
|
-
not ENV['JENKINS_HOME'].nil?
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
|
1
|
+
module Bozo::Hooks
|
2
|
+
|
3
|
+
class Jenkins
|
4
|
+
|
5
|
+
def pre_build
|
6
|
+
if Jenkins.hosted_in_jenkins?
|
7
|
+
env['BUILD_URL'] = ENV['BUILD_URL']
|
8
|
+
env['BUILD_NUMBER'] = ENV['BUILD_NUMBER']
|
9
|
+
env['BUILD_NAME'] = ENV['JOB_NAME']
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.hosted_in_jenkins?
|
14
|
+
not ENV['JENKINS_HOME'].nil?
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
19
|
end
|