Darky

yet another shell wrapper....

Syntax

 # Block
 Darky.new do |shell|
  shell['/usr/local'] do
    shell.exec "pwd" # "/usr/local"
  end
  shell.exec "pwd" # "/home/shuki"

  shell = shell['/usr/local']
  shell.exec "pwd" # "/usr/local"

  shell.chdir "/tmp" do
    shell.exec "pwd" # "/tmp"
  end
  shell.exec "pwd" # "/usr/local"

  shell.chdir! "/tmp"
  shell.exec "pwd" # "/tmp"
 end

 # Instance
 shell = Darky.new(:dir => '/tmp')
 shell.exec "pwd" # /tmp

 # By using shell.async, you can make calls asynchronously.
 obj = shell.async.ln_lrth # run `ls -lrth`
 obj.on_success { |resp| STDOUT.puts resp.out }
 obj.on_failure { |resp| STDOUT.puts response.err }

TODO

  • use send method to send commands + think about arguments
  • can be included to any class
  • support environment variables (sticky or non-sticky)
  • support eventmachine
  • support threads
  • support celluloid.io
  • support threads
  • support callbacks success, failure, or just .callback
  • exec without fork
  • support sudo prompt
  • exceptions - failure, permission denied
  • internal / external logger
  • logger should support filters, like ignore /shuki.*/
  • open4/3
  • timeout + handler
  • kill when using proxy object
  • save the state when using custom client
  • can be included into class - to describe a service