cbrain icon indicating copy to clipboard operation
cbrain copied to clipboard

Create and document old and new console tools

Open prioux opened this issue 9 years ago • 2 comments

We've got a bunch of utilities deployed, and utilities planned, that are worthwhile additions to the rails console environment. We need to document them in the wiki, and within the console. Some need rewriting.

Create new Bourreau status and control utility:

Will replace ALL of this within a curse-based interactive tool:

  • cycle_bb
  • bb_bash
  • Bourreau.console and Bourreau#console
  • ps_work
  • ps_bb

Interface will present:

  • list of Bourreau by name
  • one-keystroke selection/deselection of bourreaux to affect (by number?)
  • what operation(s) to perform (status. command, start, stop, start worker, stop workers etc)

Other utils:

  • do_log
  • no_log
  • cu
  • cp

New utils:

  • hl ("how long")
# scratch version
def hl
  s = Time.now
  r =yield
  f = Time.now
  puts r.inspect
  puts "Time taken: #{f-s}"
end
  • shl ("SQL how long")
# Todo: accept ActiveRecord::Relation in argument too
# Todo: show table in nice format like mysql shell does
def shl(sql)
  hl do 
    x=ActiveRecord::Base.connection.execute(sql)
    ([x.fields] + x.to_a).each do |r|
      puts r.inspect
    end
  end
end

prioux avatar Jun 10 '15 19:06 prioux

80% done.

prioux avatar Jan 25 '16 21:01 prioux

Document in Wiki.

prioux avatar Jan 25 '16 21:01 prioux