rwdshell 0.97 → 0.98

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/Readme.txt +6 -0
  2. data/code/01rwdcore/01rwdcore.rb +4 -2
  3. data/code/01rwdcore/test_cases.rb +126 -0
  4. data/code/01rwdcore/test_harness.rb +15 -0
  5. data/code/01rwdcore/uploadreturns.rb +62 -0
  6. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +14 -10
  7. data/configuration/language.dist +1 -1
  8. data/configuration/rwdapplicationidentity.dist +2 -2
  9. data/configuration/rwdshell.dist +2 -2
  10. data/configuration/rwdtinker.dist +2 -2
  11. data/configuration/tinkerwin2variables.dist +1 -1
  12. data/extras/zip/ioextras.rb +114 -0
  13. data/extras/zip/stdrubyext.rb +111 -0
  14. data/extras/zip/tempfile_bugfixed.rb +195 -0
  15. data/extras/zip/zip.rb +1377 -0
  16. data/extras/zip/zipfilesystem.rb +558 -0
  17. data/extras/zip/ziprequire.rb +61 -0
  18. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
  19. data/gui/tinkerbackwindows/superant.com.rwdshellbackwindow/46editscriptrecord.rwd +5 -5
  20. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +12 -16
  21. data/init.rb +3 -0
  22. data/rwd_files/HowTo_Shell.txt +4 -0
  23. data/rwd_files/HowTo_Tinker.txt +14 -0
  24. data/rwdconfig.dist +6 -2
  25. data/tests/makedist.rb +16 -1
  26. metadata +12 -17
  27. data/extras/cmdline_parse +0 -47
  28. data/extras/config_file +0 -69
  29. data/extras/errorMsg +0 -19
  30. data/extras/makePlaylist +0 -34
  31. data/extras/mp3controld +0 -289
  32. data/extras/playlist +0 -186
  33. data/extras/showHelp +0 -18
  34. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
  35. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
  36. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
  37. data/installed/rwdtinkerwin2-0.5.inf +0 -8
data/Readme.txt CHANGED
@@ -193,7 +193,13 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
193
193
  Thanks, Steven Gibson
194
194
 
195
195
  == Changelog
196
+ version 0.98
197
+ updated for rwdtinker version 1.61
198
+ add in test harness
199
+
196
200
  version 0.97
201
+ correct bug in shell command eval
202
+ beginning to add context help
197
203
  updated for rwdtinker version 1.58
198
204
  added rconftool use to update configuration files
199
205
  changed applets removal to not use external rm
@@ -7,11 +7,13 @@
7
7
  class RwdTinker < RWDialog
8
8
 
9
9
  def main
10
- @rwd_window = "main"
10
+ @rwd_window = "main"
11
11
  @result = "idle"
12
12
  @display= "idle"
13
-
13
+ if TestNow
14
14
 
15
+ rwdtest_harness
16
+ end
15
17
  end
16
18
 
17
19
  def inspect
@@ -0,0 +1,126 @@
1
+ # test harness
2
+ def rwdtinker_all_tests
3
+ print "in rwdtinker all tests\n"
4
+ test_runrwdtinkerbackwindow
5
+ end
6
+
7
+
8
+ def test_runrwdtinkerbackwindow
9
+
10
+ require 'test/unit'
11
+ begin
12
+
13
+ runrwdtinkerbackwindow
14
+
15
+ raise NotImplementedError, 'Need to write test_runrwdtinkerbackwindow'
16
+
17
+ rescue NotImplementedError
18
+ $stderr.print $!
19
+
20
+ end
21
+ end
22
+
23
+
24
+
25
+ def test_choosenewhelptopic
26
+ raise NotImplementedError, 'Need to write test_choosenewhelptopic'
27
+ end
28
+
29
+
30
+ def test_listinstalledfiles
31
+ raise NotImplementedError, 'Need to write test_listinstalledfiles'
32
+ end
33
+
34
+
35
+ def test_listzipfilestoinstall
36
+ raise NotImplementedError, 'Need to write test_listzipfilestoinstall'
37
+ end
38
+
39
+ def test_loadconfigurationrecord
40
+ raise NotImplementedError, 'Need to write test_loadconfigurationrecord'
41
+ end
42
+
43
+ def test_loadconfigurationvariables
44
+ raise NotImplementedError, 'Need to write test_loadconfigurationvariables'
45
+ end
46
+
47
+ def test_loadgemspecrecord
48
+ raise NotImplementedError, 'Need to write test_loadgemspecrecord'
49
+ end
50
+
51
+ def test_loadrubyslippersconfiguration
52
+ raise NotImplementedError, 'Need to write test_loadrubyslippersconfiguration'
53
+ end
54
+
55
+ def test_loadrubyslippersconfigurationvariables
56
+ raise NotImplementedError, 'Need to write test_loadrubyslippersconfigurationvariables'
57
+ end
58
+
59
+ def test_main
60
+ raise NotImplementedError, 'Need to write test_main'
61
+ end
62
+
63
+ def test_network_demon
64
+ raise NotImplementedError, 'Need to write test_network_demon'
65
+ end
66
+
67
+ def test_network_start
68
+ raise NotImplementedError, 'Need to write test_network_start'
69
+ end
70
+
71
+ def test_openappletname
72
+ raise NotImplementedError, 'Need to write test_openappletname'
73
+ end
74
+
75
+ def test_removeapplet
76
+ raise NotImplementedError, 'Need to write test_removeapplet'
77
+ end
78
+
79
+ def test_returntomain
80
+ raise NotImplementedError, 'Need to write test_returntomain'
81
+ end
82
+
83
+ def test_runcontrolcommand
84
+ raise NotImplementedError, 'Need to write test_runcontrolcommand'
85
+ end
86
+
87
+
88
+ def test_runhelpwindow
89
+ raise NotImplementedError, 'Need to write test_runhelpwindow'
90
+ end
91
+
92
+
93
+
94
+
95
+ def test_runrwdtinkerversion
96
+ raise NotImplementedError, 'Need to write test_runrwdtinkerversion'
97
+ end
98
+
99
+ def test_runrwdtinkerwin2version
100
+ raise NotImplementedError, 'Need to write test_runrwdtinkerwin2version'
101
+ end
102
+
103
+ def test_runviewplatform
104
+ raise NotImplementedError, 'Need to write test_runviewplatform'
105
+ end
106
+
107
+ def test_rwdtinkerversiondiagnostic
108
+ raise NotImplementedError, 'Need to write test_rwdtinkerversiondiagnostic'
109
+ end
110
+
111
+ def test_rwdwindowreturn
112
+ raise NotImplementedError, 'Need to write test_rwdwindowreturn'
113
+ end
114
+
115
+ def test_saveconfigurationrecord
116
+ raise NotImplementedError, 'Need to write test_saveconfigurationrecord'
117
+ end
118
+
119
+
120
+ def test_viewappletcontents
121
+ raise NotImplementedError, 'Need to write test_viewappletcontents'
122
+ end
123
+
124
+
125
+
126
+
@@ -0,0 +1,15 @@
1
+ # this to start the test harness
2
+ def rwdtest_harness
3
+
4
+ print "in test harness\n"
5
+ $testharnessarray.each { |x|
6
+ print "calling #{x}\n"
7
+ eval("#{x}")
8
+
9
+ }
10
+
11
+ end
12
+
13
+
14
+
15
+
@@ -0,0 +1,62 @@
1
+ def uploadreturnsfile
2
+ require 'net/ftp'
3
+ BasicSocket.do_not_reverse_lookup = true
4
+ @returnsftpdisplays = ""
5
+ randomnumber = rand(9999) + 1000
6
+ puts randomnumber.to_i
7
+
8
+
9
+ returns_ftpsite = "ftp.superant.com"
10
+ returns_ftplogin = "anonymous@superant.com"
11
+ returns_ftppassword = "anonymous@superant.com"
12
+ returns_ftpdirectory = "/incoming/returns/"
13
+
14
+ begin
15
+ platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
16
+ platformdisplay = platformdisplay + "Ruby Version " + VERSION + "\n"
17
+ platformdisplay = platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
18
+ platformdisplay = platformdisplay + "application name " + $rwdapplicationidentity + "\n"
19
+ platformdisplay = platformdisplay + "program directory " + $progdir + "\n"
20
+ platformdisplay = platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
21
+ platformdisplay = platformdisplay + "Date " + Date.today().to_s + "\n"
22
+ if ! @a_emailupload.empty?
23
+ platformdisplay = platformdisplay + @a_emailupload + "\n"
24
+ end
25
+ if ! @a_emailupload.empty?
26
+ platformdisplay = platformdisplay + @a_commentupload + "\n"
27
+ end
28
+ updatefile = Date.today().to_s + Resolv.getname(Resolv.getaddress("localhost")) + randomnumber.to_s
29
+
30
+ tmpdir = ENV['TMP']
31
+ if tmpdir.to_s.empty?
32
+ tmpdir = "/tmp"
33
+ end
34
+ fileName = File.join( tmpdir, updatefile)
35
+ fd = File.open(fileName,"w")
36
+ fd.print(platformdisplay) # save the record info to the file
37
+ fd.close
38
+ ftp = Net::FTP::new(returns_ftpsite)
39
+ @returnsftpdisplay = "data uploaded" + "\n"
40
+
41
+ filedirname = File.join(tmpdir,updatefile)
42
+
43
+ ftp.debug_mode = false
44
+ ftp.login(returns_ftplogin, returns_ftppassword)
45
+ ftp.chdir(returns_ftpdirectory)
46
+ print "I'm in the directory ", ftp.pwd(), "\n"
47
+
48
+ puts filedirname
49
+ ftp.puttextfile(filedirname , updatefile)
50
+ @returnsftpdisplay = @returnsftpdisplay + platformdisplay
51
+
52
+
53
+ ftp.close
54
+
55
+ rescue
56
+ @returnsftpdisplay = "upload error"
57
+ if ftp
58
+ ftp.close
59
+ end
60
+ print "ftp error"
61
+ end
62
+ end
@@ -3,19 +3,23 @@
3
3
  # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
4
  # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
5
 
6
- # return the Ruby constant
7
- def runrubyversion
8
- @rubyversion = "Version " + VERSION
9
- end
6
+
7
+
8
+
9
+ require 'resolv'
10
+ require 'date'
10
11
 
11
- # return the platform constan
12
+ # return the platform information
12
13
  def runviewplatform
13
- @platformdisplay = "Platform is " + RUBY_PLATFORM
14
+ @platformdisplay = "Platform is " + RUBY_PLATFORM + "\n"
15
+ @platformdisplay = @platformdisplay + "Ruby Version " + VERSION + "\n"
16
+ @platformdisplay = @platformdisplay + "rwdtinker version " + RwdTinkerVersion + "\n"
17
+ @platformdisplay = @platformdisplay + "program directory " + $progdir + "\n"
18
+ @platformdisplay = @platformdisplay + "hostname " + Resolv.getname(Resolv.getaddress("localhost")) + "\n"
19
+ @platformdisplay = @platformdisplay + "application name " + $rwdapplicationidentity + "\n"
20
+ @platformdisplay = @platformdisplay + "Date " + Date.today().to_s
21
+
14
22
  end
15
23
 
16
- # return Rwdtinker version to diagnostic tab
17
- def rwdtinkerversiondiagnostic
18
- @rwdtinkerversionreturn = "rwdtinker version " + RwdTinkerVersion
19
- end
20
24
 
21
25
 
@@ -1,4 +1,4 @@
1
- ##VERSION:1.57
1
+ ##VERSION:1.61
2
2
  #language selection file
3
3
  ##NAME:$lang:0
4
4
  #$lang = "jp"
@@ -1,3 +1,3 @@
1
- ##VERSION:1.58
2
- $rwdapplicationidentity = "rwdshell application"
1
+ ##VERSION:1.61
2
+ $rwdapplicationidentity = "rwdtinker main application"
3
3
 
@@ -1,3 +1,3 @@
1
- ##VERSION:0.97
1
+ ##VERSION:0.98
2
2
  $shellscript_directory = "scripts"
3
- RwdShellVersion = "0.97"
3
+ RwdShellVersion = "0.98"
@@ -1,4 +1,4 @@
1
- ##VERSION:1.58
1
+ ##VERSION:1.61
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"
@@ -12,4 +12,4 @@ LangDir = "lang"
12
12
  $rwdcontrolports =["13713","13714","13715","13716","13717","13718"]
13
13
  $port = 7705
14
14
 
15
- RwdTinkerVersion = "1.58"
15
+ RwdTinkerVersion = "1.61"
@@ -1,4 +1,4 @@
1
- ##VERSION:1.57
1
+ ##VERSION:1.61
2
2
  TinkerWin2ConfigurationFileName = "tinkerwin2variables.cnf" # this file name - do not change
3
3
  ##NAME:$zipslocation:0
4
4
  $zipslocation = "zips" # location of applets to add
@@ -0,0 +1,114 @@
1
+ module IOExtras
2
+ module FakeIO
3
+ def kind_of?(object)
4
+ object == IO || super
5
+ end
6
+ end
7
+
8
+ # Implements many of the convenience methods of IO
9
+ # such as gets, getc, readline and readlines
10
+ # depends on: input_finished?, produce_input and read
11
+ module AbstractInputStream
12
+ include Enumerable
13
+ include FakeIO
14
+
15
+ def initialize
16
+ super
17
+ @lineno = 0
18
+ @outputBuffer = ""
19
+ end
20
+
21
+ attr_accessor :lineno
22
+
23
+ def readlines(aSepString = $/)
24
+ retVal = []
25
+ each_line(aSepString) { |line| retVal << line }
26
+ return retVal
27
+ end
28
+
29
+ def gets(aSepString=$/)
30
+ @lineno = @lineno.next
31
+ return read if aSepString == nil
32
+ aSepString="#{$/}#{$/}" if aSepString == ""
33
+
34
+ bufferIndex=0
35
+ while ((matchIndex = @outputBuffer.index(aSepString, bufferIndex)) == nil)
36
+ bufferIndex=@outputBuffer.length
37
+ if input_finished?
38
+ return @outputBuffer.empty? ? nil : flush
39
+ end
40
+ @outputBuffer << produce_input
41
+ end
42
+ sepIndex=matchIndex + aSepString.length
43
+ return @outputBuffer.slice!(0...sepIndex)
44
+ end
45
+
46
+ def flush
47
+ retVal=@outputBuffer
48
+ @outputBuffer=""
49
+ return retVal
50
+ end
51
+
52
+ def readline(aSepString = $/)
53
+ retVal = gets(aSepString)
54
+ raise EOFError if retVal == nil
55
+ return retVal
56
+ end
57
+
58
+ def each_line(aSepString = $/)
59
+ while true
60
+ yield readline(aSepString)
61
+ end
62
+ rescue EOFError
63
+ end
64
+
65
+ alias_method :each, :each_line
66
+ end
67
+
68
+
69
+ #relies on <<
70
+ module AbstractOutputStream
71
+ include FakeIO
72
+
73
+ def write(data)
74
+ self << data
75
+ data.to_s.length
76
+ end
77
+
78
+
79
+ def print(*params)
80
+ self << params.to_s << $\.to_s
81
+ end
82
+
83
+ def printf(aFormatString, *params)
84
+ self << sprintf(aFormatString, *params)
85
+ end
86
+
87
+ def putc(anObject)
88
+ self << case anObject
89
+ when Fixnum then anObject.chr
90
+ when String then anObject
91
+ else raise TypeError, "putc: Only Fixnum and String supported"
92
+ end
93
+ anObject
94
+ end
95
+
96
+ def puts(*params)
97
+ params << "\n" if params.empty?
98
+ params.flatten.each {
99
+ |element|
100
+ val = element.to_s
101
+ self << val
102
+ self << "\n" unless val[-1,1] == "\n"
103
+ }
104
+ end
105
+
106
+ end
107
+
108
+ end # IOExtras namespace module
109
+
110
+
111
+
112
+ # Copyright (C) 2002-2004 Thomas Sondergaard
113
+ # rubyzip is free software; you can redistribute it and/or
114
+ # modify it under the terms of the ruby license.
@@ -0,0 +1,111 @@
1
+ unless Enumerable.method_defined?(:inject)
2
+ module Enumerable #:nodoc:all
3
+ def inject(n = 0)
4
+ each { |value| n = yield(n, value) }
5
+ n
6
+ end
7
+ end
8
+ end
9
+
10
+ module Enumerable #:nodoc:all
11
+ # returns a new array of all the return values not equal to nil
12
+ # This implementation could be faster
13
+ def select_map(&aProc)
14
+ map(&aProc).reject { |e| e.nil? }
15
+ end
16
+ end
17
+
18
+ unless Object.method_defined?(:object_id)
19
+ class Object
20
+ # Using object_id which is the new thing, so we need
21
+ # to make that work in versions prior to 1.8.0
22
+ alias object_id id
23
+ end
24
+ end
25
+
26
+ unless File.respond_to?(:read)
27
+ class File
28
+ # singleton method read does not exist in 1.6.x
29
+ def self.read(fileName)
30
+ open(fileName) { |f| f.read }
31
+ end
32
+ end
33
+ end
34
+
35
+ class String
36
+ def starts_with(aString)
37
+ rindex(aString, 0) == 0
38
+ end
39
+
40
+ def ends_with(aString)
41
+ index(aString, -aString.size)
42
+ end
43
+
44
+ def ensure_end(aString)
45
+ ends_with(aString) ? self : self + aString
46
+ end
47
+
48
+ def lchop
49
+ slice(1, length)
50
+ end
51
+ end
52
+
53
+ class Time
54
+
55
+ #MS-DOS File Date and Time format as used in Interrupt 21H Function 57H:
56
+ #
57
+ # Register CX, the Time:
58
+ # Bits 0-4 2 second increments (0-29)
59
+ # Bits 5-10 minutes (0-59)
60
+ # bits 11-15 hours (0-24)
61
+ #
62
+ # Register DX, the Date:
63
+ # Bits 0-4 day (1-31)
64
+ # bits 5-8 month (1-12)
65
+ # bits 9-15 year (four digit year minus 1980)
66
+
67
+
68
+ def to_binary_dos_time
69
+ (sec/2) +
70
+ (min << 5) +
71
+ (hour << 11)
72
+ end
73
+
74
+ def to_binary_dos_date
75
+ (day) +
76
+ (month << 5) +
77
+ ((year - 1980) << 9)
78
+ end
79
+
80
+ # Dos time is only stored with two seconds accuracy
81
+ def dos_equals(other)
82
+ to_i/2 == other.to_i/2
83
+ end
84
+
85
+ def self.parse_binary_dos_format(binaryDosDate, binaryDosTime)
86
+ second = 2 * ( 0b11111 & binaryDosTime)
87
+ minute = ( 0b11111100000 & binaryDosTime) >> 5
88
+ hour = (0b1111100000000000 & binaryDosTime) >> 11
89
+ day = ( 0b11111 & binaryDosDate)
90
+ month = ( 0b111100000 & binaryDosDate) >> 5
91
+ year = ((0b1111111000000000 & binaryDosDate) >> 9) + 1980
92
+ begin
93
+ return Time.local(year, month, day, hour, minute, second)
94
+ end
95
+ end
96
+ end
97
+
98
+ class Module
99
+ def forward_message(forwarder, *messagesToForward)
100
+ methodDefs = messagesToForward.map {
101
+ |msg|
102
+ "def #{msg}; #{forwarder}(:#{msg}); end"
103
+ }
104
+ module_eval(methodDefs.join("\n"))
105
+ end
106
+ end
107
+
108
+
109
+ # Copyright (C) 2002, 2003 Thomas Sondergaard
110
+ # rubyzip is free software; you can redistribute it and/or
111
+ # modify it under the terms of the ruby license.