docker_deploy 0.2.1 → 0.2.2

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: e6ecb0e145a8a035e682723c67deb36e908de5ad
4
- data.tar.gz: 7a4a43a110e5fa7d3b338e710cbbd89e8a1d11c4
3
+ metadata.gz: 3f377e6e5c4f35c71eb78e3e3f1a43600ba7ace9
4
+ data.tar.gz: bd168fbc6d365ac6bb2d036f364cc2c6272e6aa8
5
5
  SHA512:
6
- metadata.gz: 685ffec9fcb8743c058c09aa2fd0f108bdd1a7d2a578e9ad77a0ccad79bfb0708005ff5357c18838495a7398ecf36e85377f16ad4b91ab6e60ab9d66dbf1c4b5
7
- data.tar.gz: e8db5e0fdc5cc792836487f8ff3a044e3eeda3e211d5908424ee7abfae81b61e22f7673e63b59fe21b8bdea8c2dd352ad27df4ab1bffd1cc205b152f848c8572
6
+ metadata.gz: 32c259e9d57c6d73f3d6774840a5265a00beeb5c2d6fdcc81a38b489a3d91419e39a9dac3318ef2caa672e797f72ff00e4c7d6896193e905b46694a0d5089d77
7
+ data.tar.gz: 529a1cd86771318527138c5928c58348aea4c65e354182b1ec0fcab1212cef09cf8575adb5f3573e2a92823de6e7f34e0618469e1c483f299ac4ad2899fe8f05
data/README.md CHANGED
@@ -8,7 +8,7 @@ Ruby applications.
8
8
  Add this line to your application's Gemfile:
9
9
 
10
10
  ``` ruby
11
- gem 'docker_deploy'
11
+ gem "docker_deploy", require: false
12
12
  ```
13
13
 
14
14
  ## Usage
@@ -16,6 +16,8 @@ gem 'docker_deploy'
16
16
  In your Rakefile define your deployment setup like this:
17
17
 
18
18
  ``` ruby
19
+ require "docker_deploy"
20
+
19
21
  DockerDeploy.task do
20
22
  image "elabs/projectpuzzle"
21
23
 
@@ -31,8 +31,9 @@ module DockerDeploy
31
31
  @image
32
32
  end
33
33
 
34
- def container
35
- @image.split("/").last
34
+ def container(name = nil)
35
+ @container = name if name
36
+ @container or @image.split("/").last
36
37
  end
37
38
 
38
39
  def revision
@@ -2,7 +2,7 @@ module DockerDeploy
2
2
  class Stage
3
3
  include Rake::FileUtilsExt
4
4
 
5
- attr_reader :name, :servers, :variables, :links, :env_files, :deploy
5
+ attr_reader :name, :servers, :variables, :links, :env_files, :deploy, :container
6
6
 
7
7
  def initialize(context, name)
8
8
  @context = context
@@ -48,6 +48,11 @@ module DockerDeploy
48
48
  format_params("-e %s=%s", @context.variables.merge(@variables))
49
49
  end
50
50
 
51
+ def container(name = nil)
52
+ @container = name if name
53
+ @container or @context.container
54
+ end
55
+
51
56
  private
52
57
 
53
58
  def format_params(pattern, enumerable)
@@ -31,12 +31,12 @@ module DockerDeploy
31
31
 
32
32
  desc "Stop the application and remove its container"
33
33
  task :stop do
34
- stage.run "docker inspect #{context.container} 2>&1 > /dev/null && docker stop #{context.container} && docker rm #{context.container} || true"
34
+ stage.run "docker inspect #{stage.container} 2>&1 > /dev/null && docker stop #{stage.container} && docker rm #{stage.container} || true"
35
35
  end
36
36
 
37
37
  desc "Start the application in a container using the latest image."
38
38
  task :start do
39
- stage.run "docker run -d #{stage.port_mappings} #{stage.link_mappings} #{stage.options} --name #{context.container} #{context.image}:latest"
39
+ stage.run "docker run -d #{stage.port_mappings} #{stage.link_mappings} #{stage.options} --name #{stage.container} #{context.image}:latest"
40
40
 
41
41
  puts "\n\nStarted: #{stage.host}\n"
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module DockerDeploy
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-10 00:00:00.000000000 Z
12
+ date: 2014-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sshkit