firespring_dev_commands 2.1.27.pre.alpha.2 → 2.5.0.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/audit/report.rb +2 -9
- data/lib/firespring_dev_commands/docker/status.rb +0 -20
- data/lib/firespring_dev_commands/docker.rb +0 -45
- data/lib/firespring_dev_commands/node.rb +1 -1
- data/lib/firespring_dev_commands/php.rb +12 -28
- data/lib/firespring_dev_commands/platform.rb +32 -25
- data/lib/firespring_dev_commands/target_process/query.rb +4 -30
- data/lib/firespring_dev_commands/target_process.rb +1 -3
- data/lib/firespring_dev_commands/templates/docker/application.rb +2 -2
- data/lib/firespring_dev_commands/templates/docker/node/application.rb +5 -19
- data/lib/firespring_dev_commands/templates/docker/php/application.rb +16 -22
- data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +5 -18
- data/lib/firespring_dev_commands/version.rb +1 -1
- data/lib/firespring_dev_commands.rb +1 -1
- metadata +35 -47
- data/lib/firespring_dev_commands/bloom_growth/rock.rb +0 -34
- data/lib/firespring_dev_commands/bloom_growth/seat.rb +0 -16
- data/lib/firespring_dev_commands/bloom_growth/user.rb +0 -43
- data/lib/firespring_dev_commands/bloom_growth.rb +0 -132
- data/lib/firespring_dev_commands/certificate.rb +0 -59
- data/lib/firespring_dev_commands/coverage/base.rb +0 -16
- data/lib/firespring_dev_commands/coverage/cobertura.rb +0 -86
- data/lib/firespring_dev_commands/coverage/none.rb +0 -21
- data/lib/firespring_dev_commands/docker/desktop.rb +0 -59
- data/lib/firespring_dev_commands/os.rb +0 -35
- data/lib/firespring_dev_commands/port.rb +0 -24
- data/lib/firespring_dev_commands/templates/certificate.rb +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e146e8c9d9c3422dfd7641c6a09ca8c2cdfad6ed430d73aec5808de28ed5d880
|
4
|
+
data.tar.gz: 273923aae5ccce231fc77174ed89cbe0e4f5ad59b52219b04303f983e9966e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67223e6ba12a10f798d7fee6b1cab844da41cd3dc65a449330e8c8bd0ef86180cc297889b7365b7b68f5ca8054919e9881693707ecfde02e539d0a7e22c6af51
|
7
|
+
data.tar.gz: ada0e13a3f2d8022687a2542503bad6bc847bf32fc17604116d17e06ed46ee7efa18aea35635c31a26c07f5ccdd6a3c5083235edaafd77684528bc487c17f3c7
|
@@ -3,12 +3,11 @@ module Dev
|
|
3
3
|
class Audit
|
4
4
|
# The class containing standardized information about an audit report
|
5
5
|
class Report
|
6
|
-
attr_accessor :items, :min_severity, :
|
6
|
+
attr_accessor :items, :min_severity, :ignorelist, :filtered_items
|
7
7
|
|
8
8
|
def initialize(
|
9
9
|
items,
|
10
10
|
min_severity: ENV.fetch('MIN_SEVERITY', nil),
|
11
|
-
error_on_unknown: ENV.fetch('ERROR_ON_UNKNOWN', nil),
|
12
11
|
ignorelist: ENV['IGNORELIST'].to_s.split(/\s*,\s*/)
|
13
12
|
)
|
14
13
|
# Items should be an array of Item objects
|
@@ -16,18 +15,12 @@ module Dev
|
|
16
15
|
raise 'items must all be report items' unless @items.all?(Dev::Audit::Report::Item)
|
17
16
|
|
18
17
|
@min_severity = min_severity || Level::HIGH
|
19
|
-
@error_on_unknown = error_on_unknown
|
20
18
|
@ignorelist = Array(ignorelist).compact
|
21
19
|
end
|
22
20
|
|
23
21
|
# Get all severities greater than or equal to the minimum severity
|
24
22
|
def desired_severities
|
25
|
-
|
26
|
-
-1
|
27
|
-
else
|
28
|
-
-2
|
29
|
-
end
|
30
|
-
LEVELS.slice(LEVELS.find_index(min_severity)..max_severity)
|
23
|
+
LEVELS.slice(LEVELS.find_index(min_severity)..-1)
|
31
24
|
end
|
32
25
|
|
33
26
|
# Run the filters against the report items and filter out any which should be excluded
|
@@ -33,26 +33,6 @@ module Dev
|
|
33
33
|
EXITED,
|
34
34
|
DEAD
|
35
35
|
].freeze
|
36
|
-
|
37
|
-
# TODO: Can we use 'curses' here and overwrite the correct line?
|
38
|
-
def response_callback(response)
|
39
|
-
response.split("\n").each do |line|
|
40
|
-
data = JSON.parse(line)
|
41
|
-
if data.include?('status')
|
42
|
-
if data['id']
|
43
|
-
LOG.info "#{data['id']}: #{data['status']}"
|
44
|
-
else
|
45
|
-
LOG.info (data['status']).to_s
|
46
|
-
end
|
47
|
-
elsif data.include?('errorDetail')
|
48
|
-
raise data['errorDetail']['message']
|
49
|
-
elsif data.include?('aux')
|
50
|
-
next
|
51
|
-
else
|
52
|
-
raise "Unrecognized message from docker: #{data}"
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
36
|
end
|
57
37
|
end
|
58
38
|
end
|
@@ -117,44 +117,6 @@ module Dev
|
|
117
117
|
format('%.1f %s', size.to_f / (1024**exp), units[exp])
|
118
118
|
end
|
119
119
|
|
120
|
-
# Push the local version of the docker image to the defined remote repository
|
121
|
-
def push_image(image, name, tag = nil)
|
122
|
-
unless tag
|
123
|
-
if name.include?(':')
|
124
|
-
name, tag = name.split(':')
|
125
|
-
else
|
126
|
-
tag = 'latest'
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
puts "Pushing to #{name}:#{tag}"
|
131
|
-
image.push(::Docker.creds, repo_tag: "#{name}:#{tag}") { |response| Dev::Docker::Status.new.response_callback(response) }
|
132
|
-
end
|
133
|
-
|
134
|
-
# Push the remote version of the docker image from the defined remote repository
|
135
|
-
def pull_image(name, tag = nil)
|
136
|
-
unless tag
|
137
|
-
if name.include?(':')
|
138
|
-
name, tag = name.split(':')
|
139
|
-
else
|
140
|
-
tag = 'latest'
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
puts "\nPulling #{name}:#{tag}"
|
145
|
-
opts = {
|
146
|
-
fromImage: "#{name}:#{tag}",
|
147
|
-
platform: Dev::Platform.new.architecture
|
148
|
-
}
|
149
|
-
::Docker::Image.create(**opts) { |response| Dev::Docker::Status.new.response_callback(response) }
|
150
|
-
end
|
151
|
-
|
152
|
-
# Remove the local version of the given docker image
|
153
|
-
def untag_image(image, name, tag)
|
154
|
-
puts "Untagging #{name}:#{tag}"
|
155
|
-
image.remove(name: "#{name}:#{tag}")
|
156
|
-
end
|
157
|
-
|
158
120
|
# Remove docker images with the "force" option set to true
|
159
121
|
# This will remove the images even if they are currently in use and cause unintended side effects.
|
160
122
|
def force_remove_images(name_and_tag)
|
@@ -176,14 +138,8 @@ module Dev
|
|
176
138
|
Docker::Compose.new.mapped_public_port(name, private_port)
|
177
139
|
end
|
178
140
|
|
179
|
-
# Gets the default working dir of the container
|
180
|
-
def working_dir(container)
|
181
|
-
container.json['Config']['WorkingDir']
|
182
|
-
end
|
183
|
-
|
184
141
|
# Copies the source path on your local machine to the destination path on the container
|
185
142
|
def copy_to_container(container, source_path, dest_path)
|
186
|
-
dest_path = File.join(working_dir(container), dest_path) unless dest_path.start_with?(File::SEPARATOR)
|
187
143
|
LOG.info "Copying #{source_path} to #{dest_path}... "
|
188
144
|
|
189
145
|
container.archive_in(source_path, dest_path, overwrite: true)
|
@@ -198,7 +154,6 @@ module Dev
|
|
198
154
|
# Copies the source path on the container to the destination path on your local machine
|
199
155
|
# If required is set to true, the command will fail if the source path does not exist on the container
|
200
156
|
def copy_from_container(container, source_path, dest_path, required: true)
|
201
|
-
source_path = File.join(working_dir(container), source_path) unless source_path.start_with?(File::SEPARATOR)
|
202
157
|
LOG.info "Copying #{source_path} to #{dest_path}... "
|
203
158
|
|
204
159
|
tar = StringIO.new
|
@@ -8,12 +8,11 @@ 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) 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 = nil
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -31,14 +30,12 @@ module Dev
|
|
31
30
|
alias_method :configure, :config
|
32
31
|
end
|
33
32
|
|
34
|
-
attr_accessor :container_path, :local_path, :package_file
|
33
|
+
attr_accessor :container_path, :local_path, :package_file
|
35
34
|
|
36
|
-
def initialize(container_path: nil, local_path: nil, package_file: nil
|
35
|
+
def initialize(container_path: nil, local_path: nil, package_file: nil)
|
37
36
|
@container_path = container_path || self.class.config.container_path
|
38
37
|
@local_path = local_path || self.class.config.local_path
|
39
38
|
@package_file = package_file || self.class.config.package_file
|
40
|
-
@coverage = coverage || Dev::Coverage::None.new
|
41
|
-
raise 'coverage must be an instance of the base class' unless @coverage.is_a?(Dev::Coverage::Base)
|
42
39
|
end
|
43
40
|
|
44
41
|
# The base npm command that is the starting point for all subsequent commands
|
@@ -61,12 +58,9 @@ module Dev
|
|
61
58
|
end
|
62
59
|
|
63
60
|
# Build the command to fix any security vulnerabilities that were found
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
# audit_fix.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
68
|
-
# audit_fix
|
69
|
-
# end
|
61
|
+
def audit_fix_command
|
62
|
+
raise 'not implemented'
|
63
|
+
end
|
70
64
|
|
71
65
|
# Build the php install command
|
72
66
|
def install_command
|
@@ -79,7 +73,7 @@ module Dev
|
|
79
73
|
# Build the php lint command
|
80
74
|
def lint_command
|
81
75
|
lint = base_command
|
82
|
-
lint << 'lint'
|
76
|
+
lint << 'run' << 'lint'
|
83
77
|
lint.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
84
78
|
lint
|
85
79
|
end
|
@@ -87,7 +81,7 @@ module Dev
|
|
87
81
|
# Build the php lint fix command
|
88
82
|
def lint_fix_command
|
89
83
|
lint_fix = base_command
|
90
|
-
lint_fix << 'lint-fix'
|
84
|
+
lint_fix << 'run' << 'lint-fix'
|
91
85
|
lint_fix.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
92
86
|
lint_fix
|
93
87
|
end
|
@@ -95,24 +89,14 @@ module Dev
|
|
95
89
|
# Build the php test command
|
96
90
|
def test_command
|
97
91
|
test = []
|
98
|
-
|
99
|
-
test.concat(coverage.php_options) if coverage
|
92
|
+
lint_fix << 'run' << 'test'
|
100
93
|
test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
101
94
|
test
|
102
95
|
end
|
103
96
|
|
104
|
-
#
|
105
|
-
def
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
# Build the php fast test command
|
110
|
-
def test_fast_command(processes = 4)
|
111
|
-
test = []
|
112
|
-
test << './vendor/bin/paratest'
|
113
|
-
test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
|
114
|
-
test << "-p#{processes}" << '--runner=WrapperRunner'
|
115
|
-
test
|
97
|
+
# Build the php test (with coverage) command
|
98
|
+
def test_coverage_command
|
99
|
+
raise 'not implemented'
|
116
100
|
end
|
117
101
|
end
|
118
102
|
end
|
@@ -1,33 +1,40 @@
|
|
1
1
|
module Dev
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
class Common
|
3
|
+
# Class which returns information about the current platform
|
4
|
+
class Platform
|
5
|
+
# Constant containing all supported architectures
|
6
|
+
ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# Normalize the ruby platform to return a docker platform architecture format
|
9
|
+
def determine_compute_architecture
|
10
|
+
case RUBY_PLATFORM
|
11
|
+
when /x86_64|amd64/
|
12
|
+
'linux/amd64' # 64-bit Intel/AMD architecture
|
13
|
+
when /arm|aarch64/
|
14
|
+
'linux/arm64' # ARM architecture
|
15
|
+
else
|
16
|
+
raise 'Unknown or unsupported architecture'
|
17
|
+
end
|
18
|
+
end
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"linux/#{arch}" unless arch.start_with?('linux/')
|
22
|
-
arch
|
23
|
-
end
|
20
|
+
# Determine the platform architecture
|
21
|
+
# If one was specified in the DOCKER_ARCHITECTURE variable, use it
|
22
|
+
# Otherwise, use the RUBY_PLATFORM built-in to auto-detect and architecture
|
23
|
+
def architecture
|
24
|
+
docker_architecture = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
|
25
|
+
if docker_architecture.empty?
|
26
|
+
determine_compute_architecture
|
27
|
+
else
|
28
|
+
raise "Missing 'linux/' prefix in DOCKER_ARCHITECTURE: #{docker_architecture}" unless docker_architecture.start_with?('linux/')
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
architecture_name = docker_architecture.split('/')[1]
|
31
|
+
unless ALLOWED_ARCHITECTURES.include?(architecture_name)
|
32
|
+
raise "Invalid DOCKER_ARCHITECTURE: #{architecture_name}. Allowed architectures are #{ALLOWED_ARCHITECTURES.join(', ')}"
|
33
|
+
end
|
29
34
|
|
30
|
-
|
35
|
+
docker_architecture
|
36
|
+
end
|
37
|
+
end
|
31
38
|
end
|
32
39
|
end
|
33
40
|
end
|
@@ -2,13 +2,12 @@ module Dev
|
|
2
2
|
class TargetProcess
|
3
3
|
# Class for writing target process query statements
|
4
4
|
class Query
|
5
|
-
attr_accessor :where, :incl, :take
|
5
|
+
attr_accessor :where, :incl, :take
|
6
6
|
|
7
7
|
def initialize
|
8
8
|
@where = []
|
9
9
|
@incl = []
|
10
10
|
@take = 250
|
11
|
-
@empty = false
|
12
11
|
end
|
13
12
|
|
14
13
|
# Add a new query clause
|
@@ -34,11 +33,6 @@ module Dev
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
37
|
-
# Check if any of the "in" statements were empty. If so then we don't want to actually run the query
|
38
|
-
def empty?
|
39
|
-
@empty == true
|
40
|
-
end
|
41
|
-
|
42
36
|
# Generate the string representation for this query
|
43
37
|
def generate
|
44
38
|
{}.tap do |clause|
|
@@ -56,38 +50,22 @@ module Dev
|
|
56
50
|
# TODO: Do these need moved to their associated entities?
|
57
51
|
# Add a filter that looks for stories whose id is contained in the list of ids given
|
58
52
|
def filter_by_user_story_ids(user_story_ids)
|
59
|
-
if user_story_ids.nil? || user_story_ids.empty?
|
60
|
-
@empty = true
|
61
|
-
return
|
62
|
-
end
|
63
53
|
self << "(Id in ('#{user_story_ids.join("', '")}'))"
|
64
54
|
end
|
65
55
|
|
66
56
|
# Add a filter that looks for stories whose team id is contained in the list of ids given
|
67
57
|
def filter_by_team_ids(team_ids)
|
68
|
-
|
69
|
-
@empty = true
|
70
|
-
return
|
71
|
-
end
|
72
|
-
self << "(Team.Id in ('#{team_ids.join("', '")}'))"
|
58
|
+
self << "(Team.Id in ('#{team_ids.join("', '")}'))" unless team_ids.nil? || team_ids.empty?
|
73
59
|
end
|
74
60
|
|
75
61
|
# Add a filter that looks for stories whose project id is contained in the list of ids given
|
76
62
|
def filter_by_project(projects)
|
77
|
-
if projects.nil? || projects.empty?
|
78
|
-
@empty = true
|
79
|
-
return
|
80
|
-
end
|
81
63
|
self << "(Project.Name in ('#{projects.join("', '")}'))"
|
82
64
|
end
|
83
65
|
|
84
66
|
# Add a filter that looks for stories whose state is contained in the list of states given
|
85
67
|
def filter_by_states(states)
|
86
|
-
|
87
|
-
@empty = true
|
88
|
-
return
|
89
|
-
end
|
90
|
-
self << "(EntityState.Name in ('#{states.join("', '")}'))"
|
68
|
+
self << "(EntityState.Name in ('#{states.join("', '")}'))" unless states.nil? || states.empty?
|
91
69
|
end
|
92
70
|
|
93
71
|
# Add a filter that looks for stories whose state is set to final
|
@@ -136,11 +114,7 @@ module Dev
|
|
136
114
|
|
137
115
|
# Add a filter that looks for assignable ids which are included in the given array
|
138
116
|
def filter_by_entity_ids(entity_ids)
|
139
|
-
|
140
|
-
@empty = true
|
141
|
-
return
|
142
|
-
end
|
143
|
-
self << "(Assignable.Id in ('#{entity_ids.join("', '")}'))"
|
117
|
+
self << "(Assignable.Id in ('#{entity_ids.join("', '")}'))" unless entity_ids.nil? || entity_ids.empty?
|
144
118
|
end
|
145
119
|
|
146
120
|
# Add a filter that looks for a custom deploy date between the given dates`
|
@@ -15,7 +15,7 @@ module Dev
|
|
15
15
|
# The text of the url variable key
|
16
16
|
TP_URL = 'TP_URL'.freeze
|
17
17
|
|
18
|
-
# Config object for setting top level
|
18
|
+
# Config object for setting top level jira config options
|
19
19
|
Config = Struct.new(:username, :password, :url, :http_debug) do
|
20
20
|
def initialize
|
21
21
|
Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
|
@@ -117,8 +117,6 @@ module Dev
|
|
117
117
|
# Call the given block (if present) with each piece of data
|
118
118
|
# Return all pieces of data
|
119
119
|
def get(path, query, &)
|
120
|
-
return [] if query.empty?
|
121
|
-
|
122
120
|
query_string = query.generate
|
123
121
|
url = "/api/v1/#{path}"
|
124
122
|
url << "?#{URI.encode_www_form(query_string)}" unless query_string.empty?
|
@@ -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 _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) do
|
158
158
|
Rake::Task[:_post_reload_hooks].execute
|
159
159
|
end
|
160
160
|
end
|
@@ -7,24 +7,11 @@ 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
|
-
|
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
|
-
)
|
10
|
+
attr_reader :node
|
11
|
+
|
12
|
+
# Allow for custom container path for the application
|
13
|
+
def initialize(application, container_path: nil, local_path: nil, exclude: [])
|
26
14
|
@node = Dev::Node.new(container_path:, local_path:)
|
27
|
-
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
28
15
|
super(application, exclude:)
|
29
16
|
end
|
30
17
|
|
@@ -72,7 +59,6 @@ module Dev
|
|
72
59
|
application = @name
|
73
60
|
node = @node
|
74
61
|
exclude = @exclude
|
75
|
-
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
76
62
|
return if exclude.include?(:test)
|
77
63
|
|
78
64
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -84,7 +70,7 @@ module Dev
|
|
84
70
|
|
85
71
|
namespace :node do
|
86
72
|
desc "Run all node tests against the #{application}'s codebase"
|
87
|
-
task test: %
|
73
|
+
task test: %w(init_docker up) do
|
88
74
|
LOG.debug("Running all node tests in the #{application} codebase")
|
89
75
|
|
90
76
|
options = []
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative '../../base_interface'
|
2
|
+
require 'securerandom'
|
2
3
|
|
3
4
|
module Dev
|
4
5
|
module Template
|
@@ -7,24 +8,14 @@ module Dev
|
|
7
8
|
module Php
|
8
9
|
# Class for default rake tasks associated with a php project
|
9
10
|
class Application < Dev::Template::ApplicationInterface
|
10
|
-
attr_reader :php, :
|
11
|
-
|
12
|
-
#
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def initialize(
|
19
|
-
application,
|
20
|
-
container_path: nil,
|
21
|
-
local_path: nil,
|
22
|
-
start_container_dependencies_on_test: true,
|
23
|
-
coverage: nil,
|
24
|
-
exclude: []
|
25
|
-
)
|
26
|
-
@php = Dev::Php.new(container_path:, local_path:, coverage:)
|
27
|
-
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
11
|
+
attr_reader :php, :siloed_tests
|
12
|
+
|
13
|
+
# Allow for custom container path for the application
|
14
|
+
def initialize(application, container_path: nil, local_path: nil, siloed_tests: nil, exclude: [])
|
15
|
+
@php = Dev::Php.new(container_path:, local_path:)
|
16
|
+
# TODO: Better name
|
17
|
+
# TODO: Should this apply to all or just tests?
|
18
|
+
@siloed_tests = siloed_tests
|
28
19
|
|
29
20
|
super(application, exclude:)
|
30
21
|
end
|
@@ -116,8 +107,8 @@ module Dev
|
|
116
107
|
def create_test_task!
|
117
108
|
application = @name
|
118
109
|
php = @php
|
110
|
+
siloed_tests = @siloed_tests
|
119
111
|
exclude = @exclude
|
120
|
-
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
121
112
|
return if exclude.include?(:test)
|
122
113
|
|
123
114
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -129,13 +120,16 @@ module Dev
|
|
129
120
|
|
130
121
|
namespace :php do
|
131
122
|
desc "Run all php tests against the #{application}'s codebase"
|
132
|
-
task test: %
|
123
|
+
task test: %w(init_docker up) do
|
133
124
|
LOG.debug("Running all php tests in the #{application} codebase")
|
134
125
|
|
126
|
+
project_name = nil
|
127
|
+
project_name = SecureRandom.hex if siloed_tests
|
128
|
+
|
135
129
|
options = []
|
136
130
|
options << '-T' if Dev::Common.new.running_codebuild?
|
137
|
-
Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
|
138
|
-
|
131
|
+
Dev::Docker::Compose.new(project_name:, services: application, options:).exec(*php.test_command)
|
132
|
+
# TODO: Add clean if we are siloed
|
139
133
|
end
|
140
134
|
end
|
141
135
|
end
|
@@ -7,23 +7,11 @@ 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
|
-
|
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
|
-
)
|
10
|
+
attr_reader :ruby
|
11
|
+
|
12
|
+
# Allow for custom container path for the application
|
13
|
+
def initialize(application, container_path: nil, local_path: nil, exclude: [])
|
25
14
|
@ruby = Dev::Ruby.new(container_path:, local_path:)
|
26
|
-
@start_container_dependencies_on_test = start_container_dependencies_on_test
|
27
15
|
super(application, exclude:)
|
28
16
|
end
|
29
17
|
|
@@ -71,7 +59,6 @@ module Dev
|
|
71
59
|
application = @name
|
72
60
|
ruby = @ruby
|
73
61
|
exclude = @exclude
|
74
|
-
up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
|
75
62
|
return if exclude.include?(:test)
|
76
63
|
|
77
64
|
DEV_COMMANDS_TOP_LEVEL.instance_eval do
|
@@ -83,7 +70,7 @@ module Dev
|
|
83
70
|
|
84
71
|
namespace :ruby do
|
85
72
|
desc "Run all ruby tests against the #{application}'s codebase"
|
86
|
-
task test: %
|
73
|
+
task test: %w(init_docker up_no_deps) do
|
87
74
|
LOG.debug("Running all ruby tests in the #{application} codebase")
|
88
75
|
|
89
76
|
options = []
|