capistrano-dockercompose-interactive 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2630b552e22ee0780cc964ab354f23d7bc8ed392
4
- data.tar.gz: 1509c42bb44d9f50039cd41f5302f3a4d57181c5
3
+ metadata.gz: 6f9d8ebd3c6975691b22dfa48f35a2a7e526dc9b
4
+ data.tar.gz: 5f8a11a25b113318903d90a6405cb6c5b8ca288a
5
5
  SHA512:
6
- metadata.gz: 2942265856d26f81942d31a023e0e30de39a8c807770ff64ccd89bb1f167150057cf0f1b79ef4d9b70f9d1ab9aef4dcd5887f14d2c3a4616ce96c7d2d2ba8f66
7
- data.tar.gz: 12283eb0dc10b00ed88733277adfee155531834f326cec4425021e7dda461fc0c5cff4969be992aa8fc9add12e6929ca9efdff35c26a8bd62a751041b3ea5178
6
+ metadata.gz: e882f99869bb2f687d67fa7c8e242352745152e391c693312ce0ce2ff888ad04d1cc7b945f8594ee037b45c42584c613cdf0f033986fb889a7192ef12cd60bf5
7
+ data.tar.gz: bb2cf7d458f3a48cf6dbb561e63da0a40f95ca758adab87bf4636b2cd051014cbd232e6a5b12be425c8a33be761f3e5a75d466d11bc1f190e280b19fda3bac3f
data/README.md CHANGED
@@ -33,6 +33,9 @@ require 'capistrano/dockercompose/interactive'
33
33
 
34
34
  ## Changes
35
35
 
36
+ ### Version 0.0.2
37
+ * use clean modiule namespaces
38
+
36
39
  ### Version 0.0.1
37
40
  * initial release
38
41
 
@@ -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.5'
8
- spec.date = '2018-02-01'
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
- class Instance
6
- def initialize(file='', project=nil)
7
- @file = file
8
- @project = project
9
- end
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
- def config
12
- return @config if @config
13
- raw_config = execute_compose_command('config', true)
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
- def execute(cmd, capture = false)
18
- execute_compose_command(cmd, capture)
19
- end
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
- def execute_compose_command(cmd, capture = false)
22
- project = @project.empty? ? "" : "-p #{@project}"
23
- file = @file.empty? ? "" : "--file #{@file}"
24
- cmd = "#{file} #{project} #{cmd}"
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
- if capture
27
- return DockerCompose::Interactive.capture_local_or_remote cmd
28
- else
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
- class Service
3
- def initialize(compose, name, config)
4
- @compose, @name, @config = compose, name, config
5
- end
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
- def id
8
- result = @compose.execute_compose_command("ps -q #{@name}", true)
9
- result.split(';').shift.strip
10
- end
9
+ def id
10
+ result = @compose.execute_compose_command("ps -q #{@name}", true)
11
+ result.split(';').shift.strip
12
+ end
11
13
 
12
- def exec(cmd, capture=false)
13
- cmd = "exec #{@name} #{cmd}"
14
- @compose.execute_compose_command(cmd, capture)
15
- end
14
+ def exec(cmd, capture=false)
15
+ cmd = "exec #{@name} #{cmd}"
16
+ @compose.execute_compose_command(cmd, capture)
17
+ end
16
18
 
17
- def run(cmd, capture=false, args="--rm")
18
- cmd = "run #{args} #{@name} #{cmd}"
19
- @compose.execute_compose_command(cmd, capture)
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.5
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-01 00:00:00.000000000 Z
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.12
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