naksh 0.2.0

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.
Files changed (137) hide show
  1. data/AUTHORS +1 -0
  2. data/COPYING +674 -0
  3. data/COPYING-DOCS +15 -0
  4. data/README.md +45 -0
  5. data/Rakefile +129 -0
  6. data/TODO +19 -0
  7. data/bin/naksh +2 -0
  8. data/data/default.mo +0 -0
  9. data/data/default.po +16 -0
  10. data/data/default2.mo +0 -0
  11. data/data/default2.po +27 -0
  12. data/data/starter.pot +29 -0
  13. data/docs/bash_flow.dia +0 -0
  14. data/docs/gtk_manual.txt +13 -0
  15. data/docs/master_plan.dia +0 -0
  16. data/docs/master_plan.png +0 -0
  17. data/docs/master_plan.svg +74 -0
  18. data/docs/master_plan.svgz +0 -0
  19. data/docs/userguide/en/about.xml +42 -0
  20. data/docs/userguide/en/gnu-fdl-1.2.xml +543 -0
  21. data/docs/userguide/en/naksh.xml +881 -0
  22. data/docs/userguide/en/naksh_start_window.png +0 -0
  23. data/docs/userguide/en/old_naksh.xml +180 -0
  24. data/docs/userguide/en/userguide-en.omf +37 -0
  25. data/lib/naksh.rb +165 -0
  26. data/lib/naksh/buffer.rb +153 -0
  27. data/lib/naksh/command_handling.rb +117 -0
  28. data/lib/naksh/commands/bash/README +2 -0
  29. data/lib/naksh/commands/bash/echo.nkc.rb +50 -0
  30. data/lib/naksh/commands/bsd.rb +25 -0
  31. data/lib/naksh/commands/dos.rb +25 -0
  32. data/lib/naksh/commands/fuse.rb +25 -0
  33. data/lib/naksh/commands/gnu.rb +30 -0
  34. data/lib/naksh/commands/gnu/README +2 -0
  35. data/lib/naksh/commands/gnu/cat.nkc.rb +50 -0
  36. data/lib/naksh/commands/gnu/cd.nkc.rb +11 -0
  37. data/lib/naksh/commands/gnu/echo.documentation.json +57 -0
  38. data/lib/naksh/commands/gnu/echo.documentation.rb +60 -0
  39. data/lib/naksh/commands/gnu/echo.nkc.rb +52 -0
  40. data/lib/naksh/commands/gnu/ls.nkc.rb +11 -0
  41. data/lib/naksh/commands/gnu/mv.nkc.rb +15 -0
  42. data/lib/naksh/commands/gnu/pwd.nkc.rb +11 -0
  43. data/lib/naksh/commands/naksh/addpath.nkc.rb +15 -0
  44. data/lib/naksh/commands/naksh/broken.nkc.rb +10 -0
  45. data/lib/naksh/commands/naksh/empty.nkc.rb +4 -0
  46. data/lib/naksh/commands/naksh/exit.nkc.rb +10 -0
  47. data/lib/naksh/commands/naksh/help.nkc.rb +21 -0
  48. data/lib/naksh/commands/naksh/man.nkc.rb +8 -0
  49. data/lib/naksh/commands/ruby.rb +31 -0
  50. data/lib/naksh/commands/unix.rb +131 -0
  51. data/lib/naksh/configuration/gconf.rb +51 -0
  52. data/lib/naksh/configuration/hash.rb +38 -0
  53. data/lib/naksh/defaults.rb +40 -0
  54. data/lib/naksh/history.rb +85 -0
  55. data/lib/naksh/interfaces.rb +59 -0
  56. data/lib/naksh/interfaces/fox.rb +49 -0
  57. data/lib/naksh/interfaces/gtk.rb +103 -0
  58. data/lib/naksh/interfaces/gtk/abtwin.rb +53 -0
  59. data/lib/naksh/interfaces/gtk/gnomeapp.rb +31 -0
  60. data/lib/naksh/interfaces/gtk/helpwin.rb +70 -0
  61. data/lib/naksh/interfaces/gtk/io.rb +94 -0
  62. data/lib/naksh/interfaces/gtk/mainwin.rb +56 -0
  63. data/lib/naksh/interfaces/gtk/mainwin/console.rb +121 -0
  64. data/lib/naksh/interfaces/gtk/mainwin/main_menu.rb +143 -0
  65. data/lib/naksh/interfaces/gtk/optwin.rb +78 -0
  66. data/lib/naksh/interfaces/tab.rb +58 -0
  67. data/lib/naksh/interfaces/wxw.rb +75 -0
  68. data/lib/naksh/interfaces/wxw/abtwin.rb +38 -0
  69. data/lib/naksh/interfaces/wxw/helpwin.rb +40 -0
  70. data/lib/naksh/interfaces/wxw/io.rb +61 -0
  71. data/lib/naksh/interfaces/wxw/mainwin.rb +42 -0
  72. data/lib/naksh/interfaces/wxw/mainwin/main_menu.rb +126 -0
  73. data/lib/naksh/interfaces/wxw/mainwin/sessions.rb +49 -0
  74. data/lib/naksh/interfaces/wxw/optwin.rb +37 -0
  75. data/lib/naksh/path_entry.rb +101 -0
  76. data/lib/naksh/regexp.rb +31 -0
  77. data/lib/naksh/session.rb +72 -0
  78. data/lib/naksh/stdlibext.rb +48 -0
  79. data/lib/naksh/syntax.rb +57 -0
  80. data/lib/naksh/syntax/bash.rb +219 -0
  81. data/lib/naksh/syntax/bash/antlr/bottomup.g +24 -0
  82. data/lib/naksh/syntax/bash/antlr/topdown.g +52 -0
  83. data/lib/naksh/syntax/bash/dhaka/evaluator.rb +353 -0
  84. data/lib/naksh/syntax/bash/dhaka/grammar.rb +71 -0
  85. data/lib/naksh/syntax/bash/dhaka/lexer.rb +52 -0
  86. data/lib/naksh/syntax/bash/treetop/bash.treetop +17 -0
  87. data/lib/old/abbr_call.rb +39 -0
  88. data/lib/old/autocomplete.rb +29 -0
  89. data/lib/old/command.rb +106 -0
  90. data/lib/old/command_holder.rb +75 -0
  91. data/lib/old/commands.rb +24 -0
  92. data/lib/old/old_executor.rb +95 -0
  93. data/lib/old/options.rb +31 -0
  94. data/lib/old/rush.rb +113 -0
  95. data/lib/old/sortissimo.rb +205 -0
  96. data/lib/old/systems.rb +25 -0
  97. data/lib/old/systems/ruby.rb +26 -0
  98. data/lib/old/un.rb +240 -0
  99. data/lib/rust/Rakefile +6 -0
  100. data/lib/rust/commands/builtins.rb +46 -0
  101. data/lib/rust/commands/builtins/cd.rb +17 -0
  102. data/lib/rust/commands/builtins/exit.rb +13 -0
  103. data/lib/rust/commands/builtins/help.rb +14 -0
  104. data/lib/rust/commands/builtins/parser.rb +13 -0
  105. data/lib/rust/commands/builtins/pwd.rb +13 -0
  106. data/lib/rust/commands/builtins/type.rb +13 -0
  107. data/lib/rust/commands/commands/ls.rb +13 -0
  108. data/lib/rust/commands/commands/read.rb +13 -0
  109. data/lib/rust/commands/commands/rm.rb +14 -0
  110. data/lib/rust/commands/commands/test.rb +20 -0
  111. data/lib/rust/helpers/array.rb +10 -0
  112. data/lib/rust/helpers/command_center.rb +78 -0
  113. data/lib/rust/helpers/constants.rb +58 -0
  114. data/lib/rust/helpers/io.rb +132 -0
  115. data/lib/rust/helpers/parser.rb +45 -0
  116. data/lib/rust/helpers/rush_control.rb +40 -0
  117. data/lib/rust/helpers/string.rb +50 -0
  118. data/lib/rust/helpers/trollop.rb +475 -0
  119. data/lib/rust/parsers/bash.rb +220 -0
  120. data/lib/rust/parsers/bash/stdlibext.rb +32 -0
  121. data/lib/rust/parsers/ren.rb +57 -0
  122. data/lib/rust/rust.rb +75 -0
  123. data/lib/rust/syntax/command.rb +23 -0
  124. data/lib/rust/syntax/paths.rb +31 -0
  125. data/lib/rust/syntax/pipes.rb +148 -0
  126. data/naksh.gemspec +55 -0
  127. data/test/naksh/arg_parser.rspec.rb +27 -0
  128. data/test/naksh/commands/bash/echo.rspec.rb +32 -0
  129. data/test/naksh/commands/sortlist +127 -0
  130. data/test/naksh/external_command.rspec.rb +46 -0
  131. data/test/naksh/send_error.rspec.rb +60 -0
  132. data/test/naksh/suggest.rspec.rb +38 -0
  133. data/test/naksh/syntax/bash.rspec.rb +69 -0
  134. data/test/naksh/syntax/bash/execute.rspec.rb +51 -0
  135. data/test/naksh/syntax/rspec.rb +63 -0
  136. data/test/run_rspecs.rb +20 -0
  137. metadata +217 -0
@@ -0,0 +1,51 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'spec'
20
+
21
+ #for the InterpretedSyntaxError
22
+ require 'naksh/syntax/bash/errors.rb'
23
+
24
+
25
+ # this file is for general parsing tests,
26
+ # not specific parser parts
27
+
28
+ # the tests regarding errors fail miserably,
29
+ # Bash currently uses Naksh.send_error,
30
+ # but Naksh should catch it's errors,
31
+ # Bash should still throw them
32
+
33
+ describe 'Naksh::Syntax::Bash.execute'
34
+
35
+ pending 'switching the error handling to raise/resccue'
36
+
37
+ it 'should throw an InterpretedSyntaxError if there are multiple semicolons' do
38
+ lambda do;Naksh::Syntax::Bash.execute('echo ;;');end.should raise_error(InterpretedSyntaxError)
39
+ lambda do;Naksh::Syntax::Bash.execute('echo "hey" | cat ;;;');end.should raise_error(InterpretedSyntaxError)
40
+ end
41
+
42
+ it 'should throw an InterpretedSyntaxError if there is a pipe followed by a semicolon' do
43
+ lambda do;Naksh::Syntax::Bash.execute('echo |;');end.should raise_error(InterpretedSyntaxError)
44
+ lambda do;Naksh::Syntax::Bash.execute('echo "hey" | cat |;');end.should raise_error(InterpretedSyntaxError)
45
+ end
46
+
47
+ it 'should throw an InterpretedSyntaxError if a pipe character is used as a command' do
48
+ lambda do;Naksh::Syntax::Bash.execute('echo ;|');end.should raise_error(InterpretedSyntaxError)
49
+ lambda do;Naksh::Syntax::Bash.execute('|');end.should raise_error(InterpretedSyntaxError)
50
+ end
51
+ end
@@ -0,0 +1,63 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require 'spec'
20
+
21
+ describe Naksh do
22
+ before :all do
23
+ sample_syntax=Object.new
24
+ class<<sample_syntax
25
+ def initialize(key)
26
+ @key=key
27
+ end
28
+ attr_reader :key,:execute,:try_execute,'complete?'.intern
29
+ end
30
+ end
31
+
32
+ it 'should provide access to the current syntax' do
33
+ (Naksh.methods.include? :syntax).should be_true
34
+ end
35
+
36
+ it 'should allow modification of the current syntax' do
37
+ lambda do
38
+ Naksh.syntax=sample_syntax
39
+ end.should_not raise_error
40
+ Naksh.syntax.should ==sample_syntax
41
+ end
42
+
43
+ end
44
+
45
+
46
+
47
+ describe Naksh.syntax do
48
+
49
+
50
+ it 'should have a complete? method' do
51
+ (Naksh.syntax.methods.include? 'complete?'.intern).should be_true
52
+ end
53
+
54
+ it 'should have a try_execute method' do
55
+ (Naksh.syntax.methods.include? 'complete?'.intern).should be_true
56
+ end
57
+
58
+ it 'should have an execute method' do
59
+ (Naksh.syntax.methods.include? :execute).should be_true
60
+ end
61
+
62
+
63
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+
4
+ # This file is part of Naksh.
5
+ #
6
+ # Naksh is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Naksh is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Naksh. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require './../lib/naksh/syntax/bash.rb'
20
+ require 'naksh/syntax/bash.rspec.rb'
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: naksh
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 0
10
+ version: 0.2.0
11
+ platform: ruby
12
+ authors:
13
+ - Mahmut Bulut
14
+ autorequire: lib/naksh.rb
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-08-09 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: gettext
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description:
35
+ email: scienceblock@gmail.com
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - README.md
42
+ files:
43
+ - AUTHORS
44
+ - bin/naksh
45
+ - COPYING
46
+ - COPYING-DOCS
47
+ - data/default.mo
48
+ - data/default.po
49
+ - data/default2.mo
50
+ - data/default2.po
51
+ - data/starter.pot
52
+ - docs/bash_flow.dia
53
+ - docs/gtk_manual.txt
54
+ - docs/master_plan.dia
55
+ - docs/master_plan.png
56
+ - docs/master_plan.svg
57
+ - docs/master_plan.svgz
58
+ - docs/userguide/en/about.xml
59
+ - docs/userguide/en/gnu-fdl-1.2.xml
60
+ - docs/userguide/en/naksh.xml
61
+ - docs/userguide/en/naksh_start_window.png
62
+ - docs/userguide/en/old_naksh.xml
63
+ - docs/userguide/en/userguide-en.omf
64
+ - lib/naksh/buffer.rb
65
+ - lib/naksh/command_handling.rb
66
+ - lib/naksh/commands/bash/echo.nkc.rb
67
+ - lib/naksh/commands/bash/README
68
+ - lib/naksh/commands/bsd.rb
69
+ - lib/naksh/commands/dos.rb
70
+ - lib/naksh/commands/fuse.rb
71
+ - lib/naksh/commands/gnu/cat.nkc.rb
72
+ - lib/naksh/commands/gnu/cd.nkc.rb
73
+ - lib/naksh/commands/gnu/echo.documentation.json
74
+ - lib/naksh/commands/gnu/echo.documentation.rb
75
+ - lib/naksh/commands/gnu/echo.nkc.rb
76
+ - lib/naksh/commands/gnu/ls.nkc.rb
77
+ - lib/naksh/commands/gnu/mv.nkc.rb
78
+ - lib/naksh/commands/gnu/pwd.nkc.rb
79
+ - lib/naksh/commands/gnu/README
80
+ - lib/naksh/commands/gnu.rb
81
+ - lib/naksh/commands/naksh/addpath.nkc.rb
82
+ - lib/naksh/commands/naksh/broken.nkc.rb
83
+ - lib/naksh/commands/naksh/empty.nkc.rb
84
+ - lib/naksh/commands/naksh/exit.nkc.rb
85
+ - lib/naksh/commands/naksh/help.nkc.rb
86
+ - lib/naksh/commands/naksh/man.nkc.rb
87
+ - lib/naksh/commands/ruby.rb
88
+ - lib/naksh/commands/unix.rb
89
+ - lib/naksh/configuration/gconf.rb
90
+ - lib/naksh/configuration/hash.rb
91
+ - lib/naksh/defaults.rb
92
+ - lib/naksh/history.rb
93
+ - lib/naksh/interfaces/fox.rb
94
+ - lib/naksh/interfaces/gtk/abtwin.rb
95
+ - lib/naksh/interfaces/gtk/gnomeapp.rb
96
+ - lib/naksh/interfaces/gtk/helpwin.rb
97
+ - lib/naksh/interfaces/gtk/io.rb
98
+ - lib/naksh/interfaces/gtk/mainwin/console.rb
99
+ - lib/naksh/interfaces/gtk/mainwin/main_menu.rb
100
+ - lib/naksh/interfaces/gtk/mainwin.rb
101
+ - lib/naksh/interfaces/gtk/optwin.rb
102
+ - lib/naksh/interfaces/gtk.rb
103
+ - lib/naksh/interfaces/tab.rb
104
+ - lib/naksh/interfaces/wxw/abtwin.rb
105
+ - lib/naksh/interfaces/wxw/helpwin.rb
106
+ - lib/naksh/interfaces/wxw/io.rb
107
+ - lib/naksh/interfaces/wxw/mainwin/main_menu.rb
108
+ - lib/naksh/interfaces/wxw/mainwin/sessions.rb
109
+ - lib/naksh/interfaces/wxw/mainwin.rb
110
+ - lib/naksh/interfaces/wxw/optwin.rb
111
+ - lib/naksh/interfaces/wxw.rb
112
+ - lib/naksh/interfaces.rb
113
+ - lib/naksh/path_entry.rb
114
+ - lib/naksh/regexp.rb
115
+ - lib/naksh/session.rb
116
+ - lib/naksh/stdlibext.rb
117
+ - lib/naksh/syntax/bash/antlr/bottomup.g
118
+ - lib/naksh/syntax/bash/antlr/topdown.g
119
+ - lib/naksh/syntax/bash/dhaka/evaluator.rb
120
+ - lib/naksh/syntax/bash/dhaka/grammar.rb
121
+ - lib/naksh/syntax/bash/dhaka/lexer.rb
122
+ - lib/naksh/syntax/bash/treetop/bash.treetop
123
+ - lib/naksh/syntax/bash.rb
124
+ - lib/naksh/syntax.rb
125
+ - lib/naksh.rb
126
+ - lib/old/abbr_call.rb
127
+ - lib/old/autocomplete.rb
128
+ - lib/old/command.rb
129
+ - lib/old/command_holder.rb
130
+ - lib/old/commands.rb
131
+ - lib/old/old_executor.rb
132
+ - lib/old/options.rb
133
+ - lib/old/rush.rb
134
+ - lib/old/sortissimo.rb
135
+ - lib/old/systems/ruby.rb
136
+ - lib/old/systems.rb
137
+ - lib/old/un.rb
138
+ - lib/rust/commands/builtins/cd.rb
139
+ - lib/rust/commands/builtins/exit.rb
140
+ - lib/rust/commands/builtins/help.rb
141
+ - lib/rust/commands/builtins/parser.rb
142
+ - lib/rust/commands/builtins/pwd.rb
143
+ - lib/rust/commands/builtins/type.rb
144
+ - lib/rust/commands/builtins.rb
145
+ - lib/rust/commands/commands/ls.rb
146
+ - lib/rust/commands/commands/read.rb
147
+ - lib/rust/commands/commands/rm.rb
148
+ - lib/rust/commands/commands/test.rb
149
+ - lib/rust/helpers/array.rb
150
+ - lib/rust/helpers/command_center.rb
151
+ - lib/rust/helpers/constants.rb
152
+ - lib/rust/helpers/io.rb
153
+ - lib/rust/helpers/parser.rb
154
+ - lib/rust/helpers/rush_control.rb
155
+ - lib/rust/helpers/string.rb
156
+ - lib/rust/helpers/trollop.rb
157
+ - lib/rust/parsers/bash/stdlibext.rb
158
+ - lib/rust/parsers/bash.rb
159
+ - lib/rust/parsers/ren.rb
160
+ - lib/rust/Rakefile
161
+ - lib/rust/rust.rb
162
+ - lib/rust/syntax/command.rb
163
+ - lib/rust/syntax/paths.rb
164
+ - lib/rust/syntax/pipes.rb
165
+ - naksh.gemspec
166
+ - Rakefile
167
+ - README.md
168
+ - test/naksh/arg_parser.rspec.rb
169
+ - test/naksh/commands/bash/echo.rspec.rb
170
+ - test/naksh/commands/sortlist
171
+ - test/naksh/external_command.rspec.rb
172
+ - test/naksh/send_error.rspec.rb
173
+ - test/naksh/suggest.rspec.rb
174
+ - test/naksh/syntax/bash/execute.rspec.rb
175
+ - test/naksh/syntax/bash.rspec.rb
176
+ - test/naksh/syntax/rspec.rb
177
+ - test/run_rspecs.rb
178
+ - TODO
179
+ homepage: http://github.com/regularlambda/naksh
180
+ licenses: []
181
+
182
+ post_install_message:
183
+ rdoc_options:
184
+ - --title
185
+ - Naksh
186
+ - --main
187
+ - README.md
188
+ - --line-numbers
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
200
+ required_rubygems_version: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ hash: 3
206
+ segments:
207
+ - 0
208
+ version: "0"
209
+ requirements: []
210
+
211
+ rubyforge_project: naksh
212
+ rubygems_version: 1.8.5
213
+ signing_key:
214
+ specification_version: 3
215
+ summary: Nodal Associative Knowledge Shell
216
+ test_files:
217
+ - test/run_rspecs.rb