THERuSH 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/therush.rb +112 -0
- data/doc/classes/Builtin.html +175 -0
- data/doc/classes/Builtin.src/M000005.html +44 -0
- data/doc/classes/Builtin.src/M000006.html +44 -0
- data/doc/classes/Builtin.src/M000007.html +44 -0
- data/doc/classes/History.html +223 -0
- data/doc/classes/History.src/M000006.html +28 -0
- data/doc/classes/History.src/M000007.html +28 -0
- data/doc/classes/History.src/M000008.html +37 -0
- data/doc/classes/Shellfuncs.html +261 -0
- data/doc/classes/Shellfuncs.src/M000002.html +18 -0
- data/doc/classes/Shellfuncs.src/M000003.html +23 -0
- data/doc/classes/Shellfuncs.src/M000004.html +27 -0
- data/doc/classes/Shellfuncs.src/M000005.html +23 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +14 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +30 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_2.dot +30 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +30 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/m_1_0.dot +30 -0
- data/doc/dot/m_1_0.png +0 -0
- data/doc/dot/m_2_0.dot +30 -0
- data/doc/dot/m_2_0.png +0 -0
- data/doc/dot/m_3_0.dot +30 -0
- data/doc/dot/m_3_0.png +0 -0
- data/doc/files/builtins_rb.html +107 -0
- data/doc/files/builtins_rb.src/M000007.html +44 -0
- data/doc/files/history_rb.html +108 -0
- data/doc/files/rubyshell_rb.html +188 -0
- data/doc/files/rubyshell_rb.src/M000001.html +41 -0
- data/doc/files/rubyshell_rb.src/M000002.html +25 -0
- data/doc/files/rubyshell_rb.src/M000003.html +41 -0
- data/doc/files/rubyshell_rb.src/M000004.html +28 -0
- data/doc/files/rubyshell_rb.src/M000005.html +41 -0
- data/doc/files/rubyshell_rb.src/M000006.html +28 -0
- data/doc/files/rubyshell_rb.src/M000007.html +28 -0
- data/doc/files/shellfuncs_rb.html +121 -0
- data/doc/fr_class_index.html +29 -0
- data/doc/fr_file_index.html +30 -0
- data/doc/fr_method_index.html +34 -0
- data/doc/index.html +24 -0
- data/lib/builtins.rb +39 -0
- data/lib/history.rb +48 -0
- data/lib/shellfuncs.rb +57 -0
- metadata +101 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Classes
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Classes</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Classes</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/Builtin.html">Builtin</a><br />
|
24
|
+
<a href="classes/History.html">History</a><br />
|
25
|
+
<a href="classes/Shellfuncs.html">Shellfuncs</a><br />
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Files
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Files</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Files</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="files/builtins_rb.html">builtins.rb</a><br />
|
24
|
+
<a href="files/history_rb.html">history.rb</a><br />
|
25
|
+
<a href="files/rubyshell_rb.html">rubyshell.rb</a><br />
|
26
|
+
<a href="files/shellfuncs_rb.html">shellfuncs.rb</a><br />
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</body>
|
30
|
+
</html>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
3
|
+
<!DOCTYPE html
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
6
|
+
|
7
|
+
<!--
|
8
|
+
|
9
|
+
Methods
|
10
|
+
|
11
|
+
-->
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
13
|
+
<head>
|
14
|
+
<title>Methods</title>
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
17
|
+
<base target="docwin" />
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<div id="index">
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
22
|
+
<div id="index-entries">
|
23
|
+
<a href="classes/Builtin.html#M000006">chDir (Builtin)</a><br />
|
24
|
+
<a href="classes/Shellfuncs.html#M000005">commandRun (Shellfuncs)</a><br />
|
25
|
+
<a href="classes/Shellfuncs.html#M000003">envUpdate (Shellfuncs)</a><br />
|
26
|
+
<a href="classes/History.html#M000007">histAdd (History)</a><br />
|
27
|
+
<a href="classes/History.html#M000008">histCmd (History)</a><br />
|
28
|
+
<a href="classes/Shellfuncs.html#M000004">inPath (Shellfuncs)</a><br />
|
29
|
+
<a href="files/rubyshell_rb.html#M000001">mathMethod (rubyshell.rb)</a><br />
|
30
|
+
<a href="classes/Shellfuncs.html#M000002">promptPrint (Shellfuncs)</a><br />
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
5
|
+
|
6
|
+
<!--
|
7
|
+
|
8
|
+
RDoc Documentation
|
9
|
+
|
10
|
+
-->
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
12
|
+
<head>
|
13
|
+
<title>RDoc Documentation</title>
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
15
|
+
</head>
|
16
|
+
<frameset rows="20%, 80%">
|
17
|
+
<frameset cols="25%,35%,45%">
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
21
|
+
</frameset>
|
22
|
+
<frame src="files/rubyshell_rb.html" name="docwin" />
|
23
|
+
</frameset>
|
24
|
+
</html>
|
data/lib/builtins.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# The library of builtin functions for THERuSH
|
3
|
+
|
4
|
+
module Builtin
|
5
|
+
|
6
|
+
## Handles the cd builtin
|
7
|
+
def chDir( dir )
|
8
|
+
|
9
|
+
## Only enabled if invoked with -d
|
10
|
+
if $DEBUG
|
11
|
+
if !dir.nil?
|
12
|
+
puts "DEBUGGING VALUES: dir: " + dir + " at Line #{__LINE__} in #{__FILE__}"
|
13
|
+
elsif dir.nil?
|
14
|
+
puts "DEBUGGING VALUES: dir: nil at Line #{__LINE__} in #{__FILE__}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if dir.nil? || dir == "~"
|
19
|
+
Dir.chdir( ENV["HOME"] )
|
20
|
+
elsif dir.index("/") == 0 ## Means we were passed an absolute pathname
|
21
|
+
if FileTest.directory?( dir )
|
22
|
+
Dir.chdir( dir )
|
23
|
+
else
|
24
|
+
puts dir + " does not exist"
|
25
|
+
end
|
26
|
+
elsif dir == "." || dir == ".." ## Special Case that doesn't need checking
|
27
|
+
Dir.chdir( dir )
|
28
|
+
else ## Relative pathname
|
29
|
+
if FileTest.directory?( dir )
|
30
|
+
Dir.chdir( dir )
|
31
|
+
else
|
32
|
+
puts dir + " does not exist"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
|
data/lib/history.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Handles the History functions for THERuSH
|
3
|
+
|
4
|
+
module History
|
5
|
+
|
6
|
+
## The Array with the history commands
|
7
|
+
HISTORY = Array[]
|
8
|
+
|
9
|
+
## Adds things to the history array ignoring duplicates
|
10
|
+
def histAdd( cmd )
|
11
|
+
if $DEBUG
|
12
|
+
puts "DEBUGGING VALUES: cmd: " + cmd + " at Line #{__LINE__} in #{__FILE__}"
|
13
|
+
end
|
14
|
+
|
15
|
+
if !HISTORY.include?( cmd )
|
16
|
+
HISTORY.push( cmd )
|
17
|
+
end
|
18
|
+
|
19
|
+
if $DEBUG
|
20
|
+
puts "DEBUGGING VALUES: HISTORY: " + HISTORY.join( " , ") + " at Line #{__LINE__} in #{__FILE__}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
## Handles History Addition (!h)
|
25
|
+
def histCmd( hist )
|
26
|
+
if $DEBUG
|
27
|
+
if hist.nil?
|
28
|
+
puts "DEBUGGING VALUES: hist: nil at Line #{__LINE__} in #{__FILE__}"
|
29
|
+
else
|
30
|
+
puts "DEBUGGING VALUES: hist: " + hist + " at Line #{__LINE__} in #{__FILE__}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if hist.nil? ## Just entering !h will print out the array
|
35
|
+
HISTORY.each do | entry |
|
36
|
+
puts HISTORY.index( entry ).to_s + ": " + entry
|
37
|
+
end
|
38
|
+
else
|
39
|
+
hist = hist.to_i
|
40
|
+
if HISTORY.at( hist ).nil?
|
41
|
+
puts "Invalid history reference"
|
42
|
+
else
|
43
|
+
system( "#{HISTORY.at( hist )}" )
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
data/lib/shellfuncs.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Misc shell functions for THERuSH
|
3
|
+
|
4
|
+
require 'history.rb'
|
5
|
+
include History
|
6
|
+
|
7
|
+
module Shellfuncs
|
8
|
+
|
9
|
+
## Variable containing the Working Directory
|
10
|
+
$cwd = Dir.pwd
|
11
|
+
|
12
|
+
## Variable containing the Prompt
|
13
|
+
$prompt = Dir.pwd + "> "
|
14
|
+
|
15
|
+
## The PATH
|
16
|
+
$path = %w{ /bin /sbin /usr/bin /usr/sbin /usr/local/bin}
|
17
|
+
|
18
|
+
## Prints out the prompt
|
19
|
+
def promptPrint
|
20
|
+
print "#{$prompt}".chomp
|
21
|
+
end
|
22
|
+
|
23
|
+
## Updates Environment Variables and the prompt
|
24
|
+
def envUpdate
|
25
|
+
$cwd = Dir.pwd
|
26
|
+
$prompt = $cwd + "> "
|
27
|
+
|
28
|
+
if $DEBUG
|
29
|
+
puts "DEBUGGING VALUES: CWD: " + $cwd + " PROMPT: " + $prompt + " at Line #{__LINE__} in #{__FILE__}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
## Checks cmd to see if its in the PATH
|
34
|
+
def inPath( cmd )
|
35
|
+
if $DEBUG
|
36
|
+
puts "DEBUGGING VALUES: cmd: " + cmd + " at Line #{__LINE__} in #{__FILE__}"
|
37
|
+
end
|
38
|
+
|
39
|
+
$path.each do | dir | ## For every entry in the PATH
|
40
|
+
if File.exist?( dir + "/" + cmd )
|
41
|
+
return true
|
42
|
+
end
|
43
|
+
end
|
44
|
+
return false
|
45
|
+
end
|
46
|
+
|
47
|
+
## Runs the command from the command line and pushes it onto the stack
|
48
|
+
def commandRun( cmd )
|
49
|
+
if $DEBUG
|
50
|
+
puts "DEBUGGING VALUES: cmd: " + cmd.join(" ") + " at Line #{__LINE__} in #{__FILE__}"
|
51
|
+
end
|
52
|
+
|
53
|
+
system( "#{cmd.join(' ')}" )
|
54
|
+
History.histAdd( "#{cmd.join(' ')}" )
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: THERuSH
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: "0.9"
|
7
|
+
date: 2006-10-18 00:00:00 -04:00
|
8
|
+
summary: A System Shell Written In Ruby
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: petermcv@clarkson.edu
|
12
|
+
homepage: www.azuredreams.us
|
13
|
+
rubyforge_project: therush
|
14
|
+
description:
|
15
|
+
autorequire: therush.rb
|
16
|
+
default_executable: therush.rb
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "1.8"
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Chris Peterman
|
31
|
+
files:
|
32
|
+
- bin/therush.rb
|
33
|
+
- doc/files
|
34
|
+
- doc/dot
|
35
|
+
- doc/classes
|
36
|
+
- doc/fr_file_index.html
|
37
|
+
- doc/fr_method_index.html
|
38
|
+
- doc/created.rid
|
39
|
+
- doc/fr_class_index.html
|
40
|
+
- doc/index.html
|
41
|
+
- doc/files/builtins_rb.src
|
42
|
+
- doc/files/rubyshell_rb.src
|
43
|
+
- doc/files/builtins_rb.html
|
44
|
+
- doc/files/rubyshell_rb.html
|
45
|
+
- doc/files/history_rb.html
|
46
|
+
- doc/files/shellfuncs_rb.html
|
47
|
+
- doc/files/builtins_rb.src/M000007.html
|
48
|
+
- doc/files/rubyshell_rb.src/M000001.html
|
49
|
+
- doc/files/rubyshell_rb.src/M000002.html
|
50
|
+
- doc/files/rubyshell_rb.src/M000003.html
|
51
|
+
- doc/files/rubyshell_rb.src/M000004.html
|
52
|
+
- doc/files/rubyshell_rb.src/M000005.html
|
53
|
+
- doc/files/rubyshell_rb.src/M000006.html
|
54
|
+
- doc/files/rubyshell_rb.src/M000007.html
|
55
|
+
- doc/dot/m_2_0.png
|
56
|
+
- doc/dot/m_1_0.dot
|
57
|
+
- doc/dot/m_3_0.png
|
58
|
+
- doc/dot/m_2_0.dot
|
59
|
+
- doc/dot/m_3_0.dot
|
60
|
+
- doc/dot/f_0.png
|
61
|
+
- doc/dot/f_1.png
|
62
|
+
- doc/dot/f_0.dot
|
63
|
+
- doc/dot/f_2.png
|
64
|
+
- doc/dot/f_1.dot
|
65
|
+
- doc/dot/f_3.png
|
66
|
+
- doc/dot/f_2.dot
|
67
|
+
- doc/dot/f_3.dot
|
68
|
+
- doc/dot/m_1_0.png
|
69
|
+
- doc/classes/History.src
|
70
|
+
- doc/classes/Builtin.src
|
71
|
+
- doc/classes/Shellfuncs.src
|
72
|
+
- doc/classes/History.html
|
73
|
+
- doc/classes/Builtin.html
|
74
|
+
- doc/classes/Shellfuncs.html
|
75
|
+
- doc/classes/History.src/M000006.html
|
76
|
+
- doc/classes/History.src/M000007.html
|
77
|
+
- doc/classes/History.src/M000008.html
|
78
|
+
- doc/classes/Builtin.src/M000005.html
|
79
|
+
- doc/classes/Builtin.src/M000006.html
|
80
|
+
- doc/classes/Builtin.src/M000007.html
|
81
|
+
- doc/classes/Shellfuncs.src/M000002.html
|
82
|
+
- doc/classes/Shellfuncs.src/M000003.html
|
83
|
+
- doc/classes/Shellfuncs.src/M000004.html
|
84
|
+
- doc/classes/Shellfuncs.src/M000005.html
|
85
|
+
- lib/builtins.rb
|
86
|
+
- lib/shellfuncs.rb
|
87
|
+
- lib/history.rb
|
88
|
+
test_files: []
|
89
|
+
|
90
|
+
rdoc_options: []
|
91
|
+
|
92
|
+
extra_rdoc_files: []
|
93
|
+
|
94
|
+
executables:
|
95
|
+
- therush.rb
|
96
|
+
extensions: []
|
97
|
+
|
98
|
+
requirements:
|
99
|
+
- GNU Readline
|
100
|
+
dependencies: []
|
101
|
+
|