firespring_dev_commands 2.1.20.pre.alpha.1 → 2.1.21.pre.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/firespring_dev_commands/coverage/cobertura.rb +30 -0
- data/lib/firespring_dev_commands/php.rb +6 -3
- data/lib/firespring_dev_commands/platform.rb +1 -1
- data/lib/firespring_dev_commands/templates/docker/application.rb +2 -2
- data/lib/firespring_dev_commands/templates/docker/node/application.rb +19 -5
- data/lib/firespring_dev_commands/templates/docker/php/application.rb +21 -5
- data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +18 -5
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +3 -2
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
|
@@ -8,7 +8,7 @@ module Dev
|
|
8
8
|
# Normalize the ruby platform to return a docker platform architecture format
|
9
9
|
def determine_compute_architecture
|
10
10
|
case RUBY_PLATFORM
|
11
|
-
when /x86_64|amd64/
|
11
|
+
when /x86_64|amd64|x64-mingw/
|
12
12
|
'linux/amd64' # 64-bit Intel/AMD architecture
|
13
13
|
when /arm|aarch64/
|
14
14
|
'linux/arm64' # ARM architecture
|
@@ -72,7 +72,7 @@ module Dev
|
|
72
72
|
return if exclude.include?(:sh)
|
73
73
|
|
74
74
|
desc "Open a shell into a running #{application} container"
|
75
|
-
task sh: %W(init_docker #{application}:
|
75
|
+
task sh: %W(init_docker #{application}:up_no_deps _pre_sh_hooks) do
|
76
76
|
Dev::Docker::Compose.new(services: [application]).sh
|
77
77
|
Rake::Task[:_post_sh_hooks].execute
|
78
78
|
end
|
@@ -154,7 +154,7 @@ module Dev
|
|
154
154
|
return if exclude.include?(:reload)
|
155
155
|
|
156
156
|
desc "Reloads the #{application} container"
|
157
|
-
task reload: %w(init_docker _pre_reload_hooks down
|
157
|
+
task reload: %w(init_docker _pre_reload_hooks down up_no_deps) do
|
158
158
|
Rake::Task[:_post_reload_hooks].execute
|
159
159
|
end
|
160
160
|
end
|
@@ -7,11 +7,24 @@ module Dev
|
|
7
7
|
module Node
|
8
8
|
# Class for default rake tasks associated with a node project
|
9
9
|
class Application < Dev::Template::ApplicationInterface
|
10
|
-
attr_reader :node
|
11
|
-
|
12
|
-
#
|
13
|
-
|
10
|
+
attr_reader :node, :start_container_dependencies_on_test
|
11
|
+
|
12
|
+
# Create the templated rake tasks for the node application
|
13
|
+
#
|
14
|
+
# @param application [String] The name of the application
|
15
|
+
# @param container_path [String] The path to the application inside of the container
|
16
|
+
# @param local_path [String] The path to the application on your local system
|
17
|
+
# @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
|
18
|
+
# @param exclude [Array<Symbol>] An array of default template tasks to exclude
|
19
|
+
def initialize(
|
20
|
+
application,
|
21
|
+
container_path: nil,
|
22
|
+
local_path: nil,
|
23
|
+
start_container_dependencies_on_test: true,
|
24
|
+
exclude: []
|
25
|
+
)
|
14
26
|
@node = Dev::Node.new(container_path:, local_path:)
|
27
|
+
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
15
28
|
super(application, exclude:)
|
16
29
|
end
|
17
30
|
|
@@ -59,6 +72,7 @@ module Dev
|
|
59
72
|
application = @name
|
60
73
|
node = @node
|
61
74
|
exclude = @exclude
|
75
|
+
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
62
76
|
return if exclude.include?(:test)
|
63
77
|
|
64
78
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -70,7 +84,7 @@ module Dev
|
|
70
84
|
|
71
85
|
namespace :node do
|
72
86
|
desc "Run all node tests against the #{application}'s codebase"
|
73
|
-
task test: %
|
87
|
+
task test: %W(init_docker #{up_cmd}) do
|
74
88
|
LOG.debug("Running all node tests in the #{application} codebase")
|
75
89
|
|
76
90
|
options = []
|
@@ -7,11 +7,25 @@ module Dev
|
|
7
7
|
module Php
|
8
8
|
# Class for default rake tasks associated with a php project
|
9
9
|
class Application < Dev::Template::ApplicationInterface
|
10
|
-
attr_reader :php
|
10
|
+
attr_reader :php, :start_container_dependencies_on_test
|
11
|
+
|
12
|
+
# Create the templated rake tasks for the php application
|
13
|
+
#
|
14
|
+
# @param application [String] The name of the application
|
15
|
+
# @param container_path [String] The path to the application inside of the container
|
16
|
+
# @param local_path [String] The path to the application on your local system
|
17
|
+
# @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
|
18
|
+
def initialize(
|
19
|
+
application,
|
20
|
+
container_path: nil,
|
21
|
+
local_path: nil,
|
22
|
+
start_container_dependencies_on_test: true,
|
23
|
+
coverage_threshold: nil,
|
24
|
+
exclude: []
|
25
|
+
)
|
26
|
+
@php = Dev::Php.new(container_path:, local_path:, coverage_threshold:)
|
27
|
+
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
11
28
|
|
12
|
-
# Allow for custom container path for the application
|
13
|
-
def initialize(application, container_path: nil, local_path: nil, exclude: [])
|
14
|
-
@php = Dev::Php.new(container_path:, local_path:)
|
15
29
|
super(application, exclude:)
|
16
30
|
end
|
17
31
|
|
@@ -103,6 +117,7 @@ module Dev
|
|
103
117
|
application = @name
|
104
118
|
php = @php
|
105
119
|
exclude = @exclude
|
120
|
+
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
106
121
|
return if exclude.include?(:test)
|
107
122
|
|
108
123
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -114,12 +129,13 @@ module Dev
|
|
114
129
|
|
115
130
|
namespace :php do
|
116
131
|
desc "Run all php tests against the #{application}'s codebase"
|
117
|
-
task test: %
|
132
|
+
task test: %W(init_docker #{up_cmd}) do
|
118
133
|
LOG.debug("Running all php tests in the #{application} codebase")
|
119
134
|
|
120
135
|
options = []
|
121
136
|
options << '-T' if Dev::Common.new.running_codebuild?
|
122
137
|
Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
|
138
|
+
php.coverage.check
|
123
139
|
end
|
124
140
|
end
|
125
141
|
end
|
@@ -7,11 +7,23 @@ module Dev
|
|
7
7
|
module Ruby
|
8
8
|
# Class for default rake tasks associated with a ruby project
|
9
9
|
class Application < Dev::Template::ApplicationInterface
|
10
|
-
attr_reader :ruby
|
11
|
-
|
12
|
-
#
|
13
|
-
|
10
|
+
attr_reader :ruby, :start_container_dependencies_on_test
|
11
|
+
|
12
|
+
# Create the templated rake tasks for the ruby application
|
13
|
+
#
|
14
|
+
# @param application [String] The name of the application
|
15
|
+
# @param container_path [String] The path to the application inside of the container
|
16
|
+
# @param local_path [String] The path to the application on your local system
|
17
|
+
# @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
|
18
|
+
def initialize(
|
19
|
+
application,
|
20
|
+
container_path: nil,
|
21
|
+
local_path: nil,
|
22
|
+
start_container_dependencies_on_test: true,
|
23
|
+
exclude: []
|
24
|
+
)
|
14
25
|
@ruby = Dev::Ruby.new(container_path:, local_path:)
|
26
|
+
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
15
27
|
super(application, exclude:)
|
16
28
|
end
|
17
29
|
|
@@ -59,6 +71,7 @@ module Dev
|
|
59
71
|
application = @name
|
60
72
|
ruby = @ruby
|
61
73
|
exclude = @exclude
|
74
|
+
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
62
75
|
return if exclude.include?(:test)
|
63
76
|
|
64
77
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -70,7 +83,7 @@ module Dev
|
|
70
83
|
|
71
84
|
namespace :ruby do
|
72
85
|
desc "Run all ruby tests against the #{application}'s codebase"
|
73
|
-
task test: %
|
86
|
+
task test: %W(init_docker #{up_cmd}) do
|
74
87
|
LOG.debug("Running all ruby tests in the #{application} codebase")
|
75
88
|
|
76
89
|
options = []
|
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
|