firespring_dev_commands 2.1.20 → 2.1.21.pre.alpha.2
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: 87e1ba4de217508ebdec8d17da4156baaab7bfb45154519d5b5aa930d8f8755b
|
4
|
+
data.tar.gz: 9b208c659543d76dc89b7b9e92d21991445056d9cae72bf7616bed2b5169d6b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6c7ef9927e5b2cd60a0f21ebd50d6a2b0f96aa383c69d9b8196c2d4c4c11700350e231dcb34b5e1bf83f5953cc999ebbf6b7edcc8d0a9ee200275e936fda4cd
|
7
|
+
data.tar.gz: e97e145d2820c3ecd8143fafcf5a730edb39351fdfb2bf61b95344039e0ae54801c0029dccb6d1b313cd093aa195bcd775674145a23b2ba6a6838b77b3cf4297
|
@@ -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,10 +95,16 @@ 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
|
99
102
|
|
103
|
+
# Run the check to ensure code coverage meets the desired threshold
|
104
|
+
def check_test_coverage
|
105
|
+
coverage.check
|
106
|
+
end
|
107
|
+
|
100
108
|
# Build the php fast test command
|
101
109
|
def test_fast_command(processes = 4)
|
102
110
|
test = []
|
@@ -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.check_test_coverage
|
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.2
|
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:
|