init.rb in rwdshell-0.95 vs init.rb in rwdshell-0.96

- old
+ new

@@ -49,12 +49,13 @@ a.each do |x| #adjust the filters to the files you want to see... if(!test(?d,x)) # only rwd files if x =~ /rb|rwd|txt/ - load x #opens the file thats in fileName and reads it - $tempdoc += $rwdguivar # adds the file into the doc string + + load x #opens the file thats in fileName and reads it + $tempdoc += $rwdguivar # adds the file into the doc string end end end end @@ -71,10 +72,12 @@ # END of configuration reading Dir.chdir($progdir) # change back to top program directory # build the English Language hash file from the parts + languagehashvariable = 'Message = Hash.new { |hh, kk| hh[kk] = "ERROR: Message not found: #{kk.inspect}."; hh[kk] } + langmessage = {' + "\n" startlangdir = File.join(LangDir,"en") #get a list of the files and subdirectories on the starting directory only alanghash = Array.new(Dir[startlangdir].entries.sort) #loop through the list, ignore the files and add all new directories found alanghash.each do |x| @@ -98,14 +101,15 @@ else #it is a directory... findfiles(x + "/**") end end - fileLangHash=File.open(TempLangHashFile,"w") #deletes and opens a the file in fileName - fileLangHash.write($tempdoc) #writes the contents of doc into the file - fileLangHash.close - # END of Lang building + + #writes the contents of doc into the languagehashvariable + languagehashvariable = languagehashvariable + $tempdoc + "} ; langmessage.each { |kk, vv| Message[kk] = vv }" + + # END of en Lang building $tempdoc = " " Dir.chdir($progdir) # change back to top program directory # build the local Language hash file from the parts startlangdir = File.join(LangDir,$lang) @@ -133,36 +137,21 @@ else #it is a directory... findfiles(x + "/**") end end - filelocalLangHash=File.open(LocalLangHashFile,"w") #deletes and opens a the file in fileName - filelocalLangHash.write($tempdoc) #writes the contents of doc into the file - filelocalLangHash.close + + #writes the contents of doc into the variable + languagehashvariable = languagehashvariable + " ; Message.update(" + $tempdoc + ' :rwdtinker => "Rwdtinker" ) ' + $tempdoc = " " Dir.chdir($progdir) # change back to top program directory + + temp = eval( languagehashvariable ) - # build the language hash constant object from the lang parts - #get a list of the files in lang directory only - alangfile = Dir.new(LangDir).entries.sort.reverse.delete_if { |x| ! (x =~ /rb$/) } - alangfile.length.times{ - fileName = alangfile.pop - Dir.chdir($progdir) - Dir.chdir(LangDir) - fileLangA=File.open("#{fileName}","r") #opens the file thats in fileName as read only - $tempdoc += fileLangA.read #reads the file into the doc string - fileLangA.close - } - -Dir.chdir($progdir) - fileLangB=File.open(LangNameFile,"w") #deletes and opens a the file in fileName - fileLangB.write($tempdoc) #writes the contents of doc into the file - fileLangB.close - load LangNameFile # load the file - $tempdoc = " " # build the actual program from the code parts #get a list of the files and subdirectories on the starting directory only a = Array.new(Dir[CodeDir].entries.sort) @@ -188,15 +177,14 @@ else #it is a directory... findfiles(x + "/**") end end - fileB=File.open(CodeNameFile,"w") #deletes and opens a the file in fileName - fileB.write($tempdoc) #writes the contents of doc into the file - fileB.close - require CodeName # load the program file +# load the program file + tempcoderesult = eval( $tempdoc ) + # build the actual GUI from the gui parts $tempdoc = " " #get a list of the files and subdirectories on the starting directory only a = Array.new(Dir[GuiDir].entries.sort) #loop through the list, ignore the files and add all new directories found @@ -222,13 +210,12 @@ else #it is a directory... loadguifile(x + "/**") end end - fileB=File.open(RWDFile,"w") #deletes and opens a the file in fileName - fileB.write($tempdoc) #writes the contents of doc into the file - fileB.close + # gui variable is done + guiRWD = $tempdoc require 'socket' # Network stuff host = "127.0.0.1" port = $port @@ -264,6 +251,6 @@ end end -RwdTinker.file(RWDFile).serve(port) # start the main class and program +RwdTinker.new( guiRWD).serve(port) # start the main class and program