dip 7.1.4 → 7.3.1

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: cadfc19302e46c5c7894019537957a5ce90cc2bc1cae559c2222579772a7fc83
4
- data.tar.gz: c987a956bc57d96aefc0259fd15f633f19838883ee21d6d95367145e200fcb4a
3
+ metadata.gz: 60d7a15f7de7909f0e61a3e3f9ca8112cf2a94cf21bccfb813be9a209f83e2db
4
+ data.tar.gz: d9dd72eff516119adb097147dd566ae1688fed731153617e81d16ed8eb9c54a1
5
5
  SHA512:
6
- metadata.gz: 2a5589248901774f7edef3c793861f92c6923e896b2fd39ca566b91684bc79ef9d942a4f8ebf1d1d360e624bff5f2d20eb0ea39d833e9e9f1d0d4ac12b32de7e
7
- data.tar.gz: c3c296f2a86720b6fec17f9f824aabfdd611c6dbe0626294e6d6a055fc16f48335c0a04ef699a1190c4a21dc773eaa1b6f16faef152e1b9c55a3826d19346507
6
+ metadata.gz: 5e7d3fb075dea8f3be052cbcc8bde8083fd9c967dbce8ab852aefc5ba21bc885f787794dbaf81b68bf5a5e282d7272b6a4495ab567df305e70845e1b5dd14d00
7
+ data.tar.gz: 07e3051d76cd9a7af8a51422024c6865feb2b2c7cf59f1865a1d162a133d513565c9a4214cfa8441291694ba85a9e8562bb98a95cd392839d5d69a7a90f70982
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 bibendi
3
+ Copyright (c) 2016 Mikhail Merkushin aka bibendi
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,17 +1,15 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/dip.svg)](https://badge.fury.io/rb/dip)
2
- [![Build Status](https://travis-ci.org/bibendi/dip.svg?branch=master)](https://travis-ci.org/bibendi/dip)
2
+ [![Build Status](https://github.com/bibendi/dip/workflows/Ruby/badge.svg?branch=master)](https://github.com/bibendi/dip/actions?query=branch%3Amaster)
3
3
  [![Maintainability](https://api.codeclimate.com/v1/badges/d0dca854f0930502f7b3/maintainability)](https://codeclimate.com/github/bibendi/dip/maintainability)
4
4
 
5
5
  # DIP
6
6
 
7
- Docker Interaction Process
7
+ Docker Interaction Program.
8
8
 
9
- A command-line utility that gives the "native" interaction with applications configured with Docker Compose. It is for local development only. In practice, it creates the feeling that you work without containers.
9
+ Development-environment CLI program providing the native-like interaction with a Dockerized application. It creates the feeling that you are working without mind-blowing commands to run the containers.
10
10
 
11
- <p float="left">
12
- <a href="https://evilmartians.com/?utm_source=dip"><img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" height="80" /></a>
13
- <img src="https://ya-webdesign.com/images250_/vertical-divider-png-1.png" width="50" height="100" />
14
- <a href="https://www.jetbrains.com/?from=DIP"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/1a/JetBrains_Logo_2016.svg/1200px-JetBrains_Logo_2016.svg.png" alt="Sponsored by JetBrains" height="100" /></a></p>
11
+ <a href="https://evilmartians.com/?utm_source=dip">
12
+ <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" height="80" /></a>
15
13
 
16
14
  ## Presentations and examples
17
15
 
@@ -47,7 +45,7 @@ When we change the current directory, all shell aliases will be automatically re
47
45
 
48
46
  Also, in shell mode Dip is trying to determine manually passed environment variables. For example:
49
47
 
50
- ```shhttps://ya-webdesign.com/images250_/vertical-divider-png-1.pnghttps://ya-webdesign.com/images250_/vertical-divider-png-1.png
48
+ ```sh
51
49
  VERSION=20180515103400 rails db:migrate:down
52
50
  ```
53
51
 
@@ -201,6 +199,8 @@ returned is `/app/sub-project-dir`.
201
199
 
202
200
  Run commands defined within the `interaction` section of dip.yml
203
201
 
202
+ By default, a command will be executed using [`docker compose`](https://docs.docker.com/compose/install/) command. If you are still using `docker-compose` binary (i.e., prior to Compose V2 changes), a command would be run through it. You can disable using of Compose V2 by passing an environment variable `DIP_COMPOSE_V2=false dip run`.
203
+
204
204
  ```sh
205
205
  dip run rails c
206
206
  dip run rake db:migrate
@@ -224,6 +224,16 @@ Use options `-p, --publish=[]` if you need to additionally publish a container's
224
224
  dip run -p 3000:3000 bundle exec rackup config.ru
225
225
  ```
226
226
 
227
+ You can also override docker compose command by passing `DIP_COMPOSE_COMMAND` if you wish. For example if you want to use [`mutagen-compose`](https://mutagen.io/documentation/orchestration/compose) run `DIP_COMPOSE_COMMAND=mutagen-compose dip run`.
228
+
229
+ If you want to persist that change you can specify command in `compose` section of dip.yml :
230
+
231
+ ```yml
232
+ compose:
233
+ command: mutagen-compose
234
+
235
+ ```
236
+
227
237
  ### dip ls
228
238
 
229
239
  List all available run commands.
@@ -293,7 +303,7 @@ services:
293
303
 
294
304
  ### dip nginx
295
305
 
296
- Runs Nginx server container based on [bibendi/nginx-proxy](https://github.com/bibendi/nginx-proxy) image. An application's docker-compose.yml should contain environment variable `VIRTUAL_HOST` and `VIRTUAL_PATH` and connects to external network `frontend`.
306
+ Runs Nginx server container based on [nginxproxy/nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) image. An application's docker-compose.yml should contain environment variable `VIRTUAL_HOST` and `VIRTUAL_PATH` and connects to external network `frontend`.
297
307
 
298
308
  foo-project/docker-compose.yml
299
309
 
@@ -9,7 +9,7 @@ module Dip
9
9
  class Console < Base
10
10
  desc "start", "Integrate Dip into current shell"
11
11
  method_option :help, aliases: "-h", type: :boolean,
12
- desc: "Display usage information"
12
+ desc: "Display usage information"
13
13
  def start
14
14
  if options[:help]
15
15
  invoke :help, ["start"]
@@ -22,7 +22,7 @@ module Dip
22
22
 
23
23
  desc "inject", "Inject aliases"
24
24
  method_option :help, aliases: "-h", type: :boolean,
25
- desc: "Display usage information"
25
+ desc: "Display usage information"
26
26
  def inject
27
27
  if options[:help]
28
28
  invoke :help, ["inject"]
data/lib/dip/cli/dns.rb CHANGED
@@ -10,19 +10,19 @@ module Dip
10
10
  class DNS < Base
11
11
  desc "up", "Run dnsdock container"
12
12
  method_option :help, aliases: "-h", type: :boolean,
13
- desc: "Display usage information"
13
+ desc: "Display usage information"
14
14
  method_option :name, aliases: "-n", type: :string, default: "dnsdock",
15
- desc: "Container name"
15
+ desc: "Container name"
16
16
  method_option :socket, aliases: "-s", type: :string, default: "/var/run/docker.sock",
17
- desc: "Path to docker socket"
17
+ desc: "Path to docker socket"
18
18
  method_option :net, aliases: "-t", type: :string, default: "frontend",
19
- desc: "Container network name"
19
+ desc: "Container network name"
20
20
  method_option :publish, aliases: "-p", type: :string, default: "53/udp",
21
- desc: "Container port"
21
+ desc: "Container port"
22
22
  method_option :image, aliases: "-i", type: :string, default: "aacebedo/dnsdock:latest-amd64",
23
- desc: "Docker image name"
23
+ desc: "Docker image name"
24
24
  method_option :domain, aliases: "-d", type: :string, default: "docker",
25
- desc: "Top level domain"
25
+ desc: "Top level domain"
26
26
  def up
27
27
  if options[:help]
28
28
  invoke :help, ["up"]
@@ -40,9 +40,9 @@ module Dip
40
40
 
41
41
  desc "down", "Stop dnsdock container"
42
42
  method_option :help, aliases: "-h", type: :boolean,
43
- desc: "Display usage information"
43
+ desc: "Display usage information"
44
44
  method_option :name, aliases: "-n", type: :string, default: "dnsdock",
45
- desc: "Container name"
45
+ desc: "Container name"
46
46
  def down
47
47
  if options[:help]
48
48
  invoke :help, ["down"]
@@ -55,7 +55,7 @@ module Dip
55
55
 
56
56
  desc "restart", "Stop and start dnsdock container"
57
57
  method_option :help, aliases: "-h", type: :boolean,
58
- desc: "Display usage information"
58
+ desc: "Display usage information"
59
59
  def restart(*args)
60
60
  if options[:help]
61
61
  invoke :help, ["restart"]
@@ -68,11 +68,11 @@ module Dip
68
68
 
69
69
  desc "ip", "Get ip address of dnsdock container"
70
70
  method_option :help, aliases: "-h", type: :boolean,
71
- desc: "Display usage information"
71
+ desc: "Display usage information"
72
72
  method_option :name, aliases: "-n", type: :string, default: "dnsdock",
73
- desc: "Container name"
73
+ desc: "Container name"
74
74
  method_option :net, aliases: "-t", type: :string, default: "frontend",
75
- desc: "Container network name"
75
+ desc: "Container network name"
76
76
  def ip
77
77
  if options[:help]
78
78
  invoke :help, ["status"]
data/lib/dip/cli/nginx.rb CHANGED
@@ -6,23 +6,23 @@ require_relative "../commands/nginx"
6
6
 
7
7
  module Dip
8
8
  class CLI
9
- # See more https://github.com/bibendi/nginx-proxy
9
+ # See more https://github.com/nginx-proxy/nginx-proxy
10
10
  class Nginx < Base
11
11
  desc "up", "Run nginx container"
12
12
  method_option :help, aliases: "-h", type: :boolean,
13
- desc: "Display usage information"
13
+ desc: "Display usage information"
14
14
  method_option :name, aliases: "-n", type: :string, default: "nginx",
15
- desc: "Container name"
15
+ desc: "Container name"
16
16
  method_option :socket, aliases: "-s", type: :string, default: "/var/run/docker.sock",
17
- desc: "Path to docker socket"
17
+ desc: "Path to docker socket"
18
18
  method_option :net, aliases: "-t", type: :string, default: "frontend",
19
- desc: "Container network name"
19
+ desc: "Container network name"
20
20
  method_option :publish, aliases: "-p", type: :array, default: ["80:80"],
21
- desc: "Container port(s). For more than one port, separate them by a space"
22
- method_option :image, aliases: "-i", type: :string, default: "bibendi/nginx-proxy:latest",
23
- desc: "Docker image name"
21
+ desc: "Container port(s). For more than one port, separate them by a space"
22
+ method_option :image, aliases: "-i", type: :string, default: "nginxproxy/nginx-proxy:latest",
23
+ desc: "Docker image name"
24
24
  method_option :domain, aliases: "-d", type: :string, default: "docker",
25
- desc: "Top level domain"
25
+ desc: "Top level domain"
26
26
  method_option :certs, aliases: "-c", type: :string, desc: "Path to ssl certificates"
27
27
  def up
28
28
  if options[:help]
@@ -42,9 +42,9 @@ module Dip
42
42
 
43
43
  desc "down", "Stop nginx container"
44
44
  method_option :help, aliases: "-h", type: :boolean,
45
- desc: "Display usage information"
45
+ desc: "Display usage information"
46
46
  method_option :name, aliases: "-n", type: :string, default: "nginx",
47
- desc: "Container name"
47
+ desc: "Container name"
48
48
  def down
49
49
  if options[:help]
50
50
  invoke :help, ["down"]
@@ -57,7 +57,7 @@ module Dip
57
57
 
58
58
  desc "restart", "Stop and start nginx container"
59
59
  method_option :help, aliases: "-h", type: :boolean,
60
- desc: "Display usage information"
60
+ desc: "Display usage information"
61
61
  def restart(*args)
62
62
  if options[:help]
63
63
  invoke :help, ["restart"]
data/lib/dip/cli/ssh.rb CHANGED
@@ -9,18 +9,18 @@ module Dip
9
9
  class SSH < Base
10
10
  desc "up", "Run ssh-agent container"
11
11
  method_option :help, aliases: "-h", type: :boolean,
12
- desc: "Display usage information"
12
+ desc: "Display usage information"
13
13
  method_option :key, aliases: "-k", type: :string, default: "$HOME/.ssh/id_rsa",
14
- desc: "Path to ssh key"
14
+ desc: "Path to ssh key"
15
15
  method_option :volume, aliases: "-v", type: :string, default: "$HOME",
16
- desc: "Mounted docker volume"
16
+ desc: "Mounted docker volume"
17
17
  method_option :interactive, aliases: "-t", type: :boolean, default: true,
18
- desc: "Run in interactive mode"
18
+ desc: "Run in interactive mode"
19
19
  method_option :user, aliases: "-u", type: :string,
20
- desc: "UID for ssh-agent container"
20
+ desc: "UID for ssh-agent container"
21
21
  # Backward compatibility
22
22
  method_option :nonteractive, aliases: "-T", type: :boolean,
23
- desc: "Run in noninteractive mode"
23
+ desc: "Run in noninteractive mode"
24
24
  def up
25
25
  if options[:help]
26
26
  invoke :help, ["up"]
@@ -38,7 +38,7 @@ module Dip
38
38
 
39
39
  desc "down", "Stop ssh-agent container"
40
40
  method_option :help, aliases: "-h", type: :boolean,
41
- desc: "Display usage information"
41
+ desc: "Display usage information"
42
42
  def down
43
43
  if options[:help]
44
44
  invoke :help, ["down"]
@@ -49,7 +49,7 @@ module Dip
49
49
 
50
50
  desc "restart", "Stop and start ssh-agent container"
51
51
  method_option :help, aliases: "-h", type: :boolean,
52
- desc: "Display usage information"
52
+ desc: "Display usage information"
53
53
  def restart(*args)
54
54
  if options[:help]
55
55
  invoke :help, ["restart"]
@@ -62,7 +62,7 @@ module Dip
62
62
 
63
63
  desc "status", "Show status of ssh-agent container"
64
64
  method_option :help, aliases: "-h", type: :boolean,
65
- desc: "Display usage information"
65
+ desc: "Display usage information"
66
66
  def status
67
67
  if options[:help]
68
68
  invoke :help, ["status"]
data/lib/dip/cli.rb CHANGED
@@ -75,7 +75,7 @@ module Dip
75
75
 
76
76
  desc "run [OPTIONS] CMD [ARGS]", "Run configured command in a docker-compose service. `run` prefix may be omitted"
77
77
  method_option :publish, aliases: "-p", type: :string, repeatable: true,
78
- desc: "Publish a container's port(s) to the host"
78
+ desc: "Publish a container's port(s) to the host"
79
79
  method_option :help, aliases: "-h", type: :boolean, desc: "Display usage information"
80
80
  def run(*argv)
81
81
  if argv.empty? || options[:help]
@@ -88,7 +88,7 @@ module Dip
88
88
 
89
89
  desc "provision", "Execute commands within provision section"
90
90
  method_option :help, aliases: "-h", type: :boolean,
91
- desc: "Display usage information"
91
+ desc: "Display usage information"
92
92
  def provision
93
93
  if options[:help]
94
94
  invoke :help, ["provision"]
data/lib/dip/command.rb CHANGED
@@ -20,8 +20,13 @@ module Dip
20
20
 
21
21
  class SubprocessRunner
22
22
  def self.call(cmdline, env: {}, panic: true, **options)
23
- return if ::Kernel.system(env, cmdline, **options)
24
- raise Dip::Error, "Command '#{cmdline}' executed with error." if panic
23
+ status = ::Kernel.system(env, cmdline, **options)
24
+
25
+ if !status && panic
26
+ raise Dip::Error, "Command '#{cmdline}' executed with error"
27
+ else
28
+ status
29
+ end
25
30
  end
26
31
  end
27
32
 
@@ -23,7 +23,14 @@ module Dip
23
23
 
24
24
  compose_argv = Array(find_files) + Array(cli_options) + argv
25
25
 
26
- exec_program("docker-compose", compose_argv, shell: shell)
26
+ if (override_command = compose_command_override)
27
+ override_command, *override_args = override_command.split(" ")
28
+ exec_program(override_command, override_args.concat(compose_argv), shell: shell)
29
+ elsif compose_v2?
30
+ exec_program("docker", compose_argv.unshift("compose"), shell: shell)
31
+ else
32
+ exec_program("docker-compose", compose_argv, shell: shell)
33
+ end
27
34
  end
28
35
 
29
36
  private
@@ -68,6 +75,18 @@ module Dip
68
75
  ip.empty? ? DOCKER_EMBEDDED_DNS : ip
69
76
  end
70
77
  end
78
+
79
+ def compose_v2?
80
+ if %w[false no 0].include?(Dip.env["DIP_COMPOSE_V2"]) || Dip.test?
81
+ return false
82
+ end
83
+
84
+ !!exec_subprocess("docker", "compose version", panic: false, out: File::NULL, err: File::NULL)
85
+ end
86
+
87
+ def compose_command_override
88
+ Dip.env["DIP_COMPOSE_COMMAND"] || config[:command]
89
+ end
71
90
  end
72
91
  end
73
92
  end
data/lib/dip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dip
4
- VERSION = "7.1.4"
4
+ VERSION = "7.3.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dip
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.4
4
+ version: 7.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bibendi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-16 00:00:00.000000000 Z
11
+ date: 2022-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  - !ruby/object:Gem::Version
212
212
  version: '0'
213
213
  requirements: []
214
- rubygems_version: 3.1.2
214
+ rubygems_version: 3.2.32
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Ruby gem CLI tool for better interacting docker-compose files.