neptuno 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/neptuno/docker/up.rb +6 -6
- data/lib/neptuno/tty/config.rb +9 -9
- data/lib/neptuno/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 294ecbcd067c63dc56c264f49ed2338f0c625881
|
4
|
+
data.tar.gz: 91bca6f7898526f3e314a589ac6dc698f5b14156
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e6caa3d090c78e0787894086a95c0fa23f6be37fa814570bf70004f4c5dadfbc6500a0a21163cc57264ac806c4ebb6884c8fd9b103c3170a0eefa1845ef5ee1
|
7
|
+
data.tar.gz: 5534e7dcc424c14ec5ae852a0122c32c72b1315faeffc6a9e23df32979a52f819d4cfa46d2e281d51689c1c5036ca6171b45b1062b2c81242b8d4f6352dad15f
|
data/Gemfile.lock
CHANGED
data/lib/neptuno/docker/up.rb
CHANGED
@@ -4,16 +4,16 @@ module Neptuno
|
|
4
4
|
module Docker
|
5
5
|
# Build docker container for Neptuno project
|
6
6
|
class Up < Neptuno::CLI::Base
|
7
|
-
desc
|
7
|
+
desc 'Docker: bring up docker containers for current project'
|
8
8
|
|
9
|
-
option :all, type: :boolean, default: false, desc:
|
10
|
-
option :wait, type: :boolean, default: true, desc:
|
11
|
-
argument :services, type: :array, required: false, desc:
|
9
|
+
option :all, type: :boolean, default: false, desc: 'Run on all services'
|
10
|
+
option :wait, type: :boolean, default: true, desc: 'Wait for services to be healthy'
|
11
|
+
argument :services, type: :array, required: false, desc: 'Optional list of services'
|
12
12
|
|
13
13
|
def call(services: [], **options)
|
14
|
-
command_services_to(
|
14
|
+
command_services_to('come up', all: options.fetch(:all), services_as_args: services) do |services, _project|
|
15
15
|
make_service_files(services)
|
16
|
-
system("cd #{neptuno_path} && docker
|
16
|
+
system("cd #{neptuno_path} && docker compose up -d --wait #{services.join(' ')}")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/neptuno/tty/config.rb
CHANGED
@@ -6,9 +6,9 @@ module Neptuno
|
|
6
6
|
module Config
|
7
7
|
include TTY::File
|
8
8
|
TTY = ::TTY::Config.new
|
9
|
-
TTY.filename =
|
9
|
+
TTY.filename = 'neptuno'
|
10
10
|
|
11
|
-
ABORT_MESSAGE =
|
11
|
+
ABORT_MESSAGE = 'fatal: there are no registered services. Add one with: neptuno services add'
|
12
12
|
|
13
13
|
def config
|
14
14
|
TTY
|
@@ -25,11 +25,11 @@ module Neptuno
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def docker_compose_services
|
28
|
-
docker_compose_hash.fetch(
|
28
|
+
docker_compose_hash.fetch('services').keys.sort
|
29
29
|
end
|
30
30
|
|
31
31
|
def auto_restart_procs
|
32
|
-
config.fetch(
|
32
|
+
config.fetch('auto_restart_procs')
|
33
33
|
end
|
34
34
|
|
35
35
|
def services
|
@@ -39,16 +39,16 @@ module Neptuno
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def configured_services
|
42
|
-
config.fetch(
|
42
|
+
config.fetch('configured_services')
|
43
43
|
end
|
44
44
|
|
45
45
|
def running_services
|
46
|
-
`cd #{neptuno_path} && docker
|
46
|
+
`cd #{neptuno_path} && docker compose ps --status running --services`.split
|
47
47
|
end
|
48
48
|
|
49
49
|
def json_services_status
|
50
50
|
JSON.parse(`cd #{neptuno_path} && docker compose ps --all --format json`).map do |service|
|
51
|
-
[service.dig(
|
51
|
+
[service.dig('Service'), service.dig('Status')]
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -63,13 +63,13 @@ module Neptuno
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def services_with_procs
|
66
|
-
`cd #{neptuno_path} && find procfiles -type f -size +0`.split.map { |x| x.split(
|
66
|
+
`cd #{neptuno_path} && find procfiles -type f -size +0`.split.map { |x| x.split('/')[1] }
|
67
67
|
end
|
68
68
|
|
69
69
|
def get_dependants(services = [])
|
70
70
|
return [] if services.empty?
|
71
71
|
|
72
|
-
deps = services.map { |service| docker_compose_hash.dig(
|
72
|
+
deps = services.map { |service| docker_compose_hash.dig('services', service, 'depends_on') }.flatten.uniq
|
73
73
|
[deps, get_dependants(deps - services)].flatten.compact.uniq
|
74
74
|
end
|
75
75
|
end
|
data/lib/neptuno/version.rb
CHANGED