Class: Shippy::Maintainer
- Inherits:
-
Object
- Object
- Shippy::Maintainer
- Defined in:
- lib/shippy/maintainer.rb
Constant Summary collapse
- IMAGE_RETENTION_HOURS =
7 days
24 * 7
- CONTAINER_RETENTION_HOURS =
3 days
24 * 3
Instance Method Summary collapse
- #clean_all ⇒ Object
- #clean_containers(hours: CONTAINER_RETENTION_HOURS) ⇒ Object
- #clean_images(hours: IMAGE_RETENTION_HOURS) ⇒ Object
-
#initialize(host, ui: nil) ⇒ Maintainer
constructor
A new instance of Maintainer.
Constructor Details
#initialize(host, ui: nil) ⇒ Maintainer
Returns a new instance of Maintainer.
6 7 8 9 10 |
# File 'lib/shippy/maintainer.rb', line 6 def initialize(host, ui: nil) @host = host @ui = ui @docker = Shippy::Docker::System.new(host) end |
Instance Method Details
#clean_all ⇒ Object
12 13 14 15 |
# File 'lib/shippy/maintainer.rb', line 12 def clean_all clean_containers clean_images end |
#clean_containers(hours: CONTAINER_RETENTION_HOURS) ⇒ Object
22 23 24 25 |
# File 'lib/shippy/maintainer.rb', line 22 def clean_containers(hours: CONTAINER_RETENTION_HOURS) notify("Pruning stopped containers older than #{hours} hours...") @docker.prune_containers(hours_until: hours) end |
#clean_images(hours: IMAGE_RETENTION_HOURS) ⇒ Object
17 18 19 20 |
# File 'lib/shippy/maintainer.rb', line 17 def clean_images(hours: IMAGE_RETENTION_HOURS) notify("Pruning images older than #{hours} hours...") @docker.prune_images(hours_until: hours) end |