brut 0.21.0.pre.1 → 0.21.0.pre.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: '049e10b89cc1f9493bdac64fcdf569064de7458a36757a57681c5de5beec2fbe'
|
|
4
|
+
data.tar.gz: 66dfee5973159e43bee8f1fe9a43efba162a3835df4a4fa7772fabcffca1dfef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1bb2e290674f713ef35fe6d91abf566e2076146d60307f4f5a75b2bb84d5927455d2b050c35608568f90c5aaa579eeeca7ca1241c2d370810f5c669b724b735
|
|
7
|
+
data.tar.gz: b3fbfbf1ffb662a3813a5aa30743e385efaaae6e95d2d265dbdb989b7cf8ad3ef8e48e4bab07139d68f2b0d5d633477ae32347d82103323260b420e567d48a3e
|
data/lib/brut/cli/apps/deploy.rb
CHANGED
|
@@ -47,10 +47,7 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
47
47
|
end
|
|
48
48
|
version = ""
|
|
49
49
|
git_guess = %{git rev-parse HEAD}
|
|
50
|
-
|
|
51
|
-
version << output
|
|
52
|
-
end
|
|
53
|
-
version = version.strip.chomp
|
|
50
|
+
version = capture!(git_guess).strip.chomp
|
|
54
51
|
if version == ""
|
|
55
52
|
fatal "Attempt to use git via command '#{git_guess}' to figure out the version failed"
|
|
56
53
|
return 1
|
|
@@ -66,12 +63,12 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
66
63
|
dockerfile = Brut.container.project_root / "deploy" / "Dockerfile"
|
|
67
64
|
FileUtils.chdir Brut.container.project_root do
|
|
68
65
|
command = %{docker build --build-arg app_git_sha1=#{version} --file #{dockerfile} --platform #{config.platform} --tag #{image_name} . 2>&1}
|
|
69
|
-
system!(command)
|
|
66
|
+
system!(command, output: :stream)
|
|
70
67
|
end
|
|
71
68
|
if options.build_only?
|
|
72
69
|
puts "Not pushing image"
|
|
73
70
|
else
|
|
74
|
-
system!("docker image push #{image_name}")
|
|
71
|
+
system!("docker image push #{image_name}", output: :stream)
|
|
75
72
|
end
|
|
76
73
|
|
|
77
74
|
0
|
|
@@ -139,10 +136,7 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
139
136
|
config = AppDeployConfig.new
|
|
140
137
|
version = ""
|
|
141
138
|
git_guess = %{git rev-parse HEAD}
|
|
142
|
-
|
|
143
|
-
version << output
|
|
144
|
-
end
|
|
145
|
-
version = version.strip.chomp
|
|
139
|
+
version = capture!(git_guess).strip.chomp
|
|
146
140
|
if version == ""
|
|
147
141
|
fatal "Attempt to use git via command '#{git_guess}' to figure out the version failed"
|
|
148
142
|
return 1
|
|
@@ -161,14 +155,14 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
161
155
|
"--push"
|
|
162
156
|
end
|
|
163
157
|
command = %{docker buildx build --provenance=false --build-arg app_git_sha1=#{version} --file #{process_dockerfile_path} --platform #{config.platform} #{push_or_load} --tag #{image_name} . 2>&1}
|
|
164
|
-
system!(command)
|
|
158
|
+
system!(command, output: :stream)
|
|
165
159
|
names << process_description.name
|
|
166
160
|
end
|
|
167
161
|
deploy_command = "heroku container:release #{names.sort.join(' ')} -a #{Brut.container.app_id}"
|
|
168
162
|
if options.build_only?
|
|
169
163
|
puts "Not deploying"
|
|
170
164
|
else
|
|
171
|
-
system!(deploy_command)
|
|
165
|
+
system!(deploy_command, output: :stream)
|
|
172
166
|
end
|
|
173
167
|
|
|
174
168
|
0
|
|
@@ -178,9 +172,12 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
178
172
|
end
|
|
179
173
|
end
|
|
180
174
|
end
|
|
181
|
-
|
|
175
|
+
class DockerCompose < Brut::CLI::Commands::BaseCommand
|
|
176
|
+
def default_rack_env = "development"
|
|
177
|
+
def description = "Manage a docker-compose.yml file to be consistent with your deploy config"
|
|
182
178
|
class Check < Brut::CLI::Commands::BaseCommand
|
|
183
179
|
def description = "Check if the existing docker-compose.yml is consistent with the deploy config"
|
|
180
|
+
def default_rack_env = "development"
|
|
184
181
|
def run
|
|
185
182
|
docker_compose_path = Brut.container.project_root / "deploy" / "docker-compose.yml"
|
|
186
183
|
if !docker_compose_path.exist?
|
|
@@ -265,6 +262,7 @@ class Brut::CLI::Apps::Deploy < Brut::CLI::Commands::BaseCommand
|
|
|
265
262
|
end
|
|
266
263
|
class Generate < Brut::CLI::Commands::BaseCommand
|
|
267
264
|
def description = "Generate or update the existing docker-compose.yml based on current deploy config"
|
|
265
|
+
def default_rack_env = "development"
|
|
268
266
|
def run
|
|
269
267
|
docker_compose_path = Brut.container.project_root / "deploy" / "docker-compose.yml"
|
|
270
268
|
deploy_config_path = Brut.container.project_root / "deploy" / "deploy_config.rb"
|
|
@@ -8,8 +8,7 @@ class Brut::CLI::Apps::New::Segments::DockerDeploy < Brut::CLI::Apps::New::Base
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def add!
|
|
11
|
-
operations = copy_files(@templates_dir, @project_root)
|
|
12
|
-
other_operations
|
|
11
|
+
operations = copy_files(@templates_dir, @project_root)
|
|
13
12
|
|
|
14
13
|
operations.each do |operation|
|
|
15
14
|
operation.call
|
|
@@ -136,19 +136,35 @@ private
|
|
|
136
136
|
# @!visibility public
|
|
137
137
|
def argv = self.execution_context.argv
|
|
138
138
|
|
|
139
|
-
#
|
|
140
|
-
|
|
141
|
-
def system!(*args,&block)
|
|
139
|
+
# Wraps `system!`, but captures the output and returns it
|
|
140
|
+
def capture!(*args)
|
|
142
141
|
output = ""
|
|
143
|
-
|
|
142
|
+
capture = ->(output_chunk) {
|
|
144
143
|
output << output_chunk
|
|
145
144
|
}
|
|
145
|
+
system!( *args, output: capture)
|
|
146
|
+
output
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Convienience methods to defer to `Brut::CLI::Commands::ExecutionContext`'s `Brut::CLI::Executor#system!`.
|
|
150
|
+
# @!visibility public
|
|
151
|
+
def system!(*args,output: :log)
|
|
152
|
+
command_output = ""
|
|
153
|
+
block = if output == :log
|
|
154
|
+
block ||= ->(output_chunk) {
|
|
155
|
+
command_output << output_chunk
|
|
156
|
+
}
|
|
157
|
+
elsif output.kind_of?(Proc)
|
|
158
|
+
block = output
|
|
159
|
+
else
|
|
160
|
+
nil
|
|
161
|
+
end
|
|
146
162
|
begin
|
|
147
163
|
self.execution_context.executor.system!(*args,&block)
|
|
148
164
|
ensure
|
|
149
|
-
if
|
|
165
|
+
if command_output.length > 0
|
|
150
166
|
progname = args.detect { it.kind_of?(String) }.split(" ")
|
|
151
|
-
|
|
167
|
+
command_output.lines.each do |line|
|
|
152
168
|
self.execution_context.logger.add(Logger::INFO, line.chomp, progname)
|
|
153
169
|
end
|
|
154
170
|
end
|
|
@@ -24,12 +24,19 @@ module Brut::SpecSupport::CLICommandSupport
|
|
|
24
24
|
args
|
|
25
25
|
end
|
|
26
26
|
@commands_executed << command
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
on_command = @on_commands.select { |it,_|
|
|
28
|
+
it == command || it.match?(command)
|
|
29
|
+
}.map { |_,it| it }.first
|
|
30
|
+
if on_command
|
|
31
|
+
if on_command[:raise_error]
|
|
29
32
|
raise Brut::CLI::SystemExecError.new(command,1)
|
|
30
|
-
elsif
|
|
31
|
-
output =
|
|
32
|
-
|
|
33
|
+
elsif on_command[:output]
|
|
34
|
+
output = on_command[:output]
|
|
35
|
+
if block_given?
|
|
36
|
+
yield(output)
|
|
37
|
+
else
|
|
38
|
+
@out.puts output
|
|
39
|
+
end
|
|
33
40
|
end
|
|
34
41
|
end
|
|
35
42
|
nil
|
data/lib/brut/version.rb
CHANGED