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,52 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ #http://www.gnu.org/software/coreutils/manual/coreutils.html#echo-invocation
7
+
8
+ lambda do |input|
9
+ allow_escapes=false
10
+ suppress_line=false
11
+ input.collect! do |arg|
12
+ md=/\A\-([eEn]+)\z/.match(arg)
13
+ if md
14
+ md[1].each_byte do |c|
15
+ c=c.chr
16
+ case c
17
+ when 'e'
18
+ allow_escapes=true
19
+ when 'E'
20
+ allow_escapes=false
21
+ when 'n'
22
+ suppress_line=true
23
+ end
24
+ end
25
+ end
26
+ md ? nil : arg
27
+ end
28
+ result=input.compact.join(' ')
29
+ if allow_escapes
30
+ result.gsub! '\\a',"\a"
31
+ result.gsub! '\\b',"\b"
32
+ suppress_line=result.gsub!('\\c','') or suppress_line
33
+ result.gsub! '\\f',"\f"
34
+ result.gsub! '\\n',"\n"
35
+ result.gsub! '\\r',"\r"
36
+ result.gsub! '\\t',"\t"
37
+ result.gsub! '\\f',"\f"
38
+ result.gsub! '\\\\','\\'
39
+ result.gsub!(/\\0([0-7]{0,3})/) do |match|
40
+ match[2..-1].to_i(8).chr
41
+ end
42
+ result.gsub!(/\\([0-7]{1,3})/) do |match|
43
+ match[1..-1].to_i(8).chr
44
+ end
45
+ result.gsub!(/\\x(\h{1,2})/) do |match|
46
+ match[2..-1].to_i(16).chr
47
+ end
48
+ end
49
+ result<<"\n" unless suppress_line
50
+ Naksh.buffer.print result
51
+ 0
52
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ require 'pathname'
7
+
8
+ lambda do |*a|
9
+ Naksh.buffer.pp(Pathname.new(Naksh.config['/env/pwd']).children.collect do |i|i.to_s;end)
10
+ 0
11
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ lambda do |input|
7
+ prompt_on_overwrite=true
8
+ raise NotImplementedError,'mv isn\'t finished yet, try again tomorrow'
9
+ raise NotImplementedError,'mv doesn\'t take options yet' unless input.length=2
10
+ pwd=Pathname.new Naksh.config['/evn/pwd']
11
+ original_location=(pwd+input[0]).realpath
12
+ destination= (pwd+input[1]).realpath
13
+ Pathname.new() original_location
14
+ 1
15
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ require 'pathname'
7
+
8
+ lambda do |*a|
9
+ Naksh.buffer.print(Naksh.config['/env/pwd']+"\n")
10
+ 0
11
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+
7
+
8
+ lambda do |input|
9
+ input.each do |path|
10
+ path=Naksh.evaluate_path(path)
11
+ Naksh.path<<Naksh::PathEntry.new(path) if path
12
+ end
13
+ 0
14
+ end
15
+
@@ -0,0 +1,10 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+
7
+
8
+ lambda do |*a|
9
+ Naksh.buffer.print('this file exists to provide a sample of a broken file')
10
+ en
@@ -0,0 +1,4 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
@@ -0,0 +1,10 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ # whatever you do here, don't require naksh, it caused a million errors
7
+
8
+ lambda do |input|
9
+ Naksh.quit ? 0 : 1
10
+ end
@@ -0,0 +1,21 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ lambda do |input|
7
+ case input[0]
8
+ when 'gtk'
9
+ gtk_help_file=File.new((Pathname.new(Naksh.config['/dir'])+'docs'+'gtk_manual.txt').to_s)
10
+ while line=gtk_help_file.gets
11
+ Naksh.buffer.puts line
12
+ end
13
+ when 'commands'
14
+ Naksh.buffer.pp %w[ls pwd cd echo cat help exit]
15
+ when 'parser'
16
+ Naksh.buffer.puts 'You should be able to use piping, escaping, quoting, and commenting. However, the current parser is not being actively developed at this time while it is being replaced by a formal grammar.'
17
+ else
18
+ Naksh.buffer.pp ['help gtk','help commands','help parser']
19
+ end
20
+ 0
21
+ end
@@ -0,0 +1,8 @@
1
+ #!/usr/local/bin/ruby
2
+ # 2011 Mahmut Bulut
3
+ # GPLv3
4
+ # This file is part of Naksh.
5
+
6
+ lambda do |input|
7
+ Naksh.send_command('help',input)
8
+ end
@@ -0,0 +1,31 @@
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
+ module Naksh
20
+ module CommandSets
21
+ #this is just the handful of methods defined in File,Dir,FileUtils,IO
22
+ module Ruby
23
+ def Ruby.mv(args)
24
+ raise NotImplementedError
25
+ end
26
+ def Ruby.mkdir(args)
27
+ raise NotImplementedError
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,131 @@
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
+ module Naksh
20
+ module CommandSets
21
+ #only what is written in the UNIX specification
22
+ module Unix
23
+ def Unix.hash(args=[])
24
+ raise NotImplementedError
25
+ end
26
+ def Unix.type(args=[])
27
+ raise NotImplementedError
28
+ end
29
+ #is it better to do octal excapes or literal characters?
30
+ #Nautilus (Gnome File Browser) uses different order
31
+ def Unix.sort(args=[])
32
+
33
+ unless options.empty? or options.keys==[:r]
34
+ nyp :option,__LINE__
35
+ end
36
+ begin
37
+ args.to_str
38
+ rescue
39
+ raise RuntimeError,"Unix.sort received nonstring #{args.inspect}"
40
+ end
41
+ #shy hyphen is before hard hyphen (doesn't show, but it's there)
42
+ #there's a lot of obscure characters here which no one will ever use, but I'm trying to understand the ordering system, so I won't need a list of every character'
43
+ result = sort_ordered_objects(args.split("\n"),((%w[´ ` ^ ¨ ~ ÷ < = > ¬ ¦ ° µ]<<' ').merge!(%w< _ ¯ ­ - , ; : ! ¡ ? ¿ . · ¸ ' " « » ( ) [ >)<<']').merge!(%w[{ } § ¶ © ® @ ¤ ¢ $ £ ¥ * & # % + ± ♵ ♳ ♿ ♻ ⚁ Ⓐ ⚀ ♼ ⚓ ⒈ ⒜ ⚃ ⚗ ⑴ ♺ ♹ ⚄ ♾ ⚅ ⚖ ♴ ⚕ ⁋ ♽ ⁉ ⚂ ① ⚒ ⁇ ⚘ ⚔ ⁈ ¼ ½ ¾ 0 1 ¹ 2 ² 3 ³ 4 5 6 7 8 9 Á À Â Å Ä Ã a A ª æ Æ b B c C d D e E f F g G h H i I j J k K l L m M n N o O º p P q Q r R s S ß t T u U v V w W x X y Y z Z]),:end).join("\n")
44
+ result.reverse! if options.has_key? :r
45
+ result
46
+ end
47
+ #responds to -a,-A
48
+ #accepts only strings
49
+ def Unix.ls(args=[])
50
+ #not ArgumentError because parameters are passed internally, external input is always a string
51
+ raise RuntimeError,"Unix.ls received nonstring #{working_dir.inspect}" unless working_dir.kind_of? String
52
+ working_dir=Pathname.new(working_dir)
53
+ unless working_dir.exist?
54
+ Naksh::Output.err.puts "ls: #{working_dir}: No such file or directory"
55
+ return Naksh::STOP_VALUE
56
+ end
57
+ return working_dir.to_s unless working_dir.directory?
58
+ if not options.empty?
59
+ return Unix.sort(working_dir.children.join("\n")) if options.keys==[:A]
60
+ return Unix.sort(working_dir.entries.join("\n")) if options.keys==[:a]
61
+ nyp :options,__LINE__
62
+ else
63
+ res=[]
64
+ working_dir.entries.each do |entry|
65
+ res<< entry unless /\A\./.match(entry)
66
+ end
67
+ return Unix.sort(res.join("\n"))
68
+ end
69
+ end
70
+ def Unix.cd(new_working_dir=Naksh::user_home_directory,options=nil)
71
+ new_working_dir=Pathname.new(new_working_dir)
72
+ if options
73
+ nyp :options,__LINE__
74
+ else
75
+ Windows::Directory.SetCurrentDirectory(new_working_dir.to_s) if $OS.contains('Windows')
76
+ #neither system('cd') nor Dir.chdir changes WinXP pwd outside this program
77
+ Dir.chdir(new_working_dir.to_s)
78
+ return Naksh::NO_RETURN
79
+ end
80
+ end
81
+ #finished
82
+ def Unix.pwd(options=false)
83
+ if options
84
+ Naksh::Output::err.puts('naksh: pwd accepts no arguments')
85
+ return Naksh::STOP_VALUE
86
+ end
87
+ Dir::pwd
88
+ end
89
+ def Unix.echo(str)
90
+ raise RuntimeError,"Unix.ls received nonstring #{working_dir.inspect}" unless working_dir.kind_of? String
91
+ str
92
+ end
93
+ def Unix.mkdir(new_directories,options=[])
94
+ new_directories.each do |new_directory_location|
95
+ if options.has_key?(:p)
96
+ Dir.mkpath(new_directory_location)
97
+ else
98
+ begin
99
+ Dir.mkdir(new_directory_location)
100
+ rescue
101
+ Naksh::Output::err.puts("mkdir: cannot create directory `#{new_directory_location}': parent directory do not exist")
102
+ return Naksh::STOP_VALUE
103
+ end
104
+ end
105
+ end
106
+ Naksh::NO_RETURN
107
+ end
108
+ def Unix.mv(file_to_be_moved,destination,options=nil)
109
+ if options
110
+ nyp :options,__LINE__
111
+ elsif not File.exists?(file_to_be_moved)
112
+ nyp :error,__LINE__
113
+ else
114
+ file_to_be_moved=Pathname.new(file_to_be_moved)
115
+ destination=Pathname.new(destination)
116
+ if destination.exists? and destination.directory?
117
+ if file_to_be_moved.dirname==destination.dirname
118
+ File.rename(file_to_be_moved.basename,destination.basename)
119
+ else
120
+ File.move(file_to_be_moved,destination)
121
+ end
122
+ else
123
+ File.move(file_to_be_moved,destination.dirname)
124
+ File.rename(destination.dirname+file_to_be_moved.basename,destination.basename)
125
+ end
126
+ end
127
+ Naksh::NO_RETURN
128
+ end
129
+ end
130
+ end
131
+ end
@@ -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 'gconf2'
20
+
21
+ module Naksh
22
+
23
+
24
+ @config=GConf::Client.default
25
+
26
+
27
+ class<<@config
28
+ alias_method :old_query, :[]
29
+ alias_method :old_setter,:[]=
30
+ def [](query_str)
31
+ raise TypeError unless query_str.class==String
32
+ old_query '/apps/naksh'<<query_str
33
+ end
34
+ def []=(key,new_value)
35
+ raise TypeError unless key.class==String
36
+ old_setter '/apps/naksh'<<key,new_value
37
+ end
38
+ end
39
+
40
+
41
+ # config is a gconf2 client
42
+ # it looks like a hash
43
+ # keys look like a UNIX file path
44
+
45
+ def Naksh.config
46
+ @config
47
+ end
48
+
49
+
50
+ end
51
+
@@ -0,0 +1,38 @@
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
+ module Naksh
20
+
21
+ class GConfStyleHash<Hash
22
+
23
+ def []= key,value
24
+ raise TypeError,'configuration keys can only be strings' unless key.class==String
25
+ raise ArgumentError,'keys must start with `/\'' unless key.match(/\A\//)
26
+ super key,value
27
+ end
28
+ end
29
+ @config=GConfStyleHash.new
30
+
31
+
32
+ def Naksh.config
33
+ @config
34
+ end
35
+
36
+
37
+ end
38
+
@@ -0,0 +1,40 @@
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 'pathname'
20
+
21
+ Naksh.config['/dir']= (Pathname.new(__FILE__)+'../../../').realpath.to_s
22
+ Naksh.config['/env/locale']= 'en'
23
+ Naksh.config['/meta/name']= 'Naksh'
24
+ Naksh.config['/meta/version']= '0.2.0'
25
+ Naksh.config['/meta/copyright']= 'Copyright 2011 Naksh Developers'
26
+ Naksh.config['/meta/license']= 'GNU GPL version 3 or later'
27
+ Naksh.config['/meta/website']= 'http://naksh.rubyforge.org/'
28
+ Naksh.config['/meta/releasetype']= 'developer'
29
+ Naksh.config['/meta/svn/revision']= `svn info`[/Revision: (\d+)/,1].to_i rescue -1
30
+ Naksh.config['/syntax/default']= 'bash'
31
+ Naksh.config['/interface/default']= 'gtk'
32
+ Naksh.config['/interface/gui/tabbar']= 'always'
33
+ Naksh.config['/interface/gui/statusbar']= true
34
+ Naksh.config['/interface/tty/wrap']= 'char'
35
+ Naksh.config['/interface/tty/prompt']= '%{user}@%{host}:%{pwd}$ '
36
+ Naksh.config['/interface/tty/cursor']= 'bar'
37
+ Naksh.config['/interface/tty/keys/tab']= 'autocomplete'
38
+ Naksh.config['/interface/tty/keys/alt_tab']= 'char'
39
+ Naksh.config['/interface/tty/keys/return']= 'submit'
40
+ Naksh.config['/interface/tty/keys/kp_enter']= 'autocomplete'