Class: Hotdog::Commands::Rm

Inherits:
BaseCommand show all
Defined in:
lib/hotdog/commands/rm.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#application, #formatter, #logger, #options, #tags

Instance Method Summary collapse

Methods inherited from BaseCommand

#execute, #initialize

Constructor Details

This class inherits a constructor from Hotdog::Commands::BaseCommand

Instance Method Details

#run(args = []) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/hotdog/commands/rm.rb', line 6

def run(args=[])
  execute("    DELETE FROM hosts_tags\n      WHERE host_id IN\n        ( SELECT hosts_tags.host_id FROM hosts_tags\n            INNER JOIN hosts ON hosts_tags.host_id = hosts.id\n              WHERE hosts.name NOT IN (%s) );\n  EOS\nend\n" % args.map { "?" }.join(", "), args).map { |row| row.first }