Module: Docker::Template
- Defined in:
- lib/docker/template.rb,
lib/docker/template/cli.rb,
lib/docker/template/repo.rb,
lib/docker/template/cache.rb,
lib/docker/template/error.rb,
lib/docker/template/logger.rb,
lib/docker/template/normal.rb,
lib/docker/template/notify.rb,
lib/docker/template/parser.rb,
lib/docker/template/rootfs.rb,
lib/docker/template/builder.rb,
lib/docker/template/scratch.rb,
lib/docker/template/version.rb,
lib/docker/template/metadata.rb
Defined Under Namespace
Modules: Cache, Error, Notify Classes: Builder, CLI, Logger, Metadata, Normal, Parser, Repo, Rootfs, Scratch
Constant Summary collapse
- VERSION =
"0.4.0"
Class Method Summary collapse
-
.gem_root ⇒ Object
————————————————————————.
-
.get(name, data = {}) ⇒ Object
———————————————————————— Pull a
templatefrom thetemplate_rootto parse it’s data. -
.root ⇒ Object
————————————————————————.
-
.template_root ⇒ Object
————————————————————————.
Class Method Details
.gem_root ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/docker/template.rb', line 53 def gem_root @gem_root ||= begin Pathutil.new("../../").( __dir__ ) end end |
.get(name, data = {}) ⇒ Object
Pull a template from the template_root to parse it’s data. TODO: Rename this get template!
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/docker/template.rb', line 74 def get(name, data = {}) data = ERB::Context.new(data) template = template_root.join("#{name}.erb").read unless name.is_a?(Pathutil) template = name.read if name.is_a?(Pathutil) template = ERB.new(template) return template.result( data._binding ) end |
.root ⇒ Object
45 46 47 48 49 |
# File 'lib/docker/template.rb', line 45 def root @root ||= begin Pathutil.new(Dir.pwd) end end |
.template_root ⇒ Object
63 64 65 66 67 |
# File 'lib/docker/template.rb', line 63 def template_root @template_root ||= begin gem_root.join("templates") end end |