dockerb 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dockerb.rb +10 -10
  3. data/lib/dockerb/version.rb +1 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d80b455d4cf60c63db0ae6657945667d3a850e45
4
- data.tar.gz: 5e117e36b1db3cf80f6f4175ccb8290442ba4f43
3
+ metadata.gz: f57a621c6ad394a634488991d4fabef377a10562
4
+ data.tar.gz: 792bdfbef9a8cc8fa148d2641a28217e789f5f2b
5
5
  SHA512:
6
- metadata.gz: 31e5f388d6fdd409e8556b21b6312ac496ec5b024cd4d905894a4ec53e21bef4d1b3a20b109af1e67a5021592135b7bdebb96dae02fa0c81a8d19f40d68b02e5
7
- data.tar.gz: 0277724fc4e8228260edc7a0e41b61a215daf65856db1d9d7e269eb2797f32b4b7c1f0a3a50074fafb228f1936b7643e90ae1a662d1e44e41e31806e22e51c88
6
+ metadata.gz: 9f5980bbd8bfc510e70c316c56a512150bbc3a08474e54ec7224a78e00ec6f92805aa255d9dec885f82ce6341b07b31c2f8d028a3011ab0e39ab4fc26ad3c442
7
+ data.tar.gz: 16d3d74c4026cd157c2b8332d310de8fc8fc2b3fb07faad3de6bec212c95997b52b84bef5c5c0299ed578db900690b7b045ceaa551a3f25b21bfde0580a5e6e7
@@ -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?("Dockerfile.erb")
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?("Dockerfile")
19
- return unless old = File.read("Dockerfile")[SEARCH, 1]
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("Dockerfile", Context.compile(File.read("Dockerfile.erb")))
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("Dockerfile") if File.exist?("Dockerfile") && block
28
+ File.unlink(docker_file) if File.exist?(docker_file) && block
29
29
  end
30
30
  end
31
31
 
@@ -1,3 +1,3 @@
1
1
  module Dockerb
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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: 2015-07-10 00:00:00.000000000 Z
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.2.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