dip 4.0.1 → 4.1.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: e9e182083867a474e1a4d690d64b99f0f32f3558c602fcc1f45d8b26de9cec80
4
- data.tar.gz: 23e86f513913591650ebae51677abe4d1106394d3d85bee525e6c8aa24a32e88
3
+ metadata.gz: 7ceb8c2f3312fdbc11a07bb73df3bb6c1a7a5bffbbab5b8adfd9a40585acb463
4
+ data.tar.gz: 2f34aae2a69df0f8356245558f996f37ae459c72bd00136b39bd6bce63fc3977
5
5
  SHA512:
6
- metadata.gz: '0984e1ff5bbead57f058908da95c97b67511ed99114921902c2325fecf1424df6b6b3dbe117e228baff0780c553d5bbe2385994bcede175002b48adb413a3f46'
7
- data.tar.gz: 42dbc12ed63103526e598a67617f8120be78caa5814d4d6ab68acc338bbad8e08189d5d8f34564cb9ff56b355fee2a3db3ac002643d743a8bded41aa60168b08
6
+ metadata.gz: acd4d9ac91aadf4ea842350a3bcd2cf18c6ef05c55c6a659f2f32a822b03fa0effbde00e163ad8de9dc98e24dd5d0329320eb79f03b6b109cc6b318d07b1b928
7
+ data.tar.gz: 3f0933d9bd9c482b733bb5672fd23b0def1fbfe6484166f759a017b6fc6beb5e20554b6de54a46009da8856894fbfbd0376cde2e3103426290205bcfe540965e
data/README.md CHANGED
@@ -75,7 +75,7 @@ It can be found at [releases page](https://github.com/bibendi/dip/releases)
75
75
  or type bellow into your terminal:
76
76
 
77
77
  ```sh
78
- curl -L https://github.com/bibendi/dip/releases/download/4.0.1/dip-`uname -s`-`uname -m` > /usr/local/bin/dip
78
+ curl -L https://github.com/bibendi/dip/releases/download/4.1.0/dip-`uname -s`-`uname -m` > /usr/local/bin/dip
79
79
  chmod +x /usr/local/bin/dip
80
80
  ```
81
81
 
@@ -160,6 +160,7 @@ interaction:
160
160
  psql:
161
161
  description: Run Postgres psql console
162
162
  service: app
163
+ default_args: db_dev
163
164
  command: psql -h pg -U postgres
164
165
 
165
166
  provision:
@@ -39,8 +39,12 @@ module Dip
39
39
  end
40
40
 
41
41
  compose_argv << command.fetch(:service)
42
- compose_argv.concat(command[:command].to_s.shellsplit)
43
- compose_argv.concat(argv)
42
+
43
+ unless (cmd = command[:command].to_s).empty?
44
+ compose_argv.concat(cmd.shellsplit)
45
+ end
46
+
47
+ compose_argv.concat(argv.any? ? argv : command[:default_args])
44
48
 
45
49
  compose_argv
46
50
  end
@@ -60,6 +60,7 @@ module Dip
60
60
  description: entry[:description],
61
61
  service: entry.fetch(:service),
62
62
  command: entry[:command],
63
+ default_args: prepare_default_args(entry[:default_args]),
63
64
  environment: entry[:environment] || {},
64
65
  compose: {
65
66
  method: entry.dig(:compose, :method) || entry[:compose_method] || "run",
@@ -70,10 +71,24 @@ module Dip
70
71
 
71
72
  def sub_command_defaults!(entry)
72
73
  entry[:command] ||= nil
74
+ entry[:default_args] ||= nil
73
75
  entry[:subcommands] ||= nil
74
76
  entry[:description] ||= nil
75
77
  end
76
78
 
79
+ def prepare_default_args(args)
80
+ return [] if args.nil?
81
+
82
+ case args
83
+ when Array
84
+ args
85
+ when String
86
+ args.shellsplit
87
+ else
88
+ raise ArgumentError, "Unknown type for default_args: #{args.inspect}"
89
+ end
90
+ end
91
+
77
92
  def compose_run_options(value)
78
93
  return [] unless value
79
94
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dip
4
- VERSION = "4.0.1"
4
+ VERSION = "4.1.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: 4.0.1
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bibendi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-22 00:00:00.000000000 Z
11
+ date: 2019-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor