Module: Rye::Cmd

Included in:
Box
Defined in:
lib/rye/cmd.rb

Overview

Rye::Cmd

This class contains all of the shell command methods available to an instance of Rye::Box. For security and general safety, Rye only permits this whitelist of commands by default. However, you’re free to add methods with mixins.

require 'rye'
module Rye::Box::Cmd
  def special(*args); cmd("/your/special/command", args); end
end

rbox = Rye::Box.new('somehost')
rbox.special        # => "special on somehost"

Instance Method Summary collapse

Instance Method Details

#awk(*args) ⇒ Object



37
# File 'lib/rye/cmd.rb', line 37

def awk(*args); cmd('awk', args); end

#bash(*args) ⇒ Object



46
# File 'lib/rye/cmd.rb', line 46

def bash(*args); cmd('bash', args); end

#cat(*args) ⇒ Object



38
# File 'lib/rye/cmd.rb', line 38

def cat(*args); cmd('cat', args); end

#chmod(*args) ⇒ Object



56
# File 'lib/rye/cmd.rb', line 56

def chmod(*args); cmd('chmod', args); end

#cp(*args) ⇒ Object



22
# File 'lib/rye/cmd.rb', line 22

def cp(*args); cmd("cp", args); end

#cvs(*args) ⇒ Object



34
# File 'lib/rye/cmd.rb', line 34

def cvs(*args); cmd('cvs', args); end

#date(*args) ⇒ Object



43
# File 'lib/rye/cmd.rb', line 43

def date(*args); cmd('date', args); end

#df(*args) ⇒ Object



28
# File 'lib/rye/cmd.rb', line 28

def df(*args); cmd('df', args); end

#du(*args) ⇒ Object



29
# File 'lib/rye/cmd.rb', line 29

def du(*args); cmd('du', args); end

#echo(*args) ⇒ Object



47
# File 'lib/rye/cmd.rb', line 47

def echo(*args); cmd('echo', args); end

#env(*args) ⇒ Object



31
# File 'lib/rye/cmd.rb', line 31

def env(*args); cmd "env"; end

#exists?Boolean

def copy_to(*args)

args = [args].flatten.compact || []
other = args.pop
p other

end

Returns:

  • (Boolean)


81
82
83
# File 'lib/rye/cmd.rb', line 81

def exists?
  cmd("uptime");
end

#git(*args) ⇒ Object



35
# File 'lib/rye/cmd.rb', line 35

def git(*args); cmd('git', args); end

#grep(*args) ⇒ Object



42
# File 'lib/rye/cmd.rb', line 42

def grep(*args); cmd('grep', args); end

#history(*args) ⇒ Object



61
# File 'lib/rye/cmd.rb', line 61

def history(*args); cmd('history', args); end

#hostname(*args) ⇒ Object



63
# File 'lib/rye/cmd.rb', line 63

def hostname(*args); cmd('hostname', args); end

#ls(*args) ⇒ Object



24
# File 'lib/rye/cmd.rb', line 24

def ls(*args); cmd('ls', args); end

#mkdir(*args) ⇒ Object



53
# File 'lib/rye/cmd.rb', line 53

def mkdir(*args); cmd('mkdir', args); end

#mkfs(*args) ⇒ Object



49
# File 'lib/rye/cmd.rb', line 49

def mkfs(*args); cmd('mkfs', args); end

#mount(*args) ⇒ Object



51
# File 'lib/rye/cmd.rb', line 51

def mount(*args); cmd("mount", args); end

#mv(*args) ⇒ Object



23
# File 'lib/rye/cmd.rb', line 23

def mv(*args); cmd("mv", args); end

#perl(*args) ⇒ Object



45
# File 'lib/rye/cmd.rb', line 45

def perl(*args); cmd('perl', args); end

#printenv(*args) ⇒ Object



62
# File 'lib/rye/cmd.rb', line 62

def printenv(*args); cmd('printenv', args); end

#ps(*args) ⇒ Object

def rm(*args); cmd(‘rm’, args); end



26
# File 'lib/rye/cmd.rb', line 26

def ps(*args); cmd('ps', args); end

#pwd(*args) ⇒ Object



32
# File 'lib/rye/cmd.rb', line 32

def pwd(*args); cmd "pwd"; end

#python(*args) ⇒ Object



60
# File 'lib/rye/cmd.rb', line 60

def python(*args); cmd('python', args); end

#ruby(*args) ⇒ Object



44
# File 'lib/rye/cmd.rb', line 44

def ruby(*args); cmd('ruby', args); end

#sed(*args) ⇒ Object



36
# File 'lib/rye/cmd.rb', line 36

def sed(*args); cmd('sed', args); end

#sh(*args) ⇒ Object



27
# File 'lib/rye/cmd.rb', line 27

def sh(*args); cmd('sh', args); end

#sleep(seconds = 1) ⇒ Object



52
# File 'lib/rye/cmd.rb', line 52

def sleep(seconds=1); cmd("sleep", seconds); end

#sudo(*args) ⇒ Object

def kill(*args); cmd(‘kill’, args); end



41
# File 'lib/rye/cmd.rb', line 41

def sudo(*args); cmd('sudo', args); end

#svn(*args) ⇒ Object



33
# File 'lib/rye/cmd.rb', line 33

def svn(*args); cmd('svn', args); end

#test(*args) ⇒ Object



48
# File 'lib/rye/cmd.rb', line 48

def test(*args); cmd('test', args); end

#touch(*args) ⇒ Object



54
# File 'lib/rye/cmd.rb', line 54

def touch(*args); cmd('touch', args); end

#umount(*args) ⇒ Object



58
# File 'lib/rye/cmd.rb', line 58

def umount(*args); cmd("umount", args); end

#uname(*args) ⇒ Object



55
# File 'lib/rye/cmd.rb', line 55

def uname(*args); cmd('uname', args); end

#uptime(*args) ⇒ Object



59
# File 'lib/rye/cmd.rb', line 59

def uptime(*args); cmd("uptime", args); end

#wc(*args) ⇒ Object



21
# File 'lib/rye/cmd.rb', line 21

def wc(*args); cmd('wc', args); end