docker-build 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13094bf25d31153950a8ce1836c5cea44c936916
4
- data.tar.gz: 2cb292051e8f2072ff6147f3fb4084b86e1b7cd1
3
+ metadata.gz: 8854e34c73ebdcce2a483d38184f42d43ec4cde2
4
+ data.tar.gz: 8db9e5273a04e3b4333f14f750997b3ac9319105
5
5
  SHA512:
6
- metadata.gz: 4005092fe8464c333bc523426eb481cdda1b8c9eac45239c56c13148494a11454e6caf6034b4ced3bfc14d75f98dbcf628ea770e7f3b9673f8b2d24d9f22a5b7
7
- data.tar.gz: 52baeb6f0000f745d52a9306a194019ce59e31c27cb3ea56cb20121ae1189428cb60efaf6aa56e088f7a1c2a3b21bf33e35cc3d227f717997dd06145970beac5
6
+ metadata.gz: a2a31f791aefd8c1aa1918c64ea448dbc574d7d77fb6693323d63dc8c82e876a4ed58f6bdae53ab19946948b2e116af8072bde7301735509f643ba0ef427bb71
7
+ data.tar.gz: 5c2efb6309bb4471a622023332df7d92bd0f22b517e8b395901c7ed3bb2ce097cc9f96d248cd307f40cbc180040662301422caa507e9000ef13ce7cc17afacfc
data/lib/composer.rb CHANGED
@@ -27,4 +27,20 @@ class Composer
27
27
  return docker_command
28
28
  end
29
29
 
30
+ def self.convert_env_args_to_env_hash(args)
31
+ env_hash = {}
32
+
33
+ # do first arg
34
+ env_var = args[:env].split('=')
35
+ env_hash[env_var[0].to_sym] = env_var[1]
36
+
37
+ # do rest of args
38
+ args.extras.each do |x|
39
+ env_var = x.split('=')
40
+ env_hash[env_var[0].to_sym] = env_var[1]
41
+ end
42
+
43
+ return env_hash
44
+ end
45
+
30
46
  end
data/lib/docker-build.rb CHANGED
@@ -8,7 +8,27 @@ class DockerBuild
8
8
  Symfony
9
9
  end
10
10
 
11
+ def self.google
12
+ Google
13
+ end
14
+
15
+ def self.data_container(docker_file_path)
16
+ command = "docker build #{docker_file_path}"
17
+ output = `#{command}`
18
+
19
+ puts output
20
+
21
+ output_match = /(Successfully built )(.*)/.match(output)
22
+
23
+ fail 'Docker failed to build the container!' unless output_match
24
+
25
+ puts output_match[1]
26
+
27
+ return output_match[1]
28
+ end
29
+
11
30
  end
12
31
 
13
32
  require 'composer'
33
+ require 'docker/google'
14
34
  require 'symfony/symfony'
@@ -0,0 +1,21 @@
1
+ class Google
2
+
3
+ def self.tag_container(image_id, repo, project_id)
4
+ time = Time.new
5
+ image_timestamp = "#{time.year}-#{time.month}-#{time.day}_#{time.hour}#{time.min}#{time.sec}"
6
+ branch = `git rev-parse --abbrev-ref HEAD`.strip
7
+ command = "docker tag #{image_id} #{repo}/#{project_id}:#{branch}-latest"
8
+ puts command
9
+ system command
10
+ tag = "#{repo}/#{project_id}:#{branch}-#{image_timestamp}"
11
+ command = "docker tag #{image_id} #{tag}"
12
+ puts command
13
+ system command
14
+ return tag
15
+ end
16
+
17
+ def self.push_container(image_tag)
18
+ command = "gcloud preview docker push #{image_tag}"
19
+ fail "Could not push container: #{image_tag}" unless system(command)
20
+ end
21
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - VJ Patel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-30 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Preset tasks for Rake when building projects with Docker
14
14
  email: meetthevj@gmail.com
@@ -22,6 +22,7 @@ files:
22
22
  - docker-build.gemspec
23
23
  - lib/composer.rb
24
24
  - lib/docker-build.rb
25
+ - lib/docker/google.rb
25
26
  - lib/symfony/doctrine.rb
26
27
  - lib/symfony/symfony.rb
27
28
  homepage: http://rubygems.org/gems/docker-build