Class: Wip::BuildContext
- Inherits:
-
Object
- Object
- Wip::BuildContext
- Defined in:
- lib/wip/build_context.rb
Overview
Stages a build context into a scratch directory with anything matched by
.dockerignore left out, since wslc build (unlike docker build) sends the
context as-is instead of filtering it itself.
Instance Method Summary collapse
-
#initialize(context, ignore: nil) ⇒ BuildContext
constructor
A new instance of BuildContext.
- #stage ⇒ Object
Constructor Details
#initialize(context, ignore: nil) ⇒ BuildContext
Returns a new instance of BuildContext.
12 13 14 15 |
# File 'lib/wip/build_context.rb', line 12 def initialize(context, ignore: nil) @root = Pathname(context). @ignore = ignore || DockerIgnore.load(@root.join('.dockerignore')) end |
Instance Method Details
#stage ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/wip/build_context.rb', line 17 def stage return yield @root.to_s if @ignore.empty? Dir.mktmpdir('wip-build-context-') do |dir| copy_included_files(Pathname(dir)) yield dir end end |