dip 7.5.0 → 7.7.0

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: be7ef96533ac533734f04b61b49864b8db104269813c5dd00d8192d968c0c1dd
4
- data.tar.gz: 74d31efceda6300bd5f93023f5a108c3a9972d2b4416d0e4433e98f7ec76f61e
3
+ metadata.gz: f054f4d57aa8fcd971e84dfd09f64e45e468f902bec2390cea1ca22429ec5b5b
4
+ data.tar.gz: c5d1f343917d8eb814cd12bf650f5c25fc82e642b97d24d39244ff79bd0a84c1
5
5
  SHA512:
6
- metadata.gz: aafe6a31332d687c065c29e34d3c8fdc69bdc6c0507aa4a4c1d3fc1c68d5ded516c4f52e2b7092b34cf585a3ceb9f69ad4a6b764a41863ea090323d5b0a5b2c2
7
- data.tar.gz: 6d801682b927567b84f07a0f7df75535d35ac1f11a953f286cc9785a8d415d55d5940b72a68365d2cafaa13e02b9aafa01f6f58282a41e2c37546274553fbf74
6
+ metadata.gz: f95680b8f9393ceb447641751176a44343118621a5d37670cd41e5e82ff9093e3bdabb541809ef0df18580390b78c848feee7dafb97b05c445aa9798c4c48e2c
7
+ data.tar.gz: ca40545fa4f180fd4c3740348e413ca760580aca68dc18f9f4839e3bc51155f3094a962294eba27b5fc10aa22df1ff178223c9bdaf9489cb7f6d53edef05e41c
data/README.md CHANGED
@@ -132,6 +132,12 @@ interaction:
132
132
  compose:
133
133
  run_options: [service-ports, use-aliases]
134
134
 
135
+ stack:
136
+ description: Run full stack (server, workers, etc.)
137
+ runner: docker_compose
138
+ compose:
139
+ profiles: [web, workers]
140
+
135
141
  sidekiq:
136
142
  description: Run sidekiq in background
137
143
  service: worker
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "thor"
4
- require_relative "./base"
4
+ require_relative "base"
5
5
  require_relative "../commands/console"
6
6
 
7
7
  module Dip
data/lib/dip/cli/dns.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "thor"
4
- require_relative "./base"
4
+ require_relative "base"
5
5
  require_relative "../commands/dns"
6
6
 
7
7
  module Dip
data/lib/dip/cli/nginx.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "thor"
4
- require_relative "./base"
4
+ require_relative "base"
5
5
  require_relative "../commands/nginx"
6
6
 
7
7
  module Dip
data/lib/dip/cli/ssh.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "thor"
4
- require_relative "./base"
4
+ require_relative "base"
5
5
  require_relative "../commands/ssh"
6
6
 
7
7
  module Dip
data/lib/dip/cli.rb CHANGED
@@ -78,7 +78,7 @@ module Dip
78
78
  require_relative "commands/down_all"
79
79
  Dip::Commands::DownAll.new.execute
80
80
  else
81
- compose("down", *argv)
81
+ compose("down", *argv.push("--remove-orphans"))
82
82
  end
83
83
  end
84
84
 
data/lib/dip/command.rb CHANGED
@@ -11,7 +11,7 @@ module Dip
11
11
  class ProgramRunner
12
12
  def self.call(cmdline, env: {}, **options)
13
13
  if cmdline.is_a?(Array)
14
- ::Kernel.exec(env, cmdline[0], *cmdline[1..-1], **options)
14
+ ::Kernel.exec(env, cmdline[0], *cmdline[1..], **options)
15
15
  else
16
16
  ::Kernel.exec(env, cmdline, **options)
17
17
  end
@@ -13,7 +13,7 @@ module Dip
13
13
  attr_reader :argv, :config, :shell
14
14
 
15
15
  def initialize(*argv, shell: true)
16
- @argv = argv
16
+ @argv = argv.compact
17
17
  @shell = shell
18
18
  @config = ::Dip.config.compose || {}
19
19
  end
@@ -9,6 +9,7 @@ module Dip
9
9
  class DockerComposeRunner < Base
10
10
  def execute
11
11
  Commands::Compose.new(
12
+ *compose_profiles,
12
13
  command[:compose][:method],
13
14
  *compose_arguments,
14
15
  shell: command[:shell]
@@ -17,6 +18,16 @@ module Dip
17
18
 
18
19
  private
19
20
 
21
+ def compose_profiles
22
+ return [] if command[:compose][:profiles].empty?
23
+
24
+ update_command_for_profiles
25
+
26
+ command[:compose][:profiles].each_with_object([]) do |profile, argv|
27
+ argv.concat(["--profile", profile])
28
+ end
29
+ end
30
+
20
31
  def compose_arguments
21
32
  compose_argv = command[:compose][:run_options].dup
22
33
 
@@ -57,6 +68,16 @@ module Dip
57
68
  []
58
69
  end
59
70
  end
71
+
72
+ def update_command_for_profiles
73
+ # NOTE: When using profiles, the method is always `up`.
74
+ # This is because `docker-compose` does not support profiles
75
+ # for other commands. Also, run options need to be removed
76
+ # because they are not supported by `up`.
77
+ command[:compose][:method] = "up"
78
+ command[:command] = ""
79
+ command[:compose][:run_options] = []
80
+ end
60
81
  end
61
82
  end
62
83
  end
data/lib/dip/config.rb CHANGED
@@ -17,7 +17,7 @@ module Dip
17
17
  environment: {},
18
18
  compose: {},
19
19
  kubectl: {},
20
- interation: {},
20
+ interaction: {},
21
21
  provision: []
22
22
  }.freeze
23
23
 
@@ -45,11 +45,11 @@ module Dip
45
45
  cmd = build_command(entry)
46
46
 
47
47
  tree[name] = cmd
48
+ base_cmd = entry.select { |k, _| k != :subcommands }
48
49
 
49
50
  entry[:subcommands]&.each do |sub_name, sub_entry|
50
51
  sub_command_defaults!(sub_entry)
51
-
52
- expand("#{name} #{sub_name}", entry.deep_merge(sub_entry), tree: tree)
52
+ expand("#{name} #{sub_name}", base_cmd.deep_merge(sub_entry), tree: tree)
53
53
  end
54
54
 
55
55
  tree
@@ -68,6 +68,7 @@ module Dip
68
68
  environment: entry[:environment] || {},
69
69
  compose: {
70
70
  method: entry.dig(:compose, :method) || entry[:compose_method] || "run",
71
+ profiles: Array(entry.dig(:compose, :profiles)),
71
72
  run_options: compose_run_options(entry.dig(:compose, :run_options) || entry[:compose_run_options])
72
73
  }
73
74
  }
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.5.0"
4
+ VERSION = "7.7.0"
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.5.0
4
+ version: 7.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bibendi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-04 00:00:00.000000000 Z
11
+ date: 2023-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -210,7 +210,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
210
210
  requirements:
211
211
  - - ">="
212
212
  - !ruby/object:Gem::Version
213
- version: '2.5'
213
+ version: '2.7'
214
214
  required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  requirements:
216
216
  - - ">="