bozo-scripts 0.4.4 → 0.5.0
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/VERSION +1 -1
- data/lib/bozo/hooks/fxcop.rb +11 -7
- data/lib/bozo/test_runners/opencover.rb +137 -0
- data/lib/bozo/tools/opencover.rb +47 -0
- data/lib/bozo_scripts.rb +2 -0
- metadata +9 -25
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODM2NjU1NWE1MjhlMjc1ZTVmYzYyODAwNDVlYjVkNWEyNDMwOWU1Yg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjlmMWM3MjJlOTIxYzg3NWE1YmNjOWIzNmYyMDcyMGEyOGM2NTE5ZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MDhmOWY0Y2I1YjBlM2Q3MDZjMWUyNjRhNTQ5ODZhNmVkOTQ4OTc0ZjBmMmVm
|
10
|
+
MDE0ZTgyODhmNWM3MmEwZTFiZDk3YWViOGY2NWQ0M2MyZjgxZTliZmNiY2Nl
|
11
|
+
ODc1Y2JiNjU0ZTU0Yzc4NmU5Y2UwZWQwNWY5NTJjYTRjMmRjMTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjZhMTAzYzRiOGU4YTQyMGY5MjgzYjJhYTA1ZjIwZmZkYWZkYWZkODE4NDNl
|
14
|
+
ZTljYWI2MGZjMTc3ZGVlNzY5ZjljZWIyZDY3M2UzYjU3YzE1YzMwZjdiMDU1
|
15
|
+
ZjI5NGVmMzcxN2JhNzRkNTliNjU4MzcwOTcyNjE1ZDkwNTdjZjI=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/bozo/hooks/fxcop.rb
CHANGED
@@ -16,7 +16,7 @@ module Bozo::Hooks
|
|
16
16
|
program_files_path = ENV['ProgramFiles(x86)']
|
17
17
|
end
|
18
18
|
|
19
|
-
File.join(program_files_path, 'Microsoft Fxcop 10.0', '
|
19
|
+
File.join(program_files_path, 'Microsoft Fxcop 10.0', 'FxCopCmd.exe') unless program_files_path.nil?
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize
|
@@ -52,8 +52,8 @@ module Bozo::Hooks
|
|
52
52
|
def post_compile
|
53
53
|
config = config_with_defaults
|
54
54
|
|
55
|
-
raise no_executable_path_specified if path.nil?
|
56
|
-
raise no_executable_exists unless File.exists?(path)
|
55
|
+
raise no_executable_path_specified if config[:path].nil?
|
56
|
+
raise no_executable_exists unless File.exists?(config[:path])
|
57
57
|
|
58
58
|
if config[:project].nil?
|
59
59
|
execute_projects config
|
@@ -80,11 +80,11 @@ module Bozo::Hooks
|
|
80
80
|
# @param [Hash] config
|
81
81
|
# The fxcop configuration
|
82
82
|
def execute_projects(config)
|
83
|
-
log_debug "Executing projects with '#{path}'" if config[:framework_versions].any?
|
83
|
+
log_debug "Executing projects with '#{config[:path]}'" if config[:framework_versions].any?
|
84
84
|
|
85
85
|
config[:framework_versions].each do |framework_version|
|
86
86
|
args = []
|
87
|
-
args << '"' + path + '"'
|
87
|
+
args << '"' + config[:path] + '"'
|
88
88
|
args << "/out:#{output_path}\\#{Time.now.to_i}-#{framework_version}-FxCop-report.xml"
|
89
89
|
args << "/types:" + config[:types].join(',') unless config[:types].empty?
|
90
90
|
|
@@ -108,12 +108,16 @@ module Bozo::Hooks
|
|
108
108
|
def execute_fxcop_project(config)
|
109
109
|
log_debug "Executing fxcop project '#{config[:project]}' with '#{path}'"
|
110
110
|
|
111
|
+
output_file = File.join(out_path, File.basename(config[:project], '.*') + '-FxCop-report.xml' )
|
112
|
+
|
111
113
|
args = []
|
112
|
-
args << '"' + path + '"'
|
113
|
-
args << "/out:\"#{
|
114
|
+
args << '"' + config[:path] + '"'
|
115
|
+
args << "/out:\"#{output_file}\""
|
114
116
|
args << "/project:\"#{config[:project]}\""
|
115
117
|
args << "/types:" + config[:types].join(',') unless config[:types].empty?
|
116
118
|
|
119
|
+
FileUtils.mkdir_p(output_path)
|
120
|
+
|
117
121
|
execute_command :fx_cop, args
|
118
122
|
end
|
119
123
|
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Bozo::TestRunners
|
4
|
+
|
5
|
+
# Adds a code coverage test runner using openCover
|
6
|
+
#
|
7
|
+
# The default configuration looks for openCover in the ProgramFiles(x86) path
|
8
|
+
#
|
9
|
+
# Test runners can be defined foropenCover to run against. Each runner
|
10
|
+
# produces a separate dotcover output
|
11
|
+
class OpenCover
|
12
|
+
def self.default_path
|
13
|
+
File.join('build', 'tools', 'OpenCover', 'OpenCover.Console.exe')
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
@@defaults = {
|
18
|
+
:path => OpenCover.default_path,
|
19
|
+
:required => true
|
20
|
+
}
|
21
|
+
|
22
|
+
@config = {}
|
23
|
+
@runners = []
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns whether opencover is installed at the configured path
|
27
|
+
def opencover_installed?
|
28
|
+
path = configuration[:path]
|
29
|
+
|
30
|
+
return false if path.nil?
|
31
|
+
|
32
|
+
File.exist? path
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns the build tools required for this dependency resolver to run
|
36
|
+
# successfully.
|
37
|
+
def required_tools
|
38
|
+
:open_cover
|
39
|
+
end
|
40
|
+
|
41
|
+
# Adds a test runner
|
42
|
+
#
|
43
|
+
# @param [Symbol] runner
|
44
|
+
# A test runner to wrap with opencover
|
45
|
+
def runner(runner, &block)
|
46
|
+
add_instance runner, block
|
47
|
+
end
|
48
|
+
|
49
|
+
# Specifies whether covering with opencover is required
|
50
|
+
#
|
51
|
+
# If it is not required, and opencover cannot be found, then test runners
|
52
|
+
# are executed without coverage. If opencover is required but cannot be
|
53
|
+
# found then an error will occur.
|
54
|
+
#
|
55
|
+
# @param [boolean] required
|
56
|
+
# Whether opencover coverage is required
|
57
|
+
def required?(required = nil)
|
58
|
+
@config[:required] = required unless required.nil?
|
59
|
+
|
60
|
+
@config[:required]
|
61
|
+
end
|
62
|
+
|
63
|
+
def execute
|
64
|
+
if required? or opencover_installed?
|
65
|
+
@runners.each {|runner| execute_with_coverage runner}
|
66
|
+
else
|
67
|
+
@runners.each {|runner| execute_without_coverage(runner)}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
# Resolves the named class within the given namespace and then created an
|
74
|
+
# instance of the class before adding it to the given collection and
|
75
|
+
# yielding it to the configuration block when one is provided.
|
76
|
+
#
|
77
|
+
# @param [Symbol] type
|
78
|
+
# The name of the step executor.
|
79
|
+
# @param [Proc] block
|
80
|
+
# Optional block to refine the configuration of the step executor.
|
81
|
+
def add_instance(type, block)
|
82
|
+
instance = Bozo::TestRunners.const_get(to_class_name(type)).new
|
83
|
+
instance.extend Bozo::Runner
|
84
|
+
@runners << instance
|
85
|
+
block.call instance if block
|
86
|
+
end
|
87
|
+
|
88
|
+
# Converts a symbol into a Pascal Case class name.
|
89
|
+
#
|
90
|
+
# eg. `:single` => `"Single"`, `:two_words` => `"TwoWords"`.
|
91
|
+
#
|
92
|
+
# @param [Symbol] type
|
93
|
+
# The name of a step executor.
|
94
|
+
def to_class_name(type)
|
95
|
+
type.to_s.split('_').map{|word| word.capitalize}.join
|
96
|
+
end
|
97
|
+
|
98
|
+
def execute_without_coverage(runner)
|
99
|
+
log_debug 'Running ' + runner.class.to_s + ' without coverage'
|
100
|
+
runner.execute
|
101
|
+
end
|
102
|
+
|
103
|
+
def execute_with_coverage(runner)
|
104
|
+
if required? & !opencover_installed?
|
105
|
+
log_fatal "Attempting to run with coverage but opencover could not be found at #{configuration[:path]}"
|
106
|
+
end
|
107
|
+
|
108
|
+
log_debug "Running #{runner.class} with coverage"
|
109
|
+
|
110
|
+
config = configuration
|
111
|
+
opencover_path = config[:path]
|
112
|
+
output_file = File.expand_path(File.join('temp', 'opencover', "#{Time.now.to_i}-opencover-report.xml")).gsub(/\//, '\\')
|
113
|
+
|
114
|
+
FileUtils.mkdir_p(File.join('temp', 'opencover'))
|
115
|
+
|
116
|
+
args = []
|
117
|
+
args << '"' + opencover_path + '"'
|
118
|
+
args << ' -target:' + runner.runner_path
|
119
|
+
args << ' -targetargs:"' + runner.runner_args.flatten.join(' ') + ' /noshadow"'
|
120
|
+
args << ' -register:user'
|
121
|
+
args << " -output:#{output_file}"
|
122
|
+
|
123
|
+
log_debug 'Running opencover from "' + opencover_path + '"'
|
124
|
+
execute_command :open_cover, args
|
125
|
+
end
|
126
|
+
|
127
|
+
def configuration
|
128
|
+
config_with_defaults
|
129
|
+
end
|
130
|
+
|
131
|
+
def config_with_defaults
|
132
|
+
@@defaults.merge @config
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'zip/zipfilesystem'
|
3
|
+
|
4
|
+
module Bozo::Tools
|
5
|
+
class OpenCover
|
6
|
+
|
7
|
+
# Creates a new instance.
|
8
|
+
def initialize
|
9
|
+
@url = 'https://github.com/OpenCover/opencover/releases/download/4.6.166/opencover.4.6.166.zip'
|
10
|
+
end
|
11
|
+
|
12
|
+
# Sets the source url for the nuget tool to be retreived from
|
13
|
+
#
|
14
|
+
# @param [String] url
|
15
|
+
# A web server hosting the OpenCover tool
|
16
|
+
def source(url)
|
17
|
+
@url = url
|
18
|
+
end
|
19
|
+
|
20
|
+
# Retreives the OpenCover tool exe from the path
|
21
|
+
def retrieve(destination_path)
|
22
|
+
zip_file_path = download_path('opencover.4.6.166.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
@@ -24,9 +24,11 @@ require 'bozo/publishers/file_copy'
|
|
24
24
|
require 'bozo/publishers/nuget'
|
25
25
|
require 'bozo/publishers/rubygems'
|
26
26
|
require 'bozo/test_runners/dotcover'
|
27
|
+
require 'bozo/test_runners/opencover'
|
27
28
|
require 'bozo/test_runners/nunit'
|
28
29
|
require 'bozo/test_runners/runit'
|
29
30
|
require 'bozo/configuration'
|
30
31
|
require 'bozo/erubis_templating_coordinator'
|
31
32
|
require 'bozo/version'
|
32
33
|
require 'bozo/tools/nuget'
|
34
|
+
require 'bozo/tools/opencover'
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bozo-scripts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Garry Shutler
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2015-
|
12
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: nokogiri
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,7 +21,6 @@ dependencies:
|
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
@@ -31,7 +28,6 @@ dependencies:
|
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: erubis
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
32
|
- - ~>
|
37
33
|
- !ruby/object:Gem::Version
|
@@ -39,7 +35,6 @@ dependencies:
|
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
39
|
- - ~>
|
45
40
|
- !ruby/object:Gem::Version
|
@@ -47,7 +42,6 @@ dependencies:
|
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: test-unit
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :runtime
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -63,7 +56,6 @@ dependencies:
|
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: bozo
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
60
|
- - ~>
|
69
61
|
- !ruby/object:Gem::Version
|
@@ -71,7 +63,6 @@ dependencies:
|
|
71
63
|
type: :runtime
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
67
|
- - ~>
|
77
68
|
- !ruby/object:Gem::Version
|
@@ -79,7 +70,6 @@ dependencies:
|
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: zip
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
74
|
- - ~>
|
85
75
|
- !ruby/object:Gem::Version
|
@@ -87,7 +77,6 @@ dependencies:
|
|
87
77
|
type: :runtime
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
81
|
- - ~>
|
93
82
|
- !ruby/object:Gem::Version
|
@@ -100,6 +89,8 @@ executables: []
|
|
100
89
|
extensions: []
|
101
90
|
extra_rdoc_files: []
|
102
91
|
files:
|
92
|
+
- LICENSE
|
93
|
+
- VERSION
|
103
94
|
- lib/bozo/compilers/msbuild.rb
|
104
95
|
- lib/bozo/configuration.rb
|
105
96
|
- lib/bozo/dependency_resolvers/bundler.rb
|
@@ -123,40 +114,33 @@ files:
|
|
123
114
|
- lib/bozo/publishers/rubygems.rb
|
124
115
|
- lib/bozo/test_runners/dotcover.rb
|
125
116
|
- lib/bozo/test_runners/nunit.rb
|
117
|
+
- lib/bozo/test_runners/opencover.rb
|
126
118
|
- lib/bozo/test_runners/runit.rb
|
127
119
|
- lib/bozo/tools/nuget.rb
|
120
|
+
- lib/bozo/tools/opencover.rb
|
128
121
|
- lib/bozo/version.rb
|
129
122
|
- lib/bozo_scripts.rb
|
130
|
-
- VERSION
|
131
|
-
- LICENSE
|
132
123
|
homepage: https://github.com/zopaUK/bozo-scripts
|
133
124
|
licenses: []
|
125
|
+
metadata: {}
|
134
126
|
post_install_message:
|
135
127
|
rdoc_options: []
|
136
128
|
require_paths:
|
137
129
|
- lib
|
138
130
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
-
none: false
|
140
131
|
requirements:
|
141
132
|
- - ! '>='
|
142
133
|
- !ruby/object:Gem::Version
|
143
134
|
version: '0'
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
hash: -193942349
|
147
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
136
|
requirements:
|
150
137
|
- - ! '>='
|
151
138
|
- !ruby/object:Gem::Version
|
152
139
|
version: '0'
|
153
|
-
segments:
|
154
|
-
- 0
|
155
|
-
hash: -193942349
|
156
140
|
requirements: []
|
157
141
|
rubyforge_project: bozo-scripts
|
158
|
-
rubygems_version:
|
142
|
+
rubygems_version: 2.4.6
|
159
143
|
signing_key:
|
160
|
-
specification_version:
|
144
|
+
specification_version: 4
|
161
145
|
summary: Zopa build system scripts
|
162
146
|
test_files: []
|