rake_docker 0.4.0 → 0.5.0
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/rake_docker/exceptions.rb +3 -0
- data/lib/rake_docker/tasks.rb +3 -1
- data/lib/rake_docker/tasks/clean.rb +23 -0
- data/lib/rake_docker/tasks/tag.rb +52 -0
- data/lib/rake_docker/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1758f497dafdfe7523fcaab8e6c9cb25ed5c4107
|
4
|
+
data.tar.gz: f75d58365df1f21e712d527b090c89685ebbeebf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf33f61e14e730650bfb8cd91d350a93e96463eac1a05103c908ea56bddaf55e260499ff1f45dc94884f5cb3f876d1e2bcd3b958096430dfe49393fa420f45be
|
7
|
+
data.tar.gz: 81d5421db3ece7b6d983fed38ab69b67004ccecf629d95bec80fa8fb4dc9868e7136087b7844db46e3da4f0e9f806316a8387d86ccc14e60a12ff09f1334e354
|
data/Gemfile.lock
CHANGED
data/lib/rake_docker/tasks.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../tasklib'
|
2
|
+
|
3
|
+
module RakeDocker
|
4
|
+
module Tasks
|
5
|
+
class Clean < TaskLib
|
6
|
+
parameter :name, :default => :clean
|
7
|
+
|
8
|
+
parameter :image_name, :required => true
|
9
|
+
parameter :work_directory, :required => true
|
10
|
+
|
11
|
+
def process_arguments(args)
|
12
|
+
self.name = args[0] if args[0]
|
13
|
+
end
|
14
|
+
|
15
|
+
def define
|
16
|
+
desc "Clean #{image_name} image directory"
|
17
|
+
task name do
|
18
|
+
rm_rf File.join(work_directory, image_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'docker'
|
2
|
+
require_relative '../tasklib'
|
3
|
+
|
4
|
+
module RakeDocker
|
5
|
+
module Tasks
|
6
|
+
class Tag < TaskLib
|
7
|
+
parameter :name, :default => :tag
|
8
|
+
|
9
|
+
parameter :image_name, :required => true
|
10
|
+
parameter :repository_name, :required => true
|
11
|
+
parameter :repository_url, :required => true
|
12
|
+
|
13
|
+
parameter :tag
|
14
|
+
parameter :tag_as_latest, :default => false
|
15
|
+
|
16
|
+
def process_arguments(args)
|
17
|
+
self.name = args[0] if args[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
def define
|
21
|
+
desc "Tag #{image_name} image for repository"
|
22
|
+
task name do
|
23
|
+
params = OpenStruct.new({
|
24
|
+
image_name: image_name,
|
25
|
+
repository_name: repository_name
|
26
|
+
})
|
27
|
+
|
28
|
+
derived_repository_url = repository_url.respond_to?(:call) ?
|
29
|
+
repository_url.call(*[params].slice(0, repository_url.arity)) :
|
30
|
+
repository_url
|
31
|
+
derived_tag = tag.respond_to?(:call) ?
|
32
|
+
tag.call(*[params].slice(0, tag.arity)) :
|
33
|
+
tag
|
34
|
+
|
35
|
+
images = Docker::Image.all(filter: repository_name)
|
36
|
+
if images.empty?
|
37
|
+
raise RakeDocker::ImageNotFound,
|
38
|
+
"No image found with name: '#{image_name}'"
|
39
|
+
end
|
40
|
+
|
41
|
+
image = images.first
|
42
|
+
image.tag(repo: derived_repository_url,
|
43
|
+
tag: derived_tag,
|
44
|
+
force: true) if derived_tag
|
45
|
+
image.tag(repo: derived_repository_url,
|
46
|
+
tag: 'latest',
|
47
|
+
force: true) if tag_as_latest
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/rake_docker/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_docker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|
@@ -146,7 +146,9 @@ files:
|
|
146
146
|
- lib/rake_docker/tasklib.rb
|
147
147
|
- lib/rake_docker/tasks.rb
|
148
148
|
- lib/rake_docker/tasks/build.rb
|
149
|
+
- lib/rake_docker/tasks/clean.rb
|
149
150
|
- lib/rake_docker/tasks/prepare.rb
|
151
|
+
- lib/rake_docker/tasks/tag.rb
|
150
152
|
- lib/rake_docker/version.rb
|
151
153
|
- rake_docker.gemspec
|
152
154
|
homepage: https://github.com/tobyclemson/rake_docker
|