Module: Docker::Template::Util
- Defined in:
- lib/docker/template/util.rb,
lib/docker/template/util/copy.rb,
lib/docker/template/util/data.rb
Defined Under Namespace
Class Method Summary collapse
- .create_dockerhub_context(builder, context) ⇒ Object
- .get_context(builder, context) ⇒ Object
- .notify_alias(aliased) ⇒ Object
- .notify_build(repo, rootfs: false) ⇒ Object
- .readme_file(builder) ⇒ Object
Class Method Details
.create_dockerhub_context(builder, context) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/docker/template/util.rb', line 28 def create_dockerhub_context(builder, context) dir = builder.repo.root.join("tags", builder.repo.tag) context = get_context(builder, context) FileUtils.mkdir_p dir $stdout.puts Ansi.yellow("Copying context for #{builder.repo}") Util::Copy.file(readme_file(builder), dir) Util::Copy.directory(context, dir) end |
.get_context(builder, context) ⇒ Object
40 41 42 43 |
# File 'lib/docker/template/util.rb', line 40 def get_context(builder, context) return context unless builder.aliased? builder.repo.root.join("tags", builder.repo.aliased) end |
.notify_alias(aliased) ⇒ Object
13 14 15 16 17 |
# File 'lib/docker/template/util.rb', line 13 def notify_alias(aliased) repo = aliased.repo parent_repo = aliased.parent_repo $stdout.puts Ansi.green("Aliasing #{repo} -> #{parent_repo}") end |
.notify_build(repo, rootfs: false) ⇒ Object
21 22 23 24 |
# File 'lib/docker/template/util.rb', line 21 def notify_build(repo, rootfs: false) img = rootfs ? repo.to_rootfs_s : repo.to_s $stdout.puts Ansi.green("Building: #{img}") end |
.readme_file(builder) ⇒ Object
47 48 49 50 51 |
# File 'lib/docker/template/util.rb', line 47 def readme_file(builder) builder.repo.root.children.find do |val| val.to_s =~ /readme/i end end |