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 +4 -4
- data/README.md +2 -1
- data/lib/dip/commands/run.rb +6 -2
- data/lib/dip/interaction_tree.rb +15 -0
- data/lib/dip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ceb8c2f3312fdbc11a07bb73df3bb6c1a7a5bffbbab5b8adfd9a40585acb463
|
4
|
+
data.tar.gz: 2f34aae2a69df0f8356245558f996f37ae459c72bd00136b39bd6bce63fc3977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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:
|
data/lib/dip/commands/run.rb
CHANGED
@@ -39,8 +39,12 @@ module Dip
|
|
39
39
|
end
|
40
40
|
|
41
41
|
compose_argv << command.fetch(:service)
|
42
|
-
|
43
|
-
|
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
|
data/lib/dip/interaction_tree.rb
CHANGED
@@ -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
|
|
data/lib/dip/version.rb
CHANGED
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
|
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-
|
11
|
+
date: 2019-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|