henk 0.0.1 → 0.1.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ Y2Y3ZDhjZjRkZDUxMDI0ZDdkNTkxMGQwNDdkMzlmMGY1NjE0ZDk0Nw==
5
+ data.tar.gz: !binary |-
6
+ MWY4ZTQ3MDZlOGU4MTJjZjY5NTlkYjViMDc1MTk2ZjkxODlmZTUwNQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ Nzk0OGFkOWIyYzRhY2ZkN2Q5YTQ4MzhlMjI3YmUyMmI1NTNkYTRlMWI0NWEz
10
+ NDg1ZjQ4YWE1NTQzNzhmZjFmMzAzMzRmMjk5ZGNhNDU3OGY2MTM4NWFkMjIz
11
+ OTE1M2I1N2IyNmU5Mzc4MjZkZGM4ZDIxNDRhNWY3OGIyYmUxMTE=
12
+ data.tar.gz: !binary |-
13
+ NDgzZjQyMTZiYTRmNWQ2M2YwNDhkMTM2ZTVjZjcxYzA4MGU1MTFmNWI5N2Zm
14
+ MGMzZjI0ZTI4N2YyMGI3ZmYyYmYzZWM0ZWFkZWI3YjZlMmI3NTNkYzIzMjA2
15
+ OGFhOThlYzIyNzdkY2YyMTZiODRiY2QwMmY0ZDI5MWJiZDZlMTQ=
data/lib/henk/commands.rb CHANGED
@@ -5,7 +5,23 @@ module Henk
5
5
  end
6
6
 
7
7
  def resolve_image_name(name)
8
+ return resolve_untagged_image_name(name) unless name.include?(':')
9
+
10
+ # this is a kludge.
11
+ lines = execute_for_lines('docker', 'images')
12
+ lines = lines.map { |line| line.split(/ +/) }
13
+
14
+ raise "'docker images' output not as expected" unless
15
+ lines.first.length == 5 &&
16
+ lines.first[0..1] == %w(REPOSITORY TAG)
17
+
18
+ line = lines.find { |l| l[0..1].join(':') == name}
19
+ line && line[2]
20
+ end
21
+
22
+ def resolve_untagged_image_name(name)
8
23
  result = execute_for_word('docker', 'images', '-q', name)
24
+ raise "image name #{name} is ambiguous" if result.include?("\n")
9
25
  result unless result.empty?
10
26
  end
11
27
 
@@ -21,5 +37,12 @@ module Henk
21
37
  def logs(container)
22
38
  execute('docker', 'logs', container)
23
39
  end
40
+
41
+ def tag(image, repository, tag = nil, options = {})
42
+ command_options = []
43
+ command_options << '-f' if options[:force]
44
+
45
+ execute 'docker', 'tag', *command_options, image, repository, *tag
46
+ end
24
47
  end
25
48
  end
data/lib/henk/instance.rb CHANGED
@@ -58,5 +58,10 @@ module Henk
58
58
  sheller_result = execute(*arguments)
59
59
  sheller_result.stdout.chomp if sheller_result.exit_status.success?
60
60
  end
61
+
62
+ def execute_for_lines(*arguments)
63
+ sheller_result = execute(*arguments)
64
+ sheller_result.stdout.chomp.split("\n") if sheller_result.exit_status.success?
65
+ end
61
66
  end
62
67
  end
data/lib/henk/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Henk
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,28 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: henk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Thomas Stratmann
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-19 00:00:00.000000000 Z
11
+ date: 2013-10-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: sheller
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
14
+ version_requirements: !ruby/object:Gem::Requirement
18
15
  requirements:
19
16
  - - ! '>='
20
17
  - !ruby/object:Gem::Version
21
18
  version: '0'
22
19
  type: :runtime
23
20
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
21
+ name: sheller
22
+ requirement: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -49,26 +46,26 @@ files:
49
46
  - lib/henk/version.rb
50
47
  homepage: ''
51
48
  licenses: []
49
+ metadata: {}
52
50
  post_install_message:
53
51
  rdoc_options: []
54
52
  require_paths:
55
53
  - lib
56
54
  required_ruby_version: !ruby/object:Gem::Requirement
57
- none: false
58
55
  requirements:
59
56
  - - ! '>='
60
57
  - !ruby/object:Gem::Version
61
58
  version: '0'
62
59
  required_rubygems_version: !ruby/object:Gem::Requirement
63
- none: false
64
60
  requirements:
65
61
  - - ! '>='
66
62
  - !ruby/object:Gem::Version
67
63
  version: '0'
68
64
  requirements: []
69
65
  rubyforge_project:
70
- rubygems_version: 1.8.23
66
+ rubygems_version: 2.0.5
71
67
  signing_key:
72
- specification_version: 3
68
+ specification_version: 4
73
69
  summary: a ruby wrapper around the docker CLI
74
70
  test_files: []
71
+ has_rdoc: