Class: R10K::Action::Environment::Purge
- Inherits:
-
Object
- Object
- R10K::Action::Environment::Purge
- Includes:
- Logging
- Defined in:
- lib/r10k/action/environment.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, path) ⇒ Purge
constructor
A new instance of Purge.
Methods included from Logging
formatter, included, level, level=, #logger, outputter
Constructor Details
#initialize(app, path) ⇒ Purge
Returns a new instance of Purge.
56 57 58 |
# File 'lib/r10k/action/environment.rb', line 56 def initialize(app, path) @app, @path = app, path end |
Instance Method Details
#call(env) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/r10k/action/environment.rb', line 61 def call(env) @env = env stale_directories = R10K::Deployment.collection.stale(@path) stale_directories.each do |dir| logger.info "Purging stale environment #{dir.inspect}" FileUtils.rm_rf(dir, :secure => true) end @app.call(@env) end |