firespring_dev_commands 2.1.20 → 2.1.21.pre.alpha.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beba9e91440acb52b0d11b471288857a0dca2322339dc97332f1e1c2d0233689
|
4
|
+
data.tar.gz: f5c188acfd23e35ef90b1b2f34ab198b5855659a16593563f59bdd4cdc3b242e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bf7a75e329def5150ed99b105dc7c0da490c0078e5da88bb2cbf2477ef00b6f7b8b44dc98de36fc187f199095780cfbfa10e6e1b4cfd358ae7e760ae2bce684
|
7
|
+
data.tar.gz: af4215015156cf33254dddb558bd2bfd633c25735e00260e624f1ef18dae350749b66b91d13ecd1a086fa4d0d7fafa1d8ee9e3b88677701648bf5c6879b73f89
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Dev
|
2
|
+
module Coverage
|
3
|
+
class Cobertura
|
4
|
+
attr_reader :local_filename, :container_filename, :filename, :threshold
|
5
|
+
|
6
|
+
def initialize(filename: 'cobertura.xml', threshold: nil, container_path: nil, local_path: nil)
|
7
|
+
@filename = filename
|
8
|
+
@local_filename = File.join(local_path || '.', @filename)
|
9
|
+
@container_filename = File.join(container_path || '.', @filename)
|
10
|
+
@threshold = threshold.to_f
|
11
|
+
|
12
|
+
# Remove any previous coverage info
|
13
|
+
FileUtils.rm_f(local_filename, verbose: true)
|
14
|
+
end
|
15
|
+
|
16
|
+
def options
|
17
|
+
%W(--coverage-cobertura #{container_filename})
|
18
|
+
end
|
19
|
+
|
20
|
+
def check
|
21
|
+
report = Ox.load(File.read(local_filename), mode: :hash)
|
22
|
+
attrs, = report[:coverage]
|
23
|
+
cov_pct = attrs[:'line-rate'].to_f * 100
|
24
|
+
raise format('Line coverage %.2f%% is less than the threshold %.2f%%', cov_pct, threshold) if cov_pct < threshold
|
25
|
+
|
26
|
+
puts format('Line coverage %.2f%% is above the threshold %.2f%%', cov_pct, threshold)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -8,11 +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) do
|
11
|
+
Config = Struct.new(:container_path, :local_path, :package_file, :coverage_threshold) 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.coverage_threshold = nil
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
@@ -30,12 +31,13 @@ module Dev
|
|
30
31
|
alias_method :configure, :config
|
31
32
|
end
|
32
33
|
|
33
|
-
attr_accessor :container_path, :local_path, :package_file
|
34
|
+
attr_accessor :container_path, :local_path, :package_file, :coverage
|
34
35
|
|
35
|
-
def initialize(container_path: nil, local_path: nil, package_file: nil)
|
36
|
+
def initialize(container_path: nil, local_path: nil, package_file: nil, coverage_threshold: nil)
|
36
37
|
@container_path = container_path || self.class.config.container_path
|
37
38
|
@local_path = local_path || self.class.config.local_path
|
38
39
|
@package_file = package_file || self.class.config.package_file
|
40
|
+
@coverage = Dev::Coverage::Cobertura.new(container_path:, local_path:, threshold: coverage_threshold)
|
39
41
|
end
|
40
42
|
|
41
43
|
# The base npm command that is the starting point for all subsequent commands
|
@@ -93,6 +95,7 @@ module Dev
|
|
93
95
|
def test_command
|
94
96
|
test = []
|
95
97
|
test << './vendor/bin/phpunit'
|
98
|
+
test << coverage.options if coverage
|
96
99
|
test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
97
100
|
test
|
98
101
|
end
|
@@ -20,10 +20,12 @@ module Dev
|
|
20
20
|
container_path: nil,
|
21
21
|
local_path: nil,
|
22
22
|
start_container_dependencies_on_test: true,
|
23
|
+
coverage_threshold: nil,
|
23
24
|
exclude: []
|
24
25
|
)
|
25
|
-
@php = Dev::Php.new(container_path:, local_path:)
|
26
|
+
@php = Dev::Php.new(container_path:, local_path:, coverage_threshold:)
|
26
27
|
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
28
|
+
|
27
29
|
super(application, exclude:)
|
28
30
|
end
|
29
31
|
|
@@ -133,6 +135,7 @@ module Dev
|
|
133
135
|
options = []
|
134
136
|
options << '-T' if Dev::Common.new.running_codebuild?
|
135
137
|
Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
|
138
|
+
php.coverage.check
|
136
139
|
end
|
137
140
|
end
|
138
141
|
end
|
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.
|
4
|
+
version: 2.1.21.pre.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Firespring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -333,6 +333,7 @@ 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/cobertura.rb
|
336
337
|
- lib/firespring_dev_commands/daterange.rb
|
337
338
|
- lib/firespring_dev_commands/docker.rb
|
338
339
|
- lib/firespring_dev_commands/docker/compose.rb
|
@@ -403,9 +404,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
403
404
|
version: '3.1'
|
404
405
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
405
406
|
requirements:
|
406
|
-
- - "
|
407
|
+
- - ">"
|
407
408
|
- !ruby/object:Gem::Version
|
408
|
-
version:
|
409
|
+
version: 1.3.1
|
409
410
|
requirements: []
|
410
411
|
rubygems_version: 3.4.10
|
411
412
|
signing_key:
|