Class: Traquitana::Cleaner
- Inherits:
-
Object
- Object
- Traquitana::Cleaner
- Defined in:
- lib/cleaner.rb
Instance Attribute Summary collapse
-
#network ⇒ Object
Returns the value of attribute network.
Instance Method Summary collapse
-
#initialize ⇒ Cleaner
constructor
A new instance of Cleaner.
- #run ⇒ Object
Constructor Details
#initialize ⇒ Cleaner
Returns a new instance of Cleaner.
5 6 7 8 9 10 11 |
# File 'lib/cleaner.rb', line 5 def initialize @config = Traquitana::Config.instance @config.load = @config.password.size > 1 ? { password: @config.password } : {} @network = Traquitana::SSH.new(@config.host, @config.user, ) end |
Instance Attribute Details
#network ⇒ Object
Returns the value of attribute network.
3 4 5 |
# File 'lib/cleaner.rb', line 3 def network @network end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 |
# File 'lib/cleaner.rb', line 13 def run STDOUT.print 'Cleaning old files ... ' @network.execute(["find #{@config.directory}/traq -type f -iname '*.zip' -o -iname '*.list' | sort | head -n-2 | xargs rm $1"]) STDOUT.puts 'done.' end |