capistrano-dockercompose-interactive 0.0.5 → 0.0.6
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f9d8ebd3c6975691b22dfa48f35a2a7e526dc9b
|
4
|
+
data.tar.gz: 5f8a11a25b113318903d90a6405cb6c5b8ca288a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e882f99869bb2f687d67fa7c8e242352745152e391c693312ce0ce2ff888ad04d1cc7b945f8594ee037b45c42584c613cdf0f033986fb889a7192ef12cd60bf5
|
7
|
+
data.tar.gz: bb2cf7d458f3a48cf6dbb561e63da0a40f95ca758adab87bf4636b2cd051014cbd232e6a5b12be425c8a33be761f3e5a75d466d11bc1f190e280b19fda3bac3f
|
data/README.md
CHANGED
@@ -4,8 +4,8 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'capistrano-dockercompose-interactive'
|
7
|
-
spec.version = '0.0.
|
8
|
-
spec.date = '2018-02-
|
7
|
+
spec.version = '0.0.6'
|
8
|
+
spec.date = '2018-02-03'
|
9
9
|
spec.summary = 'Helps managing docker compose excution on local or remote with inetractive shell support'
|
10
10
|
spec.description = spec.summary
|
11
11
|
spec.authors = ['Tom Hanoldt']
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'sshkit/interactive'
|
2
2
|
require_relative '../tasks/default.rb'
|
3
|
+
require_relative './interactive/instance'
|
3
4
|
|
4
5
|
module DockerCompose
|
5
6
|
module Interactive
|
6
|
-
require_relative './interactive/instance'
|
7
7
|
|
8
8
|
def self.instance(file='', project='')
|
9
9
|
Instance.new(file, project)
|
@@ -1,36 +1,39 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require_relative './service'
|
3
3
|
|
4
|
+
module DockerCompose
|
5
|
+
module Interactive
|
6
|
+
class Instance
|
7
|
+
def initialize(file='', project=nil)
|
8
|
+
@file = file
|
9
|
+
@project = project
|
10
|
+
end
|
4
11
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
12
|
+
def config
|
13
|
+
return @config if @config
|
14
|
+
raw_config = execute_compose_command('config', true)
|
15
|
+
@config = YAML.load(raw_config)
|
16
|
+
end
|
10
17
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@config = YAML.load(raw_config)
|
15
|
-
end
|
18
|
+
def execute(cmd, capture = false)
|
19
|
+
execute_compose_command(cmd, capture)
|
20
|
+
end
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
def execute_compose_command(cmd, capture = false)
|
23
|
+
project = @project.empty? ? "" : "-p #{@project}"
|
24
|
+
file = @file.empty? ? "" : "--file #{@file}"
|
25
|
+
cmd = "#{file} #{project} #{cmd}"
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
if capture
|
28
|
+
return DockerCompose::Interactive.capture_local_or_remote cmd
|
29
|
+
else
|
30
|
+
DockerCompose::Interactive.execute_local_or_remote_interactive cmd
|
31
|
+
end
|
32
|
+
end
|
25
33
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
DockerCompose::Interactive.execute_local_or_remote_interactive cmd
|
34
|
+
def service(name)
|
35
|
+
Service.new(self, name, config()['services'][name])
|
36
|
+
end
|
30
37
|
end
|
31
38
|
end
|
32
|
-
|
33
|
-
def service(name)
|
34
|
-
Service.new(self, name, config()['services'][name])
|
35
|
-
end
|
36
39
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module DockerCompose
|
3
|
+
module Interactive
|
4
|
+
class Service
|
5
|
+
def initialize(compose, name, config)
|
6
|
+
@compose, @name, @config = compose, name, config
|
7
|
+
end
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def id
|
10
|
+
result = @compose.execute_compose_command("ps -q #{@name}", true)
|
11
|
+
result.split(';').shift.strip
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def exec(cmd, capture=false)
|
15
|
+
cmd = "exec #{@name} #{cmd}"
|
16
|
+
@compose.execute_compose_command(cmd, capture)
|
17
|
+
end
|
16
18
|
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
def run(cmd, capture=false, args="--rm")
|
20
|
+
cmd = "run #{args} #{@name} #{cmd}"
|
21
|
+
@compose.execute_compose_command(cmd, capture)
|
22
|
+
end
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-dockercompose-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Hanoldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
|
-
rubygems_version: 2.6.
|
108
|
+
rubygems_version: 2.6.11
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Helps managing docker compose excution on local or remote with inetractive
|