dru 0.3.1 → 0.4.0
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/dru/cli.rb +14 -0
- data/lib/dru/commands/attach.rb +25 -0
- data/lib/dru/container_command.rb +1 -1
- data/lib/dru/templates/attach/.gitkeep +1 -0
- data/lib/dru/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def2420df9cee2ed5c5a4a33c606ad27ba20fd72a84c51a93b10aa8ad8b662c8
|
4
|
+
data.tar.gz: c9be5d2ddb85b0bfb1ab51d41632441a1918a079ba38adfcec42bb5736273e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae0153d0c05c59cfc36f3dd22fdc13961fb05e4fa3c5846dd919325a1c3df3f1e7363c35450d5404d2845839239789f098e1d6501cb5676baf7ebe93212e15a
|
7
|
+
data.tar.gz: abf9ce5c427623e592469666d8ffcf8b3d15c22a44c9518d5745dee9b01c902775ae169cab9934185e5b4e2c1349243db60c2dd0200dd10e828218e8dcd679d4
|
data/Gemfile.lock
CHANGED
data/lib/dru/cli.rb
CHANGED
@@ -18,6 +18,20 @@ module Dru
|
|
18
18
|
end
|
19
19
|
map %w(--version -v) => :version
|
20
20
|
|
21
|
+
desc 'attach', 'Attach local standard input, output, and error streams to a running container'
|
22
|
+
method_option :help, aliases: '-h', type: :boolean,
|
23
|
+
desc: 'Display usage information'
|
24
|
+
method_option :container, aliases: '-c', type: :string, default: 'app',
|
25
|
+
desc: 'Container name'
|
26
|
+
def attach(*)
|
27
|
+
if options[:help]
|
28
|
+
invoke :help, ['attach']
|
29
|
+
else
|
30
|
+
require_relative 'commands/attach'
|
31
|
+
Dru::Commands::Attach.new(options: options).execute
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
21
35
|
desc 'exec', 'Execute a command in a running container.'
|
22
36
|
method_option :help, aliases: '-h', type: :boolean,
|
23
37
|
desc: 'Display usage information'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../container_command'
|
4
|
+
|
5
|
+
module Dru
|
6
|
+
module Commands
|
7
|
+
class Attach < Dru::ContainerCommand
|
8
|
+
DOCKER_ATTACH_COMMAND = 'docker attach --detach-keys="ctrl-d"'.freeze
|
9
|
+
|
10
|
+
def execute(input: $stdin, output: $stdout)
|
11
|
+
stop_docker_compose if attach_to_container
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def stop_docker_compose
|
17
|
+
run_docker_compose_command('down')
|
18
|
+
end
|
19
|
+
|
20
|
+
def attach_to_container
|
21
|
+
system "#{DOCKER_ATTACH_COMMAND} #{container_name_to_id(container)}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
data/lib/dru/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Rimondi
|
@@ -364,12 +364,14 @@ files:
|
|
364
364
|
- lib/dru/cli.rb
|
365
365
|
- lib/dru/command.rb
|
366
366
|
- lib/dru/commands/.gitkeep
|
367
|
+
- lib/dru/commands/attach.rb
|
367
368
|
- lib/dru/commands/exec.rb
|
368
369
|
- lib/dru/commands/runner.rb
|
369
370
|
- lib/dru/commands/up.rb
|
370
371
|
- lib/dru/config.rb
|
371
372
|
- lib/dru/container_command.rb
|
372
373
|
- lib/dru/templates/.gitkeep
|
374
|
+
- lib/dru/templates/attach/.gitkeep
|
373
375
|
- lib/dru/templates/exec/.gitkeep
|
374
376
|
- lib/dru/templates/runner/.gitkeep
|
375
377
|
- lib/dru/templates/up/.gitkeep
|