dockerb 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dockerb.rb +10 -10
- data/lib/dockerb/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f57a621c6ad394a634488991d4fabef377a10562
|
4
|
+
data.tar.gz: 792bdfbef9a8cc8fa148d2641a28217e789f5f2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5980bbd8bfc510e70c316c56a512150bbc3a08474e54ec7224a78e00ec6f92805aa255d9dec885f82ce6341b07b31c2f8d028a3011ab0e39ab4fc26ad3c442
|
7
|
+
data.tar.gz: 16d3d74c4026cd157c2b8332d310de8fc8fc2b3fb07faad3de6bec212c95997b52b84bef5c5c0299ed578db900690b7b045ceaa551a3f25b21bfde0580a5e6e7
|
data/lib/dockerb.rb
CHANGED
@@ -6,26 +6,26 @@ module Dockerb
|
|
6
6
|
SEARCH = /#{Regexp.escape(GENERATED).sub('VERSION', '([\d\.]+)')}/
|
7
7
|
|
8
8
|
class << self
|
9
|
-
def compile(&block)
|
10
|
-
return (yield if block) unless File.exist?("
|
11
|
-
ensure_not_older_than_last
|
12
|
-
compile_dockerfile(&block)
|
9
|
+
def compile(docker_file="Dockerfile", &block)
|
10
|
+
return (yield if block) unless File.exist?("#{docker_file}.erb")
|
11
|
+
ensure_not_older_than_last(docker_file)
|
12
|
+
compile_dockerfile(docker_file, &block)
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
|
-
def ensure_not_older_than_last
|
18
|
-
return unless File.exist?(
|
19
|
-
return unless old = File.read(
|
17
|
+
def ensure_not_older_than_last(docker_file)
|
18
|
+
return unless File.exist?(docker_file)
|
19
|
+
return unless old = File.read(docker_file)[SEARCH, 1]
|
20
20
|
return unless Gem::Version.new(old) > Gem::Version.new(VERSION)
|
21
21
|
raise "Previous file was generated by dockerb #{old}, use it or a newer version."
|
22
22
|
end
|
23
23
|
|
24
|
-
def compile_dockerfile(&block)
|
25
|
-
File.write(
|
24
|
+
def compile_dockerfile(docker_file, &block)
|
25
|
+
File.write(docker_file, Context.compile(File.read("#{docker_file}.erb")))
|
26
26
|
yield if block
|
27
27
|
ensure
|
28
|
-
File.unlink(
|
28
|
+
File.unlink(docker_file) if File.exist?(docker_file) && block
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
data/lib/dockerb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockerb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: michael@grosser.it
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.
|
44
|
+
rubygems_version: 2.4.5.1
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Dockerfile.erb - use ruby in your Dockerfile
|