rwdtorrent 0.02 → 0.03

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 (72) hide show
  1. data/Readme.txt +11 -0
  2. data/code/01rwdcore/01rwdcore.rb +16 -16
  3. data/code/01rwdcore/jumplinkcommand.rb +26 -0
  4. data/code/01rwdcore/openhelpwindow.rb +26 -26
  5. data/code/01rwdcore/returntomain.rb +8 -8
  6. data/code/01rwdcore/rundocuments.rb +10 -0
  7. data/code/01rwdcore/runeditconfiguration.rb +10 -0
  8. data/code/01rwdcore/runhelpabout.rb +10 -0
  9. data/code/01rwdcore/rwdtinkerversion.rb +12 -13
  10. data/code/01rwdcore/rwdwindowreturn.rb +3 -5
  11. data/code/01rwdcore/selectiontab.rb +9 -0
  12. data/code/01rwdcore/test_cases.rb +81 -98
  13. data/code/01rwdcore/test_harness.rb +8 -10
  14. data/code/01rwdcore/uploadreturns.rb +60 -60
  15. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +89 -92
  16. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +15 -21
  17. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +19 -18
  18. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -19
  19. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -18
  20. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +7 -7
  21. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +48 -49
  22. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +8 -7
  23. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +22 -26
  24. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -31
  25. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -13
  26. data/code/superant.com.rwdtinkerbackwindow/network.rb +82 -82
  27. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -17
  28. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +37 -37
  29. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +20 -20
  30. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +33 -32
  31. data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +11 -0
  32. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +8 -9
  33. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +10 -11
  34. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -18
  35. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -20
  36. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +23 -20
  37. data/code/superant.com.rwdtorrent/helptesthashrwdtorrent.rb +7 -2
  38. data/code/superant.com.rwdtorrent/returntodownload.rb +10 -0
  39. data/code/superant.com.rwdtorrent/returntomain.rb +1 -1
  40. data/code/superant.com.rwdtorrent/runeditconfiguration.rb +10 -0
  41. data/code/superant.com.rwdtorrent/runtorrentwindow.rb +305 -51
  42. data/code/superant.com.rwdtorrent/test_cases.rb +46 -0
  43. data/configuration/language.dist +1 -1
  44. data/configuration/rwdapplicationidentity.dist +2 -2
  45. data/configuration/rwdtinker.dist +3 -3
  46. data/configuration/rwdtorrent.dist +4 -3
  47. data/configuration/tinkerwin2variables.dist +1 -1
  48. data/gui/00coreguibegin/applicationguitop.rwd +1 -1
  49. data/gui/frontwindow0/superant.com.rwdtorrent/40rwdtorrentrefresh.rwd +1 -0
  50. data/gui/frontwindowselectionbegin/selectiontabbegin/selectiontabbegin.rwd +2 -7
  51. data/gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/jumplinkcommands.rwd +15 -0
  52. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/1appname.rwd +1 -1
  53. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/5version.rwd +1 -1
  54. data/gui/helpaboutinstalled/superant.com.torrenthelpabout/1appname.rwd +1 -1
  55. data/gui/helpaboutinstalled/superant.com.torrenthelpabout/3copyright.rwd +1 -1
  56. data/gui/helpaboutinstalled/superant.com.torrenthelpabout/5version.rwd +1 -1
  57. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd +17 -0
  58. data/gui/tinkerbackwindows/superant.com.torrentdisplay/torrentdisplaywindow.rwd +39 -16
  59. data/init.rb +228 -228
  60. data/rwd_files/HowTo_Tinker.txt +14 -0
  61. data/rwd_files/HowTo_Torrent.txt +7 -0
  62. data/rwdconfig.dist +4 -2
  63. data/tests/RubyGauge.rb +179 -0
  64. data/tests/makedist.rb +1 -0
  65. data/torrentfiles/knoppix-std-0.1.iso.torrent +0 -0
  66. metadata +17 -10
  67. data/gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/rwdwin2selectiontab.rwd +0 -12
  68. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/80tab1.rwd +0 -11
  69. data/tests/rwdtinkertestEN.rb +0 -163
  70. data/tests/test.result +0 -32
  71. data/torrentfiles/freeculture-audiobook.zip.torrent +0 -0
  72. data/torrentfiles/freeculture.zip.torrent +0 -0
data/Readme.txt CHANGED
@@ -132,6 +132,17 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
132
132
  Thanks, Steven Gibson
133
133
 
134
134
  == Changelog
135
+ Version 0.03
136
+ added directory name to download window
137
+ resuming download clearer
138
+ added viewing upload progress
139
+ updated for rwdtinker 1.64
140
+ added some unit tests
141
+
142
+ Version 0.02
143
+ Correct GUI directory location
144
+ modify link to directory location of torrentfiles
145
+
135
146
  Version 0.01
136
147
  initial release
137
148
  view torrent metafile details
@@ -3,20 +3,20 @@
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
  # This class is the top class for the RwdTinker application
6
-
6
+
7
7
  class RwdTinker < RWDialog
8
-
9
- def main
10
- @rwd_window = "main"
11
- @result = "idle"
12
- @display= "idle"
13
- if TestNow
14
-
15
- rwdtest_harness
16
- end
17
- end
18
-
19
- def inspect
20
- "Rwdtinker Application "
21
- end
22
-
8
+
9
+ def main
10
+ @rwd_window = "main"
11
+ @result = "idle"
12
+ @display= "idle"
13
+ if TestNow
14
+
15
+ rwdtest_harness
16
+ end
17
+ end
18
+
19
+ def inspect
20
+ "#{$rwdapplicationidentity}"
21
+ end
22
+
@@ -0,0 +1,26 @@
1
+ # Bind message passing socket to rwdtinker application
2
+ JumpLink = Hash.new { |hh, kk| hh[kk] = "ERROR: link not found: #{kk.inspect}."; hh[kk] }
3
+ locationlink = {
4
+ :helpscreen=> "runhelpwindow",
5
+ :tinkerbackwindow=>"runrwdtinkerbackwindow",
6
+ :returntomain=>"returntomain",
7
+ :opendocuments=>"runtinkerdocuments",
8
+ :editconfiguration=>"runeditconfiguration"
9
+ }
10
+ locationlink.each { |kk, vv| JumpLink[kk] = vv }
11
+
12
+ def runjumplinkcommand
13
+ if @a_jumplinkinput
14
+ runjumplocation = "#{JumpLink[:"#{@a_jumplinkinput}"]}"
15
+
16
+ self.send(runjumplocation)
17
+ end
18
+ end
19
+
20
+
21
+ # list the remote control options on the screen
22
+ def showjumplinkoptions
23
+
24
+ @jumplinkoptions = $rwdjumplink.rwd_options
25
+
26
+ end
@@ -1,31 +1,31 @@
1
1
  # this code is to call the help window
2
2
  def runhelpwindow
3
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing","applet_tinkerbackeditconfiguration","remote_control"]
4
-
5
- if @rwd_window == "main"
6
- if @rwd_tab == "documentsrwdtinkerone"
7
- $help_topic = "documents_rwdtinker"
8
- end
9
-
10
- end
11
-
12
- if @rwd_window == "rwdtinkerhelpwindow"
13
- puts "in help window processing"
14
- else
15
- $previouswindow = @rwd_window
16
- $previoustab = @rwd_tab
17
- end
18
-
19
-
20
- @rwdhelptopic = $help_topic
21
- @rwdhelpdataoutput = "#{Helptext[:"#{$help_topic}"]}"
22
- @rwdhelpsubchoicesoutput = $helptopicsarray.rwd_method("choosenewhelptopic")
23
- @rwd_window = "rwdtinkerhelpwindow"
3
+ $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing","applet_tinkerbackeditconfiguration","remote_control"]
4
+
5
+ if @rwd_window == "main"
6
+ if @rwd_tab == "documentsrwdtinkerone"
7
+ $help_topic = "documents_rwdtinker"
8
+ end
9
+
10
+ end
11
+
12
+ if @rwd_window == "rwdtinkerhelpwindow"
13
+ puts "in help window processing"
14
+ else
15
+ $previouswindow = @rwd_window
16
+ $previoustab = @rwd_tab
17
+ end
18
+
19
+
20
+ @rwdhelptopic = $help_topic
21
+ @rwdhelpdataoutput = "#{Helptext[:"#{$help_topic}"]}"
22
+ @rwdhelpsubchoicesoutput = $helptopicsarray.rwd_method("choosenewhelptopic")
23
+ @rwd_window = "rwdtinkerhelpwindow"
24
24
  end
25
-
26
- def choosenewhelptopic(inffile)
27
- $help_topic = inffile
28
- runhelpwindow
29
- end
25
+
26
+ def choosenewhelptopic(inffile)
27
+ $help_topic = inffile
28
+ runhelpwindow
29
+ end
30
30
 
31
31
 
@@ -1,10 +1,10 @@
1
1
  # Application RwdAddresses orginally (c) 2004 Steven Gibson under GPL.
2
2
  #
3
- # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
-
5
- # call the window
6
- def returntomain
7
- @rwd_window = "main"
8
- @rwd_tab = "selectiontab"
9
- end
10
-
3
+ # For information see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def returntomain
7
+ @rwd_window = "main"
8
+ @rwd_tab = "selectiontab"
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ # Application menu orginally (c) 2004 Steven Gibson under GPL.
2
+ #
3
+ # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def runtinkerdocuments
7
+ @rwd_window = "main"
8
+ @rwd_tab = "documentsrwdtinkerone"
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ # Application menu orginally (c) 2004 Steven Gibson under GPL.
2
+ #
3
+ # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def runeditconfiguration
7
+ @rwd_window = "tinkerbackwindow"
8
+ @rwd_tab = "editconfigurationfile"
9
+ end
10
+
@@ -0,0 +1,10 @@
1
+ # Application menu orginally (c) 2004 Steven Gibson under GPL.
2
+ #
3
+ # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def runtinkerhelpabout
7
+ @rwd_window = "rwdtinkerhelpwindow"
8
+
9
+ end
10
+
@@ -1,15 +1,14 @@
1
1
  # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
2
  # This application is a framework for writing programs from RubyWebDialogs
3
- # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
- # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
-
6
- # return the version constant defined in the config file
7
- def runrwdtinkerversion
8
- @rwd_window = "applicationversion"
9
- @versionappnamedisplay = "RwdTinker"
10
- @versioncopyrightdisplay = "(c) 2004 Steven Gibson "
11
- @versionnumberdisplay = "Version " + RwdTinkerVersion
12
-
13
- end
14
-
15
-
3
+ # For information see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # return the version constant defined in the config file
6
+ def runrwdtinkerversion
7
+ @rwd_window = "applicationversion"
8
+ @versionappnamedisplay = "RwdTinker"
9
+ @versioncopyrightdisplay = "(c) 2004 Steven Gibson "
10
+ @versionnumberdisplay = "Version " + RwdTinkerVersion
11
+
12
+ end
13
+
14
+
@@ -1,11 +1,9 @@
1
1
  # this code is to return to the window back from the help window
2
2
  def rwdwindowreturn
3
-
4
3
 
5
- @rwd_window = "#{$previouswindow}"
6
- @rwd_tab = "#{$previoustab}"
7
- end
8
-
4
+ @rwd_window = "#{$previouswindow}"
5
+ @rwd_tab = "#{$previoustab}"
6
+ end
9
7
 
10
8
 
11
9
 
@@ -0,0 +1,9 @@
1
+ # this code is to return to the window back from the help window
2
+ def runselectiontab
3
+
4
+
5
+ @rwd_tab = "selectiontab"
6
+ end
7
+
8
+
9
+
@@ -1,126 +1,109 @@
1
1
  # test harness
2
- def rwdtinker_all_tests
3
- print "in rwdtinker all tests\n"
4
- test_runrwdtinkerbackwindow
5
- end
6
2
 
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
7
13
 
8
14
  def test_runrwdtinkerbackwindow
9
-
10
- require 'test/unit'
11
- begin
12
-
13
- runrwdtinkerbackwindow
14
15
 
15
- raise NotImplementedError, 'Need to write test_runrwdtinkerbackwindow'
16
16
 
17
- rescue NotImplementedError
18
- $stderr.print $!
19
-
20
- end
21
- end
22
-
17
+ begin
18
+ testasserts = 0
19
+ print "Starting rwdtinker tests!\n"
20
+ runrwdtinkerbackwindow
21
+
22
+ assert_equal("tinkerbackwindow",@rwd_window) ; testasserts += 1
23
+ runselectiontab
24
+ assert_equal("selectiontab",@rwd_tab) ; testasserts += 1
25
+ showjumplinkoptions
26
+ @a_jumplinkinput = "returntomain"
27
+ runjumplinkcommand
28
+ assert_equal("main",@rwd_window) ; testasserts += 1
29
+ @a_jumplinkinput = "helpscreen"
30
+ runjumplinkcommand
31
+
32
+ assert_equal("rwdtinkerhelpwindow",@rwd_window) ; testasserts += 1
33
+ returntomain
34
+ assert_equal("main",@rwd_window) ; testasserts += 1
35
+ 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"
58
+
59
+ rescue NotImplementedError, Exception
60
+ $stderr.print $!
61
+
62
+ end
23
63
 
64
+ end
24
65
 
25
- def test_choosenewhelptopic
26
- raise NotImplementedError, 'Need to write test_choosenewhelptopic'
27
- end
28
66
 
29
67
 
30
- def test_listinstalledfiles
31
- raise NotImplementedError, 'Need to write test_listinstalledfiles'
32
- end
68
+ def teststobedown
69
+ runtinkerhelpabout
70
+ assert_equal("rwdtinkerhelpwindow",@rwd_tab) ; testasserts += 1
71
+ raise NotImplementedError, 'Need to write test_choosenewhelptopic'
72
+ raise NotImplementedError, 'Need to write test_listinstalledfiles'
73
+ raise NotImplementedError, 'Need to write test_listzipfilestoinstall'
74
+ raise NotImplementedError, 'Need to write test_loadconfigurationrecord'
75
+ raise NotImplementedError, 'Need to write test_loadconfigurationvariables'
33
76
 
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
77
+ raise NotImplementedError, 'Need to write test_main'
42
78
 
43
- def test_loadconfigurationvariables
44
- raise NotImplementedError, 'Need to write test_loadconfigurationvariables'
45
- end
79
+ raise NotImplementedError, 'Need to write test_network_demon'
46
80
 
47
- def test_loadgemspecrecord
48
- raise NotImplementedError, 'Need to write test_loadgemspecrecord'
49
- end
81
+ raise NotImplementedError, 'Need to write test_network_start'
50
82
 
51
- def test_loadrubyslippersconfiguration
52
- raise NotImplementedError, 'Need to write test_loadrubyslippersconfiguration'
53
- end
83
+ raise NotImplementedError, 'Need to write test_openappletname'
54
84
 
55
- def test_loadrubyslippersconfigurationvariables
56
- raise NotImplementedError, 'Need to write test_loadrubyslippersconfigurationvariables'
57
- end
85
+ raise NotImplementedError, 'Need to write test_removeapplet'
58
86
 
59
- def test_main
60
- raise NotImplementedError, 'Need to write test_main'
61
- end
87
+ raise NotImplementedError, 'Need to write test_returntomain'
62
88
 
63
- def test_network_demon
64
- raise NotImplementedError, 'Need to write test_network_demon'
65
- end
89
+ raise NotImplementedError, 'Need to write test_runcontrolcommand'
66
90
 
67
- def test_network_start
68
- raise NotImplementedError, 'Need to write test_network_start'
69
- end
91
+ raise NotImplementedError, 'Need to write test_runhelpwindow'
70
92
 
71
- def test_openappletname
72
- raise NotImplementedError, 'Need to write test_openappletname'
73
- end
93
+ raise NotImplementedError, 'Need to write test_runrwdtinkerversion'
74
94
 
75
- def test_removeapplet
76
- raise NotImplementedError, 'Need to write test_removeapplet'
77
- end
95
+ raise NotImplementedError, 'Need to write test_runrwdtinkerwin2version'
78
96
 
79
- def test_returntomain
80
- raise NotImplementedError, 'Need to write test_returntomain'
81
- end
97
+ raise NotImplementedError, 'Need to write test_runviewplatform'
82
98
 
83
- def test_runcontrolcommand
84
- raise NotImplementedError, 'Need to write test_runcontrolcommand'
85
- end
99
+ raise NotImplementedError, 'Need to write test_rwdtinkerversiondiagnostic'
86
100
 
101
+ raise NotImplementedError, 'Need to write test_rwdwindowreturn'
102
+ raise NotImplementedError, 'Need to write test_saveconfigurationrecord'
87
103
 
88
- def test_runhelpwindow
89
- raise NotImplementedError, 'Need to write test_runhelpwindow'
90
- end
104
+ raise NotImplementedError, 'Need to write test_viewappletcontents'
105
+ end
91
106
 
92
107
 
93
-
94
-
95
- def test_runrwdtinkerversion
96
- raise NotImplementedError, 'Need to write test_runrwdtinkerversion'
97
- end
98
108
 
99
- def test_runrwdtinkerwin2version
100
- raise NotImplementedError, 'Need to write test_runrwdtinkerwin2version'
101
- end
102
109
 
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
-
@@ -1,15 +1,13 @@
1
1
  # this to start the test harness
2
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
3
 
4
+ print "in test harness, tests to perform:\n"
5
+ puts $testharnessarray
6
+ $testharnessarray.each { |x|
7
+ print "calling #{x}\n"
8
+ eval("#{x}")
14
9
 
10
+ }
11
+
12
+ end
15
13
 
@@ -1,62 +1,62 @@
1
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
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
62
  end