docker-spec 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a736a70e119ee3d55295140138d5f220f382fd4e
4
- data.tar.gz: 7945ce843581eb476e90346fc40f63cde87db0a5
3
+ metadata.gz: 8642a66c400dbd55b436c74c562f50d6f76deeec
4
+ data.tar.gz: 2a23ed78be5cd72d9b08cf94c3f4840b976aae79
5
5
  SHA512:
6
- metadata.gz: a3af787003c12260f552e08fdf2a23a80f6377c8c5e243cae6e06abd954643f6918f28cc80262f138510cb20f4c69f5d471c666f531c4f00a7107da83dd82dfe
7
- data.tar.gz: 88d4133cfb8a0a4b2e2946e0cb80a8d401a763b473f0c23b9a2eae4b18ff3a435ac99f0d27632ddc0e3f5cb6c95369b79fdc962d319b7116a6211b2abc7d2d2d
6
+ metadata.gz: d8285c9c5ba7c4a8db0c934f362ab7fa1909a281abc88090a9dcf065702b523c3c530b66d2c91e06dad72a77a133b1bdff86e2a2a1df8aebb00fba0a9c9d158e
7
+ data.tar.gz: a76e8dc452c72e7c22b68c968707391228af6bde0175da854389613192f73eac1eeff15f2e4d93527a1fdc11b8674cba9494e572a8707e946777e4ad05a7deef
data/lib/docker/spec.rb CHANGED
@@ -10,6 +10,7 @@ require 'colorize'
10
10
  require 'yaml'
11
11
  require 'logger'
12
12
  require 'moneta'
13
+ require "base64"
13
14
  require 'pp'
14
15
 
15
16
  # Documentation
@@ -17,6 +18,7 @@ module DockerSpec
17
18
  CONTAINER_RUN_WAIT_TIMEOUT = 60
18
19
  CONFIG_FILE = 'docker_spec.yml'
19
20
  ROOT_DIR = 'root'
21
+ DOCKER_AUTH_FILE = '~/.docker/config.json'
20
22
  STDOUT.sync = true
21
23
 
22
24
  def self.run
@@ -28,19 +30,28 @@ module DockerSpec
28
30
 
29
31
  def self.push
30
32
  @config[:push_container] = DockerSpec.get_config(:push_container, 'DOCKER_SPEC_PUSH_CONTAINER',
31
- 'Push new tag? ')
33
+ "\nPush new tag? ")
32
34
  if @config[:push_container]
33
35
 
34
36
  @config[:tag_db] ||
35
37
  fail('tag_db is not defined in docker_spec.yml')
36
- @config[:dockerhub] ||
37
- fail('dockerhub is not defined in docker_spec.yml')
38
- @config[:dockerhub][:username] ||
39
- fail('dockerhub->username is not defined in docker_spec.yml')
40
- @config[:dockerhub][:password] ||
41
- fail('dockerhub->password is not defined in docker_spec.yml')
42
- @config[:dockerhub][:email] ||
43
- fail('dockerhub->email is not defined in docker_spec.yml')
38
+
39
+ # Load credentials from config file, or default docker config
40
+ if @config[:dockerhub]
41
+ @config[:dockerhub][:username] ||
42
+ fail('dockerhub->username is not defined in docker_spec.yml')
43
+ @config[:dockerhub][:password] ||
44
+ fail('dockerhub->password is not defined in docker_spec.yml')
45
+ @config[:dockerhub][:email] ||
46
+ fail('dockerhub->email is not defined in docker_spec.yml')
47
+ else
48
+ @config[:dockerhub] = Hash.new
49
+ docker_auth = JSON.parse(File.read(File.expand_path(DOCKER_AUTH_FILE)))
50
+ auth_base64 = docker_auth['auths']['https://index.docker.io/v1/']['auth']
51
+ @config[:dockerhub][:username] = Base64.decode64(auth_base64).split(':').first
52
+ @config[:dockerhub][:password] = Base64.decode64(auth_base64).split(':').last
53
+ @config[:dockerhub][:email] = docker_auth['auths']['https://index.docker.io/v1/']['email']
54
+ end
44
55
 
45
56
  # Open key value store and get the current tag for this repo
46
57
  store = Moneta.new(:YAML, file: @config[:tag_db])
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  module Spec
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Breinlinger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-23 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler