lib/percheron/actions/recreate.rb in percheron-0.7.14 vs lib/percheron/actions/recreate.rb in percheron-0.7.15
- old
+ new
@@ -2,29 +2,31 @@
module Actions
class Recreate
include Base
- def initialize(unit, start: false)
+ def initialize(unit, start: false, force: false)
@unit = unit
@start = start
+ @force = force
end
def execute!
results = []
- if recreate?
+ if recreate? || force?
results << recreate!
results << start!
else
inform!
end
results.compact.empty? ? nil : unit
end
private
- attr_reader :unit, :start
+ attr_reader :unit, :start, :force
alias_method :start?, :start
+ alias_method :force?, :force
def recreate?
!unit.versions_match? || !unit.dockerfile_md5s_match?
end