firespring_dev_commands 2.1.21.pre.alpha.8 → 2.1.21.pre.alpha.9
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 +4 -4
- data/lib/firespring_dev_commands/coverage/base.rb +13 -0
- data/lib/firespring_dev_commands/coverage/cobertura.rb +11 -3
- data/lib/firespring_dev_commands/coverage/none.rb +17 -0
- data/lib/firespring_dev_commands/php.rb +5 -5
- data/lib/firespring_dev_commands/templates/docker/php/application.rb +2 -2
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4189e443ce57ccf4e992178ad2dd0de137017a8d78f6d63a4e4f7b55f76fe61b
|
4
|
+
data.tar.gz: ab87b579efff5fe40edfad306c6088504b176b61f4d0997e8ab8804f65a61177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 329dc4520ff98700950aef5c5b67920e8f8b520d6f8eba693150526e7144c962b55c31924e0d956b108fe8914777d4d21daf14c20393bb3f61902c19dd92a315
|
7
|
+
data.tar.gz: 873fcd5623d4e007cd2018285656caa029fdbf9dc34714b64df4223a10cb118b95919bbc428176ee7d68b29da6aea130163881a5480cd0fe2db7a033795af8ae
|
@@ -2,15 +2,21 @@ module Dev
|
|
2
2
|
# Module containing different classes for interfacing with coverage files
|
3
3
|
module Coverage
|
4
4
|
# Class for checking code coverage using cobertura
|
5
|
-
class Cobertura
|
5
|
+
class Cobertura < Base
|
6
6
|
attr_reader :local_filename, :container_filename, :filename, :threshold, :exclude
|
7
7
|
|
8
8
|
def initialize(filename: File.join('coverage', 'cobertura.xml'), threshold: nil, container_path: nil, local_path: nil, exclude: nil)
|
9
|
+
super()
|
10
|
+
|
9
11
|
@filename = filename
|
10
12
|
@local_filename = File.join(local_path || '.', @filename)
|
11
13
|
@container_filename = File.join(container_path || '.', @filename)
|
12
14
|
@threshold = threshold
|
13
|
-
@exclude = exclude || []
|
15
|
+
@exclude = (exclude || []).map do |it|
|
16
|
+
next it if it.is_a?(Regex)
|
17
|
+
|
18
|
+
Regex.new(it)
|
19
|
+
end
|
14
20
|
end
|
15
21
|
|
16
22
|
# Remove any previous versions of the local file that will be output
|
@@ -55,12 +61,14 @@ module Dev
|
|
55
61
|
missed += 1 unless line.attributes[:hits].to_i.positive?
|
56
62
|
end
|
57
63
|
total = lines_processed.length
|
64
|
+
|
58
65
|
sanity_check_coverage_against_cobertura_values(package, missed, total)
|
59
66
|
missed
|
60
67
|
end
|
61
68
|
|
62
69
|
# Calculate the coverage percent based off the numbers we got and compare to the
|
63
70
|
# value cobertura reported. This is meant as a sanity check that we are reading the data correctly
|
71
|
+
# TODO: This should be removed after the above logic has been vetted
|
64
72
|
private def sanity_check_coverage_against_cobertura_values(package, missed, total)
|
65
73
|
line_rate = package.attributes[:'line-rate']
|
66
74
|
cobertura_reported_coverage = line_rate.to_f
|
@@ -71,7 +79,7 @@ module Dev
|
|
71
79
|
return if file_coverage == cobertura_reported_coverage
|
72
80
|
|
73
81
|
filename = package.attributes[:name]
|
74
|
-
puts "WARNINNG: #{filename} coverage (#{file_coverage}) differed from what cobertura reported (#{cobertura_reported_coverage})"
|
82
|
+
puts "WARNINNG: #{filename} coverage (#{file_coverage}) differed from what cobertura reported (#{cobertura_reported_coverage})"
|
75
83
|
end
|
76
84
|
end
|
77
85
|
end
|
@@ -8,12 +8,12 @@ module Dev
|
|
8
8
|
DEFAULT_PACKAGE_FILE = 'composer.json'.freeze
|
9
9
|
|
10
10
|
# Config object for setting top level git config options
|
11
|
-
Config = Struct.new(:container_path, :local_path, :package_file, :
|
11
|
+
Config = Struct.new(:container_path, :local_path, :package_file, :coverage) do
|
12
12
|
def initialize
|
13
13
|
self.container_path = DEFAULT_PATH
|
14
14
|
self.local_path = DEV_COMMANDS_ROOT_DIR
|
15
15
|
self.package_file = DEFAULT_PACKAGE_FILE
|
16
|
-
self.
|
16
|
+
self.coverage = nil
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -33,11 +33,11 @@ module Dev
|
|
33
33
|
|
34
34
|
attr_accessor :container_path, :local_path, :package_file, :coverage
|
35
35
|
|
36
|
-
def initialize(container_path: nil, local_path: nil, package_file: nil,
|
36
|
+
def initialize(container_path: nil, local_path: nil, package_file: nil, coverage: nil)
|
37
37
|
@container_path = container_path || self.class.config.container_path
|
38
38
|
@local_path = local_path || self.class.config.local_path
|
39
39
|
@package_file = package_file || self.class.config.package_file
|
40
|
-
@coverage = Dev::Coverage::
|
40
|
+
@coverage = coverage || Dev::Coverage::None.new
|
41
41
|
end
|
42
42
|
|
43
43
|
# The base npm command that is the starting point for all subsequent commands
|
@@ -95,7 +95,7 @@ module Dev
|
|
95
95
|
def test_command
|
96
96
|
test = []
|
97
97
|
test << './vendor/bin/phpunit'
|
98
|
-
test
|
98
|
+
test.concat(coverage.php_options) if coverage
|
99
99
|
test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
100
100
|
test
|
101
101
|
end
|
@@ -20,10 +20,10 @@ module Dev
|
|
20
20
|
container_path: nil,
|
21
21
|
local_path: nil,
|
22
22
|
start_container_dependencies_on_test: true,
|
23
|
-
|
23
|
+
coverage: nil,
|
24
24
|
exclude: []
|
25
25
|
)
|
26
|
-
@php = Dev::Php.new(container_path:, local_path:,
|
26
|
+
@php = Dev::Php.new(container_path:, local_path:, coverage:)
|
27
27
|
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
28
28
|
|
29
29
|
super(application, exclude:)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firespring_dev_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.21.pre.alpha.
|
4
|
+
version: 2.1.21.pre.alpha.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -333,7 +333,9 @@ files:
|
|
333
333
|
- lib/firespring_dev_commands/bloom_growth/user.rb
|
334
334
|
- lib/firespring_dev_commands/boolean.rb
|
335
335
|
- lib/firespring_dev_commands/common.rb
|
336
|
+
- lib/firespring_dev_commands/coverage/base.rb
|
336
337
|
- lib/firespring_dev_commands/coverage/cobertura.rb
|
338
|
+
- lib/firespring_dev_commands/coverage/none.rb
|
337
339
|
- lib/firespring_dev_commands/daterange.rb
|
338
340
|
- lib/firespring_dev_commands/docker.rb
|
339
341
|
- lib/firespring_dev_commands/docker/compose.rb
|