firespring_dev_commands 2.1.21.pre.alpha.1 → 2.1.21.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: beba9e91440acb52b0d11b471288857a0dca2322339dc97332f1e1c2d0233689
4
- data.tar.gz: f5c188acfd23e35ef90b1b2f34ab198b5855659a16593563f59bdd4cdc3b242e
3
+ metadata.gz: 23ad8131b620682ed6d6e9b496934646615c3aca3c0656886a624e03c73f0041
4
+ data.tar.gz: 936887064f1e8e3c71193af00a105b3808ede716b5bf72cc959c7db63d459ac0
5
5
  SHA512:
6
- metadata.gz: 6bf7a75e329def5150ed99b105dc7c0da490c0078e5da88bb2cbf2477ef00b6f7b8b44dc98de36fc187f199095780cfbfa10e6e1b4cfd358ae7e760ae2bce684
7
- data.tar.gz: af4215015156cf33254dddb558bd2bfd633c25735e00260e624f1ef18dae350749b66b91d13ecd1a086fa4d0d7fafa1d8ee9e3b88677701648bf5c6879b73f89
6
+ metadata.gz: 89cd73bbf3342e5ff66a9762311bfd07a5c78f18aa7dc92d3edaef96d55277054a887b011b672a3a9d2689870a98c1a1784ee5061f6539bba8a95856fe86d095
7
+ data.tar.gz: e0a8077e578697502912063cdf9004d21c993cb32b54cbfb46b158f59b7f7a37ac6362358606070451113ead000bf7759859999cc9818eddbbeba7cdda43965f
@@ -1,5 +1,7 @@
1
1
  module Dev
2
+ # Module containing different classes for interfacing with coverage files
2
3
  module Coverage
4
+ # Class for checking code coverage using cobertura
3
5
  class Cobertura
4
6
  attr_reader :local_filename, :container_filename, :filename, :threshold
5
7
 
@@ -8,15 +10,18 @@ module Dev
8
10
  @local_filename = File.join(local_path || '.', @filename)
9
11
  @container_filename = File.join(container_path || '.', @filename)
10
12
  @threshold = threshold.to_f
13
+ end
11
14
 
15
+ # Remove any previous versions of the local file that will be output
16
+ # return the phpunit options needed to regenerate the cobertura xml file
17
+ def php_options
12
18
  # Remove any previous coverage info
13
19
  FileUtils.rm_f(local_filename, verbose: true)
14
- end
15
20
 
16
- def options
17
21
  %W(--coverage-cobertura #{container_filename})
18
22
  end
19
23
 
24
+ # Parse the cobertura file as a hash and check the total coverage against the desired threshold
20
25
  def check
21
26
  report = Ox.load(File.read(local_filename), mode: :hash)
22
27
  attrs, = report[:coverage]
@@ -95,11 +95,16 @@ module Dev
95
95
  def test_command
96
96
  test = []
97
97
  test << './vendor/bin/phpunit'
98
- test << coverage.options if coverage
98
+ test << coverage.php_options if coverage
99
99
  test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
100
100
  test
101
101
  end
102
102
 
103
+ # Run the check to ensure code coverage meets the desired threshold
104
+ def check_test_coverage
105
+ coverage.check
106
+ end
107
+
103
108
  # Build the php fast test command
104
109
  def test_fast_command(processes = 4)
105
110
  test = []
@@ -135,7 +135,7 @@ module Dev
135
135
  options = []
136
136
  options << '-T' if Dev::Common.new.running_codebuild?
137
137
  Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
138
- php.coverage.check
138
+ php.check_test_coverage
139
139
  end
140
140
  end
141
141
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.21.pre.alpha.1'.freeze
9
+ VERSION = '2.1.21.pre.alpha.3'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.1
4
+ version: 2.1.21.pre.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring