dip 3.7.0 → 3.7.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: 5eaf38b3627e299f0f3d6e6650d21ea564a6f38bb1ce84afc8fff76a1665b0d5
4
- data.tar.gz: af01914d8226fc9c886b266098303fccde34e18e78a1cc3c8225119e1f127c5f
3
+ metadata.gz: 4c8522e4677f4fb303d8c54114d793660653d2a81248caf5301b760b2319a6ea
4
+ data.tar.gz: 2b75045073267fa9130ceb82635b4f8fdc2c971f1b9f7a6a332e21ef9cec04ad
5
5
  SHA512:
6
- metadata.gz: e18bb5db1b8e11fe071f182016e8e117090b662551388969f68199d3314a730995f6697827ede5449aee4f514302d586a4828bb8b71b152f0dfc95df2757aa37
7
- data.tar.gz: 1ef69de40baedbf4ae515fff82386eb8058bd79ce7eb36ee1cca7edac07046bd41ca3801910ce32d3c1c5734ef78b05783ca073264b547b1ffdcd66c0681ea51
6
+ metadata.gz: 8d14570b02016db4917507d17ce76b3afb5dc58892f95697db44242b99204b682b667ad2f78bbce0bd866c0c68548c040dc2b87317e0c39991cd2d6fa09fa6aa
7
+ data.tar.gz: 75fe3bfba74961f5dd8b7e537b9acc27a36536b0b70e79d73a7df31e84e94d058822b9a086b521cddf9e4169fbc5231942f5d88f0098e721c1f69d7101b21156
data/lib/dip/cli.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'thor'
4
+ require 'dip/run_vars'
4
5
 
5
6
  module Dip
6
7
  class CLI < Thor
@@ -39,15 +40,9 @@ module Dip
39
40
  map %w(--version -v) => :version
40
41
 
41
42
  desc 'compose CMD [OPTIONS]', 'Run docker-compose commands'
42
- method_option :help, aliases: '-h', type: :boolean,
43
- desc: 'Display usage information'
44
- def compose(cmd, *argv)
45
- if options[:help]
46
- invoke :help, ['compose']
47
- else
48
- require_relative 'commands/compose'
49
- Dip::Commands::Compose.new(cmd, argv).execute
50
- end
43
+ def compose(*argv)
44
+ require_relative 'commands/compose'
45
+ Dip::Commands::Compose.new(*argv).execute
51
46
  end
52
47
 
53
48
  desc "up [OPTIONS] SERVICE", "Run `docker-compose up` command"
@@ -60,21 +55,15 @@ module Dip
60
55
  compose("stop", *argv)
61
56
  end
62
57
 
63
- desc "down [OPTIONS]", "Run `docker-compose down` command"
58
+ desc "down all services [OPTIONS]", "Run `docker-compose down` command"
64
59
  def down(*argv)
65
60
  compose("down", *argv)
66
61
  end
67
62
 
68
63
  desc 'CMD or dip run CMD [OPTIONS]', 'Run configured command in a docker-compose service'
69
- method_option :help, aliases: '-h', type: :boolean,
70
- desc: 'Display usage information'
71
- def run(cmd, subcmd = nil, *argv)
72
- if options[:help]
73
- invoke :help, ['run']
74
- else
75
- require_relative 'commands/run'
76
- Dip::Commands::Run.new(cmd, subcmd, argv).execute
77
- end
64
+ def run(*argv)
65
+ require_relative 'commands/run'
66
+ Dip::Commands::Run.new(*argv).execute
78
67
  end
79
68
 
80
69
  desc "provision", "Execute commands within provision section"
@@ -8,26 +8,25 @@ module Dip
8
8
  class Compose < Dip::Command
9
9
  DOCKER_EMBEDDED_DNS = "127.0.0.11"
10
10
 
11
- def initialize(cmd, argv = [])
12
- @cmd = cmd
11
+ attr_reader :argv, :config
12
+
13
+ def initialize(*argv)
13
14
  @argv = argv
14
15
  @config = ::Dip.config.compose || {}
15
16
  end
16
17
 
17
18
  def execute
18
- compose_argv = Array(find_files) + Array(find_project_name)
19
- compose_argv << @cmd
20
- compose_argv += @argv
21
-
22
19
  Dip.env["DIP_DNS"] ||= find_dns
23
20
 
21
+ compose_argv = Array(find_files) + Array(find_project_name) + argv
22
+
24
23
  shell("docker-compose", compose_argv)
25
24
  end
26
25
 
27
26
  private
28
27
 
29
28
  def find_files
30
- return unless (files = @config[:files])
29
+ return unless (files = config[:files])
31
30
 
32
31
  if files.is_a?(Array)
33
32
  files.each_with_object([]) do |file_name, memo|
@@ -41,7 +40,7 @@ module Dip
41
40
  end
42
41
 
43
42
  def find_project_name
44
- return unless (project_name = @config[:project_name])
43
+ return unless (project_name = config[:project_name])
45
44
 
46
45
  if project_name.is_a?(String)
47
46
  project_name = ::Dip.env.interpolate(project_name)
@@ -7,7 +7,7 @@ require_relative 'compose'
7
7
  module Dip
8
8
  module Commands
9
9
  class Run < Dip::Command
10
- def initialize(cmd, subcmd = nil, argv = [])
10
+ def initialize(cmd, subcmd = nil, *argv)
11
11
  @cmd = cmd.to_sym
12
12
  @subcmd = subcmd.to_sym if subcmd
13
13
  @argv = argv
@@ -43,7 +43,7 @@ module Dip
43
43
  compose_argv += command[:command].to_s.shellsplit
44
44
  compose_argv.concat(@argv)
45
45
 
46
- Dip::Commands::Compose.new(compose_method, compose_argv).execute
46
+ Dip::Commands::Compose.new(compose_method, *compose_argv).execute
47
47
  end
48
48
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
49
49
 
data/lib/dip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dip
4
- VERSION = "3.7.0"
4
+ VERSION = "3.7.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bibendi