rwdtinker 1.83 → 1.84

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.
@@ -12,8 +12,7 @@ class RwdTinker < RWDialog
12
12
 
13
13
  @display= "idle"
14
14
  if TestNow
15
-
16
- rwdtest_harness
15
+ rwdtest_harness
17
16
  end
18
17
  showjumplinkoptions
19
18
  setuptinkerdocuments
@@ -1,71 +1,120 @@
1
1
  # test harness
2
2
 
3
3
 
4
- require 'test/unit/testcase'
5
- require 'test/unit/assertions'
6
- include Test::Unit::Assertions
7
- include Test::Unit
8
- def rwdtinker_all_tests
9
- print "in rwdtinker all tests\n"
10
- $testrwdtinkertestcase = TestSuite.new
11
- test_runrwdtinkerbackwindow
12
- end
13
-
14
- def test_runrwdtinkerbackwindow
15
-
16
4
 
17
- begin
18
- testasserts = 0
19
- print "Starting rwdtinker tests!\n"
5
+ def rwdtinker_all_tests
6
+ $rwdtinkerlog.info "in rwdtinker all tests"
7
+
8
+ $rwdtinkerlog.info "Starting rwdtinker tests!\n"
20
9
  runrwdtinkerbackwindow
21
-
22
- assert_equal("tinkerbackwindow",@rwd_window) ; testasserts += 1
23
- runselectiontab
24
- assert_equal("selectiontab",@rwd_tab) ; testasserts += 1
10
+
11
+ if "tinkerbackwindow" == @rwd_window
12
+ $testasserts += 1
13
+ else
14
+ $testfailures += 1
15
+ $testerrorarray << "runrwdtinkerbackwindow"
16
+ end
17
+
18
+ runselectiontab
19
+
20
+ if "selectiontab" == @rwd_tab
21
+ $testasserts += 1
22
+ else
23
+ $testfailures += 1
24
+ $testerrorarray << "selectiontab"
25
+ end
26
+
25
27
  showjumplinkoptions
26
28
  @a_jumplinkinput = "returntomain"
27
29
  runjumplinkcommand
28
- assert_equal("main",@rwd_window) ; testasserts += 1
30
+ if "main" == @rwd_window
31
+ $testasserts += 1
32
+ else
33
+ $testfailures += 1
34
+ $testerrorarray << "returntomain"
35
+ end
29
36
  @a_jumplinkinput = "helpscreen"
30
37
  runjumplinkcommand
31
38
 
32
- assert_equal("rwdtinkerhelpwindow",@rwd_window) ; testasserts += 1
33
- returntomain
34
- assert_equal("main",@rwd_window) ; testasserts += 1
39
+ if "rwdtinkerhelpwindow" == @rwd_window
40
+ $testasserts += 1
41
+ else
42
+ $testfailures += 1
43
+ $testerrorarray << "helpscreen"
44
+ end
45
+
35
46
  runtinkerdocuments
36
- assert_equal("documentsrwdtinkerone",@rwd_tab) ; testasserts += 1
37
- runrwdtinkerbackwindow
38
-
39
- assert_equal("tinkerbackwindow",@rwd_window) ; testasserts += 1
40
- @a_installapplet="/usr/src/rwdapplets/rwdtinker/zips/rwdahelloworld-0.5"
41
- viewgemappletcontents
42
- assert_not_nil(@appletcontentstext) ; testasserts += 1
43
- runrwdtinkerwin2version
44
- assert_equal("applicationversion",@rwd_window) ; testasserts += 1
45
- returntomain
46
- assert_equal("main",@rwd_window) ; testasserts += 1
47
- runrwdtinkerbackwindow
48
-
49
- assert_equal("tinkerbackwindow",@rwd_window) ; testasserts += 1
50
- runremotezipsinstall
51
- assert_equal("superantcomremotezipsinstall",@rwd_tab) ; testasserts += 1
52
- runeditconfiguration
53
- assert_equal("editconfigurationfile",@rwd_tab) ; testasserts += 1
54
-
55
-
56
- $stderr.print "tests completed succesfully!\n"
57
- $stderr.print testasserts, " asserts performed\n"
47
+ if "documentsrwdtinkerone" == @rwd_tab
48
+ $testasserts += 1
49
+ else
50
+ $testfailures += 1
51
+ $testerrorarray << "runtinkerdocuments"
52
+ end
58
53
 
59
- rescue NotImplementedError, Exception
60
- $stderr.print $!
61
54
 
62
- end
63
-
64
- end
55
+ runrwdtinkerwin2version
56
+ if "applicationversion" == @rwd_window
57
+ $testasserts += 1
58
+ else
59
+ $testfailures += 1
60
+ $testerrorarray << "runrwdtinkerwin2version"
61
+ end
65
62
 
63
+
64
+ runremotezipsinstall
65
+ if "superantcomremotezipsinstall" == @rwd_tab
66
+ $testasserts += 1
67
+ else
68
+ $testfailures += 1
69
+ $testerrorarray << "runremotezipsinstall"
70
+ end
66
71
 
72
+ runeditconfiguration
73
+ if "editconfigurationfile" == @rwd_tab
74
+ $testasserts += 1
75
+ else
76
+ $testfailures += 1
77
+ $testerrorarray << "runeditconfiguration"
78
+ end
79
+ runhelpwindowtinkerwin2
80
+
81
+ if @rwd_tab == "editconfigurationfile" && @rwdhelpdataoutput.include?("Remember to reload the configuration variables")
82
+ $testasserts += 1
83
+ else
84
+ $testfailures += 1
85
+ $testerrorarray << "applet_tinkerbackeditconfiguration"
86
+ end
87
+
88
+
89
+ rwd_jump("rwdlogfiletab", "rwd_tab_rwdlogfiletab")
90
+
91
+ if @rwd_tab == "rwdlogfiletab"
92
+ $testasserts += 1
93
+ else
94
+ $testfailures += 1
95
+ $testerrorarray << "rwdlogfiletab"
96
+ end
97
+
98
+ rwd_jump( "diagnostictab")
99
+ if @rwd_tab == "diagnostictab"
100
+ $testasserts += 1
101
+ else
102
+ $testfailures += 1
103
+ $testerrorarray << "diagnostictab"
104
+ end
105
+ end
106
+
107
+ def rwd_jump(tab, go="")
108
+ @rwd_tab = tab
109
+ @rwd_action = go
110
+ end
111
+
112
+ def teststobedown
113
+ runrwdtinkerbackwindow
114
+ @a_installapplet="/usr/src/rwdapplets/rwdtinker/zips/rwdahelloworld-0.5"
115
+ viewgemappletcontents
116
+ assert_not_nil(@appletcontentstext) ; testasserts += 1
67
117
 
68
- def teststobedown
69
118
  runtinkerhelpabout
70
119
  assert_equal("rwdtinkerhelpwindow",@rwd_tab) ; testasserts += 1
71
120
  raise NotImplementedError, 'Need to write test_choosenewhelptopic'
@@ -2,12 +2,19 @@
2
2
  def rwdtest_harness
3
3
 
4
4
  print "in test harness\n"
5
-
5
+ $testasserts = 0
6
+ $testerrorarray = [""]
7
+ $testfailures = 0
8
+
6
9
  $testharnessarray.each { |x|
7
10
  print "calling #{x}\n"
8
11
  eval("#{x}")
9
12
 
10
13
  }
14
+ $rwdtinkerlog.info "successes = #{$testasserts}"
15
+ $rwdtinkerlog.info "failures = #{$testfailures}"
16
+ $rwdtinkerlog.info "failed methods #{$testerrorarray}"
17
+ $rwdtinkerlog.info "tested methods #{$testharnessarray}"
11
18
 
12
19
  end
13
20
 
@@ -0,0 +1,84 @@
1
+
2
+ #***********************************************************************
3
+ #* Rwd/Tinker -- A Ruby program for the RudyWebDialog.
4
+ #* Copyright (c) 2004, 2005 by Steven Gibson. All Rights Reserved.
5
+ #*
6
+ #* This library is free software; you can redistribute it and/or
7
+ #* modify it under the terms of the GNU General Public
8
+ #* License as published by the Free Software Foundation; either
9
+ #* .
10
+ #*
11
+ #* These files are distributed in the hope that they will be useful,
12
+ #* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ #* General Public License for more details.
15
+ #*
16
+ #* You should have received a copy of the GNU General Public
17
+ #* License along with these files; if not, write to the Free Software
18
+ #* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ #*
20
+ #* For further information please contact the author by e-mail
21
+ #* at "smalllinux@gmail.com".
22
+ #***********************************************************************/
23
+
24
+ def runlocalechangercommand
25
+
26
+ $rwdtinkerlog.info "preparing to restart gui"
27
+
28
+ $lang = @a_localechooseinput # pick the language of choice
29
+
30
+ tempdoc = " "
31
+
32
+ Dir.chdir($progdir) # change back to top program directory
33
+
34
+
35
+ # build the English Language hash file from the parts
36
+
37
+
38
+ require 'lib/rwdtinker/rwdlangdir'
39
+
40
+ tempdoc = " "
41
+ #go get all the po language file files in english
42
+ tempdoc = RwdtinkerTools.findlanguagefiles(LangDir,"en")
43
+
44
+ #writes the contents of doc into the languagehashvariable
45
+ languagehashvariable = tempdoc
46
+
47
+ # END of en Lang building
48
+ tempdoc = " "
49
+ Dir.chdir($progdir) # change back to top program directory
50
+
51
+ # build the local Language hash file from the parts
52
+
53
+
54
+
55
+ # Go get all the po files for the language of choice
56
+ tempdoc = RwdtinkerTools.findlanguagefiles(LangDir,$lang)
57
+ # the contents of doc into the variable
58
+ languagehashvariable = languagehashvariable + tempdoc
59
+
60
+ Dir.chdir($progdir) # change back to top program directory
61
+
62
+ # lets read those po files, first english then the chosen language
63
+ temp = eval( languagehashvariable )
64
+
65
+
66
+
67
+
68
+ # build the actual GUI from the gui parts
69
+ require 'lib/rwdtinker/rwdguidir'
70
+
71
+ tempdoc = RwdtinkerTools.findguifiles(GuiDir)
72
+
73
+
74
+ # gui variable is done
75
+ guiRWD = ""
76
+ $rwd_gui_tinker = tempdoc
77
+
78
+ $rwdtinkerlog.info "restarting gui now"
79
+
80
+ RWDWindow.new($rwd_gui_tinker, @rwd_window).render("DEFAULT")
81
+
82
+ end
83
+
84
+
@@ -23,7 +23,9 @@ def runhelpwindowtinkerwin2
23
23
  if @rwd_tab == "superantcomremotezipsinstall"
24
24
  $help_topic = "remotegemapplet_install"
25
25
  end
26
-
26
+ if @rwd_tab == "localechangertab"
27
+ $help_topic = "localechanger_help"
28
+ end
27
29
 
28
30
  if @rwd_window != "rwdtinkerhelpwindow"
29
31
  $previouswindow = @rwd_window
@@ -0,0 +1,9 @@
1
+ # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
+ # help about option setup for rwdtinker application
3
+
4
+
5
+ def showlocalechoicesoptions
6
+
7
+ @localechooseoptions = $langarray.rwd_options
8
+ end
9
+
@@ -1,4 +1,4 @@
1
- ##VERSION: (1.83)
1
+ ##VERSION: (1.84)
2
2
  ConfigurationDir = "configuration" # for use in program - init.rb has this value without using this constant
3
3
  CodeName = "rwdtinker"
4
4
  CodeNameFile = CodeName + ".rb"
@@ -10,6 +10,6 @@ LangDir = "lang"
10
10
  $prevouswindow ="main"
11
11
  $rwdcontrolports =["13713","13714","13715","13716"] # remote control code not actived 2007
12
12
  $port = 7705
13
- ##NAME: (RwdTinkerVersion):(1.83)
14
- RwdTinkerVersion = "1.83"
13
+ ##NAME: (RwdTinkerVersion):(1.84)
14
+ RwdTinkerVersion = "1.84"
15
15
 
@@ -1,4 +1,4 @@
1
- ##VERSION: (1.82)
1
+ ##VERSION: (1.84)
2
2
  TinkerWin2ConfigurationFileName = "tinkerwin2variables.cnf" # this file name - do not change
3
3
  ##NAME: ($zipslocation):(1.78)
4
4
  $zipslocation = "zips" # location of applets to add
@@ -3,9 +3,7 @@ $rwdguivar=
3
3
  <window name=\"main\" title=\"RwdTinker - Webdialogs for Ruby\">
4
4
  <tabs>"
5
5
 
6
- __END__
7
6
 
8
- =begin
9
- Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
10
- This is the first part of the window for the core application
11
- =end
7
+ #Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
8
+ #This is the first part of the window for the core application
9
+
@@ -0,0 +1,17 @@
1
+ $rwdguivar=
2
+ "
3
+ <tab name=localechangertab caption=#{Message[:localechangertablabel]}>
4
+ <horizontal>
5
+ <button caption=#{Message[:tinkercoreshowlocale_choices]} action=\"showlocalechoicesoptions\"/>
6
+ <button caption=#{Message[:help]} action=\"runhelpwindowtinkerwin2\"/>
7
+ </horizontal>
8
+ <table>
9
+ <select name=\"a_localechooseinput\"> %%localechooseoptions%% </select>
10
+
11
+ </table>
12
+
13
+ <horizontal>
14
+ <button caption=#{Message[:tinkercorechangelocale]} action=\"runlocalechangercommand\"/>
15
+ </horizontal>
16
+ </tab>
17
+ "
@@ -66,6 +66,12 @@ msgid "file_name"
66
66
  msgid "listzipdirappletsavailable"
67
67
  msgstr '"List (zip directory) applets available for installation"'
68
68
 
69
+ msgid "localechangertablabel"
70
+ msgstr '"Locale Changer"'
71
+
72
+ msgid "locale_changer_help"
73
+ msgstr "You can change the locale on this tab<br>Click on Show Locale Choices to fill in the pull down options<br>When you click on Change Locale Now the entire GUI will be reloaded"
74
+
69
75
  msgid "menu_panel"
70
76
  msgstr '"Menu Panel"'
71
77
 
@@ -129,6 +135,12 @@ msgid "selection_panel"
129
135
  msgid "selection_tab"
130
136
  msgstr '"Menu Tab"'
131
137
 
138
+ msgid "tinkercoreshowlocale_choices"
139
+ msgstr '"Show Locale Choices"'
140
+
141
+ msgid "tinkercorechangelocale"
142
+ msgstr '"Change Locale Now"'
143
+
132
144
  msgid "tinker_logo"
133
145
  msgstr '"Tinker Logo"'
134
146
 
@@ -173,7 +185,7 @@ msgstr '"View Install Text"'
173
185
  rwdapplications. On the front screen you can view
174
186
  documents and make menu choices. On the back
175
187
  screen you will find:<p>
176
- You can work with Applets: go to 'Selection tab', <br>
188
+ You can work with Applets: go to Selection tab, <br>
177
189
  On that back screen you will find:<br>
178
190
  List Applets: you can see and delete installed applets<br>
179
191
  List Zips: you can see lists of applets that you can install<br>
@@ -135,6 +135,12 @@ msgstr '"Panel de Selección"'
135
135
  msgid "tinker_logo"
136
136
  msgstr '"Insignia de Tinker"'
137
137
 
138
+ msgid "tinkercorechangelocale"
139
+ msgstr '"Cambiar localización ahora"'
140
+
141
+ msgid "tinkercoreshowlocale_choices"
142
+ msgstr '"Mostrar opciones de localización"'
143
+
138
144
  msgid "selection_tab"
139
145
  msgstr '"Tab de Selección"'
140
146
 
data/lib/zip/ioextras.rb CHANGED
@@ -1,4 +1,16 @@
1
- module IOExtras
1
+ module IOExtras #:nodoc:
2
+
3
+ CHUNK_SIZE = 32768
4
+
5
+ RANGE_ALL = 0..-1
6
+
7
+ def self.copy_stream(ostream, istream)
8
+ s = ''
9
+ ostream.write(istream.read(CHUNK_SIZE, s)) until istream.eof?
10
+ end
11
+
12
+
13
+ # Implements kind_of? in order to pretend to be an IO object
2
14
  module FakeIO
3
15
  def kind_of?(object)
4
16
  object == IO || super
@@ -20,6 +32,34 @@ module IOExtras
20
32
 
21
33
  attr_accessor :lineno
22
34
 
35
+ def read(numberOfBytes = nil, buf = nil)
36
+ tbuf = nil
37
+
38
+ if @outputBuffer.length > 0
39
+ if numberOfBytes <= @outputBuffer.length
40
+ tbuf = @outputBuffer.slice!(0, numberOfBytes)
41
+ else
42
+ numberOfBytes -= @outputBuffer.length if (numberOfBytes)
43
+ rbuf = sysread(numberOfBytes, buf)
44
+ tbuf = @outputBuffer
45
+ tbuf << rbuf if (rbuf)
46
+ @outputBuffer = ""
47
+ end
48
+ else
49
+ tbuf = sysread(numberOfBytes, buf)
50
+ end
51
+
52
+ return nil unless (tbuf)
53
+
54
+ if buf
55
+ buf.replace(tbuf)
56
+ else
57
+ buf = tbuf
58
+ end
59
+
60
+ buf
61
+ end
62
+
23
63
  def readlines(aSepString = $/)
24
64
  retVal = []
25
65
  each_line(aSepString) { |line| retVal << line }
@@ -66,7 +106,8 @@ module IOExtras
66
106
  end
67
107
 
68
108
 
69
- #relies on <<
109
+ # Implements many of the output convenience methods of IO.
110
+ # relies on <<
70
111
  module AbstractOutputStream
71
112
  include FakeIO
72
113