dockerb 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 819d0dd97fe98f703473361598c3a1498c9d6252
4
+ data.tar.gz: 6e57950e6dd76205b5cbbfb59ea3a93e69097ba0
5
+ SHA512:
6
+ metadata.gz: 90d45c658569f2a08eaaac2a08ff6d10d2d667e48dbd96d2c1f9e87d17f650fdd573f9b19daf024bff20eeb93c155cfb89ac4374942e086c1343cd3ac67e152e
7
+ data.tar.gz: 877a65144fb5cb6676bd586e8167e387637f50a90312c6eafbecd06bb80972b77ce0a603df751b4f80add1b367e56a9511c7323bf574cc50c5d0fec39cf7e49f
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2013 Michael Grosser <michael@grosser.it>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/bin/dockerb ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # enable local usage from cloned repo
3
+ root = File.expand_path("../..", __FILE__)
4
+ $LOAD_PATH << "#{root}/lib" if File.exist?("#{root}/Gemfile")
5
+
6
+ require "dockerb"
7
+ Dockerb.compile
8
+ exec *(["docker"] + ARGV)
@@ -0,0 +1,3 @@
1
+ module Dockerb
2
+ VERSION = "0.0.0"
3
+ end
data/lib/dockerb.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'erb'
2
+
3
+ module Dockerb
4
+ class << self
5
+ def compile
6
+ return (yield if block_given?) unless File.exist?("Dockerfile.erb")
7
+ begin
8
+ File.write("Dockerfile", Context.compile(File.read("Dockerfile.erb")))
9
+ yield if block_given?
10
+ ensure
11
+ File.unlink("Dockerfile") if File.exist?("Dockerfile") && block_given?
12
+ end
13
+ end
14
+ end
15
+
16
+ class Context
17
+ class << self
18
+ def compile(code)
19
+ ERB.new(code).result(binding)
20
+ end
21
+
22
+ private
23
+
24
+ def bundle
25
+ <<-EOF.gsub(/^ /, "")
26
+ ADD Gemfile /app/
27
+ ADD Gemfile.lock /app/
28
+ ADD vendor/cache /app/vendor/cache
29
+ RUN bundle install --quiet --local --jobs 4 || bundle check
30
+ EOF
31
+ end
32
+
33
+ def install_gem(name)
34
+ version = File.read("Gemfile.lock")[/^ #{name} \((.+)\)/, 1] || raise("Gem #{name} not found in Gemfile.lock")
35
+ "RUN gem install -v #{version} #{name}"
36
+ end
37
+ end
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dockerb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Michael Grosser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: michael@grosser.it
15
+ executables:
16
+ - dockerb
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - MIT-LICENSE
21
+ - bin/dockerb
22
+ - lib/dockerb.rb
23
+ - lib/dockerb/version.rb
24
+ homepage: https://github.com/grosser/dockerb
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.2.2
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Dockerfile.erb - use ruby in your Dockerfile
48
+ test_files: []