rwdshell 0.99 → 1.00
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +8 -1
- data/code/01rwdcore/01rwdcore.rb +4 -1
- data/code/01rwdcore/jumplinkcommand.rb +6 -10
- data/code/01rwdcore/rundocuments.rb +10 -0
- data/code/01rwdcore/runeditconfiguration.rb +10 -0
- data/code/01rwdcore/runhelpabout.rb +10 -0
- data/code/01rwdcore/runopentinkerdocument.rb +7 -0
- data/code/01rwdcore/rwdtinkerversion.rb +11 -3
- data/code/01rwdcore/selectiontab.rb +9 -0
- data/code/01rwdcore/setuphelpaboutoptions.rb +13 -0
- data/code/01rwdcore/setuptinkerdocuments.rb +6 -0
- data/code/01rwdcore/test_cases.rb +53 -59
- data/code/01rwdcore/test_harness.rb +1 -0
- data/code/superant.com.rwdshell/loadconfigurationrecord.rb +2 -10
- data/code/superant.com.rwdshell/loadconfigurationvariables.rb +5 -5
- data/code/superant.com.rwdshell/rwdtinkerversion.rb +10 -0
- data/code/superant.com.rwdshell/saveconfigurationrecord.rb +4 -4
- data/code/superant.com.rwdshell/test_cases.rb +46 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +1 -1
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +1 -1
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +1 -12
- data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +11 -0
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +2 -2
- data/configuration/rwdapplicationidentity.dist +1 -1
- data/configuration/rwdshell.dist +13 -2
- data/configuration/rwdtinker.dist +7 -3
- data/configuration/tinkerwin2variables.dist +1 -1
- data/gui/00coreguibegin/applicationguitop.rwd +1 -1
- data/gui/frontwindowselectionbegin/selectiontabbegin/{selectiontabbegin.rwd → 00selectiontabbegin.rwd} +1 -1
- data/gui/frontwindowselectionzend/viewselectionzend/{viewselectionend.rwd → wwselectionend.rwd} +0 -0
- data/gui/{frontwindowtdocumentbegin/superant.com.documentsbegin/tt0documentbegin.rwd → frontwindowselectionzend/viewselectionzend/zzdocumentbegin.rwd} +0 -0
- data/gui/frontwindowtdocuments/superant.com.documents/tinkerdocuments.rwd +14 -0
- data/gui/helpaboutbegin/superant.com.helpaboutbegin/zzdocumentend.rwd +8 -0
- data/gui/{frontwindowz1end/frontwindowend/xx0rwdfirsttab.rwd → helpaboutbegin/superant.com.helpaboutbegin/zzzrwdlasttab.rwd} +0 -0
- data/gui/helpaboutbegin/superant.com.helpaboutbegin/{ya0helpscreenstart.rwd → zzzzhelpscreenstart.rwd} +0 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/helpabouttab.rwd +15 -0
- data/gui/helpaboutzend/superant.com.helpaboutend/zhelpscreenstart2.rwd +3 -0
- data/gui/helpaboutzend/superant.com.helpaboutend/zzzzhelpabout2.rwd +15 -0
- data/gui/helpaboutzend/superant.com.helpaboutend/zzzzhelpscreen2end.rwd +3 -0
- data/gui/tinkerbackwindows/superant.com.rwdshellbackwindow/92viewconfiguration.rwd +4 -10
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +2 -10
- data/gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.versionwindow/helpaboutwindow.rwd +17 -0
- data/rwd_files/HowTo_Shell.txt +8 -1
- data/rwd_files/HowTo_Tinker.txt +18 -0
- data/rwd_files/{rwdindex.html → RubyWebDialogs.html} +0 -0
- data/rwdconfig.dist +11 -2
- data/tests/RubyGauge.rb +179 -0
- data/tests/makedist.rb +1 -0
- data/tests/makerwdwaddresses-1.04.rb +40 -0
- metadata +27 -28
- data/code/superant.com.rwdshell/rwdshellversion.rb +0 -14
- data/gui/frontwindowtdocuments/superant.com.documents/uu5documents.rwd +0 -15
- data/gui/frontwindowtdocuments/superant.com.rubyeval/rubyeval.rwd +0 -4
- data/gui/frontwindowtdocuments/superant.com.shelldocument/vvdocshellxp.rwd +0 -6
- data/gui/frontwindowtdocuments/superant.com.tinkerwin2documents/uu5documents.rwd +0 -6
- data/gui/frontwindowtdocumentzend/superant.com.documentsend/ww0documentend.rwd +0 -12
- data/gui/helpaboutinstalled/superant.com.shellhelpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.shellhelpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.shellhelpabout/5version.rwd +0 -9
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/5version.rwd +0 -10
- data/tests/rwdtinkertestEN.rb +0 -163
- data/tests/test.result +0 -32
@@ -16,7 +16,7 @@ def listzipfilestoinstall
|
|
16
16
|
a.each do |x|
|
17
17
|
# only zip files
|
18
18
|
if x =~ /\.zip/
|
19
|
-
|
19
|
+
#adds the file to the array to display on the screen
|
20
20
|
$zipsarraylocal = $zipsarraylocal | ["#{x}"]
|
21
21
|
end
|
22
22
|
|
@@ -12,18 +12,7 @@ def loadconfigurationrecord
|
|
12
12
|
fileName = File.join(ConfigurationDir, TinkerWin2ConfigurationFileName)
|
13
13
|
|
14
14
|
fd = File.open(fileName,"r")
|
15
|
-
@
|
16
|
-
@a_configline2 = fd.readline.chomp
|
17
|
-
@a_configline3 = fd.readline.chomp
|
18
|
-
@a_configline4 = fd.readline.chomp
|
19
|
-
@a_configline5 = fd.readline.chomp
|
20
|
-
@a_configline6 = fd.readline.chomp
|
21
|
-
@a_configline7 =fd.readline.chomp
|
22
|
-
@a_configline8 = fd.readline.chomp
|
23
|
-
|
24
|
-
while ! fd.eof?
|
25
|
-
@extraconfigdatadisplay = fd.readline
|
26
|
-
end
|
15
|
+
@a_configurationfile = fd.read
|
27
16
|
fd.close
|
28
17
|
rescue SystemCallError, StandardError
|
29
18
|
$stderr.print "system call error: " + $!
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
|
2
|
+
# This application is a framework for writing programs from RubyWebDialogs
|
3
|
+
# For information see http://www.rubyforge.net/projects/rwdapplications
|
4
|
+
|
5
|
+
# call the rwdtinker helpwindow
|
6
|
+
|
7
|
+
def runremotezipsinstall
|
8
|
+
@rwd_window = "tinkerbackwindow"
|
9
|
+
@rwd_tab = "superantcomremotezipsinstall"
|
10
|
+
end
|
11
|
+
|
@@ -3,9 +3,9 @@ def saveconfigurationrecord
|
|
3
3
|
require 'fileutils'
|
4
4
|
if @a_configurationfilename
|
5
5
|
newname = "%s" % [@a_configurationfilename] # grab the filename to create
|
6
|
-
newdata =@
|
6
|
+
newdata =@a_configurationfile
|
7
7
|
|
8
|
-
|
8
|
+
begin # exception trapped block
|
9
9
|
fileName = File.join( ConfigurationDir, newname )
|
10
10
|
fd = File.open(fileName,"w")
|
11
11
|
fd.print(newdata) # save the record info to the file
|
data/configuration/rwdshell.dist
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
-
##VERSION:
|
1
|
+
##VERSION:1.00
|
2
|
+
##NAME:$shellscript_directory:0
|
2
3
|
$shellscript_directory = "scripts"
|
3
|
-
|
4
|
+
##NAME:$testharnessarray:0
|
5
|
+
$testharnessarray += ["rwdshell_all_tests"]
|
6
|
+
##NAME:$tinkerhelpaboutarray:0
|
7
|
+
$tinkerhelpaboutarray += ["RwdShell"]
|
8
|
+
##NAME:$tinkerdocumentsarray
|
9
|
+
$tinkerdocumentsarray += ["HowTo_Shell.txt"]
|
10
|
+
##NAME:RwdShellVersion:0
|
11
|
+
RwdShellVersion = "1.00"
|
12
|
+
|
13
|
+
|
14
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
##VERSION:1.
|
1
|
+
##VERSION:1.66
|
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"
|
@@ -11,5 +11,9 @@ LangDir = "lang"
|
|
11
11
|
$prevouswindow ="main"
|
12
12
|
$rwdcontrolports =["13713","13714","13715","13716","13717","13718"]
|
13
13
|
$port = 7705
|
14
|
-
$rwdjumplink = ["helpscreen","tinkerbackwindow","returntomain"]
|
15
|
-
|
14
|
+
$rwdjumplink = ["helpscreen","tinkerbackwindow","returntomain","opendocuments","editconfiguration"]
|
15
|
+
Browser_Exe = 'mozilla '
|
16
|
+
$tinkerdocumentsarray +=["COPYING","HowTo_Tinker.txt","rwdapplications.html","RubyWebDialogs.html"]
|
17
|
+
RwdTinkerVersion = "1.66"
|
18
|
+
|
19
|
+
|
data/gui/frontwindowselectionzend/viewselectionzend/{viewselectionend.rwd → wwselectionend.rwd}
RENAMED
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$rwdguivar=
|
2
|
+
"
|
3
|
+
<horizontal>
|
4
|
+
<button caption=\"Show Documents List\" action=\"setuptinkerdocuments\"/>
|
5
|
+
|
6
|
+
</horizontal>
|
7
|
+
<table>
|
8
|
+
<select name=\"a_tinkerdocumentinput\"> %%tinkerdocumentsarray%% </select>
|
9
|
+
|
10
|
+
</table>
|
11
|
+
<horizontal>
|
12
|
+
<button caption=\"Open Document\" action=\"runopentinkerdocument\"/>
|
13
|
+
</horizontal>
|
14
|
+
"
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$rwdguivar=
|
2
|
+
"
|
3
|
+
<horizontal>
|
4
|
+
<button caption=\"Show Help About Links\" action=\"setuphelpaboutoptions\"/>
|
5
|
+
|
6
|
+
</horizontal>
|
7
|
+
<table>
|
8
|
+
<select name=\"a_helpaboutinput\"> %%helpaboutoptions%% </select>
|
9
|
+
|
10
|
+
</table>
|
11
|
+
|
12
|
+
<horizontal>
|
13
|
+
<button caption=\"Open Selected Help About\" action=\"runrwdtinkerversion\"/>
|
14
|
+
</horizontal>
|
15
|
+
"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$rwdguivar=
|
2
|
+
"
|
3
|
+
<horizontal>
|
4
|
+
<button caption=\"Show Help About Links\" action=\"setuphelpaboutoptions\"/>
|
5
|
+
|
6
|
+
</horizontal>
|
7
|
+
<table>
|
8
|
+
<select name=\"a_helpaboutinput\"> %%helpaboutoptions%% </select>
|
9
|
+
|
10
|
+
</table>
|
11
|
+
|
12
|
+
<horizontal>
|
13
|
+
<button caption=\"Open Selected Help About\" action=\"runrwdtinkerversion\"/>
|
14
|
+
</horizontal>
|
15
|
+
"
|
@@ -17,16 +17,10 @@ $rwdguivar=
|
|
17
17
|
<table>
|
18
18
|
|
19
19
|
<row> <p align=\"right\">FileName:</p> <text size=70 name=\"a_rshellconfigurationfilename\"/> </row>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
<row> <p align=\"right\">5:</p> <text size=70 name=\"a_rshellconfigline5\"/> </row>
|
25
|
-
<row> <p align=\"right\">6:</p> <text size=70 name=\"a_rshellconfigline6\"/> </row>
|
26
|
-
<row> <p align=\"right\">7:</p> <text size=70 name=\"a_rshellconfigline7\"/> </row>
|
27
|
-
<row> <p align=\"right\">8:</p> <text size=70 name=\"a_rshellconfigline8\"/> </row>
|
28
|
-
<row> <p align=\"right\">9:</p> <text size=70 name=\"a_rshellconfigline9\"/> </row>
|
29
|
-
|
20
|
+
</table>
|
21
|
+
<table>
|
22
|
+
<textarea name=\"a_rshellconfiguration\"/>
|
23
|
+
|
30
24
|
</table>
|
31
25
|
|
32
26
|
<p>
|
@@ -16,16 +16,8 @@ $rwdguivar=
|
|
16
16
|
|
17
17
|
</horizontal>
|
18
18
|
<table>
|
19
|
-
|
20
|
-
|
21
|
-
<row> <p align=\"right\">2:</p> <text size=70 name=\"a_configline2\"/> </row>
|
22
|
-
<row> <p align=\"right\">3:</p> <text size=70 name=\"a_configline3\"/> </row>
|
23
|
-
<row> <p align=\"right\">4:</p> <text size=70 name=\"a_configline4\"/> </row>
|
24
|
-
<row> <p align=\"right\">5:</p> <text size=70 name=\"a_configline5\"/> </row>
|
25
|
-
<row> <p align=\"right\">6:</p> <text size=70 name=\"a_configline6\"/> </row>
|
26
|
-
<row> <p align=\"right\">7:</p> <text size=70 name=\"a_configline7\"/> </row>
|
27
|
-
<row> <p align=\"right\">8:</p> <text size=70 name=\"a_configline8\"/> </row>
|
28
|
-
|
19
|
+
<textarea name=\"a_configurationfile\"/>
|
20
|
+
|
29
21
|
|
30
22
|
</table>
|
31
23
|
<p>%extraconfigdatadisplay%</p>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$rwdguivar=
|
2
|
+
"
|
3
|
+
<window name=tinkerhelpabout title=\"Help About Window\">
|
4
|
+
<horizontal>
|
5
|
+
<button caption=\"Show Help About Links\" action=\"setuphelpaboutoptions\"/>
|
6
|
+
|
7
|
+
</horizontal>
|
8
|
+
<table>
|
9
|
+
<select name=\"a_helpaboutinput\"> %%helpaboutoptions%% </select>
|
10
|
+
|
11
|
+
</table>
|
12
|
+
|
13
|
+
<horizontal>
|
14
|
+
<button caption=\"Open Selected Help About\" action=\"runrwdtinkerversion\"/>
|
15
|
+
</horizontal>
|
16
|
+
</window>
|
17
|
+
"
|
data/rwd_files/HowTo_Shell.txt
CHANGED
@@ -192,8 +192,15 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
|
|
192
192
|
|
193
193
|
Thanks, Steven Gibson
|
194
194
|
|
195
|
-
==
|
195
|
+
==
|
196
|
+
Version 1.00
|
197
|
+
corrected edit configuration screen
|
198
|
+
updated for rwdtinker 1.66
|
199
|
+
new helpabout
|
200
|
+
new documents list
|
201
|
+
|
196
202
|
Version 0.99
|
203
|
+
corrected Ruby script edit
|
197
204
|
added help to some shell tabs
|
198
205
|
updated for rwdtinker 1.62 - improve distro release script
|
199
206
|
changed selection screen to use new hash method
|
data/rwd_files/HowTo_Tinker.txt
CHANGED
@@ -227,6 +227,24 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
|
|
227
227
|
Thanks, Steven Gibson
|
228
228
|
|
229
229
|
== Changelog
|
230
|
+
Version 1.66
|
231
|
+
Fixed directory layout
|
232
|
+
increased size of config edit screen
|
233
|
+
|
234
|
+
Version 1.65
|
235
|
+
Changed documents listing screen - now using hash
|
236
|
+
Changed helpabout screen - now using hash
|
237
|
+
added more lines for config edit
|
238
|
+
added help about to back window
|
239
|
+
|
240
|
+
Version 1.64
|
241
|
+
fixed jump with no location
|
242
|
+
|
243
|
+
Version 1.63
|
244
|
+
changed handling of application name returned
|
245
|
+
added jump seletion options
|
246
|
+
added some unit tests
|
247
|
+
|
230
248
|
version 1.62
|
231
249
|
improve distro release script
|
232
250
|
code cleanup
|
File without changes
|
data/rwdconfig.dist
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
##VERSION:1.
|
1
|
+
##VERSION:1.66
|
2
2
|
# rwdtinker core configuration file
|
3
3
|
##NAME: ConfigLocation:0
|
4
4
|
ConfigLocation=""
|
@@ -7,4 +7,13 @@ ConfigLocation=""
|
|
7
7
|
##NAME:$testharnessarray:0
|
8
8
|
$testharnessarray = ["rwdtinker_all_tests"]
|
9
9
|
##NAME:TestNow:0
|
10
|
-
TestNow=false
|
10
|
+
TestNow=false # turning this on will run the unit tests
|
11
|
+
##NAME:$testharness:0
|
12
|
+
$testharness=true
|
13
|
+
##NAME:$tinkerhelpaboutarray:0
|
14
|
+
$tinkerhelpaboutarray = ["Tinker"]
|
15
|
+
##NAME:$tinkerdocumentsarray:0
|
16
|
+
$tinkerdocumentsarray = ["Readme.txt"]
|
17
|
+
|
18
|
+
|
19
|
+
|
data/tests/RubyGauge.rb
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
#--------------------------------------------------------------------#
|
2
|
+
# #
|
3
|
+
# RubyGauge version 1 #
|
4
|
+
# Copyright (c) 2005, Harrison Ainsworth. #
|
5
|
+
# #
|
6
|
+
# http://hxa7241.org/ #
|
7
|
+
# #
|
8
|
+
#--------------------------------------------------------------------#
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
require 'find'
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
# Counts lines of code in ruby source files.
|
19
|
+
#
|
20
|
+
# just a simple example ruby program, produced as an exercise.
|
21
|
+
#
|
22
|
+
# * directories are looked in recursively for source files
|
23
|
+
# * source files with the following name extensions are recognized:
|
24
|
+
# .rb .rbw
|
25
|
+
# * a line is counted as code if it is not empty and not solely comment
|
26
|
+
#
|
27
|
+
# == requirements
|
28
|
+
# ruby 1.8
|
29
|
+
#
|
30
|
+
# == usage
|
31
|
+
# RubyGauge.rb [-f...] (file|directory)pathname ...
|
32
|
+
# RubyGauge.rb -help|-?
|
33
|
+
#
|
34
|
+
# switches:
|
35
|
+
# -f<[l|s][1|2]> set output format to long/short, linecount only /
|
36
|
+
# linecount and filecount (defaults to -fl2)
|
37
|
+
# -help|-? prints this message
|
38
|
+
#
|
39
|
+
# ==acknowledgements
|
40
|
+
# * ruby: http://ruby-lang.org/
|
41
|
+
# * the pragmaticprogrammers pickaxe book:
|
42
|
+
# http://phrogz.net/ProgrammingRuby/
|
43
|
+
# * rubygarden: http://rubygarden.org/ruby?CodingInRuby
|
44
|
+
#
|
45
|
+
# == license
|
46
|
+
# this software is too short and insignificant to have a license.
|
47
|
+
|
48
|
+
module RubyGauge
|
49
|
+
|
50
|
+
# Entry point if run from the command line.
|
51
|
+
#
|
52
|
+
# Reads command line args, writes output to stdout.
|
53
|
+
#
|
54
|
+
def RubyGauge.main
|
55
|
+
|
56
|
+
# check if help message needed
|
57
|
+
if $*.empty? || !(RubyGauge.getSwitchs( $*, '(help|\?)' ).empty?)
|
58
|
+
|
59
|
+
puts "\n#{@@BANNER}\n#{@@HELP}"
|
60
|
+
|
61
|
+
else
|
62
|
+
|
63
|
+
# count
|
64
|
+
pathnames = RubyGauge.getTokens( $*, '^[^-\/]', ' ' )
|
65
|
+
|
66
|
+
fileCount = []
|
67
|
+
lineCount = RubyGauge.countLinesInFileTree( pathnames, fileCount )
|
68
|
+
|
69
|
+
# output counts
|
70
|
+
format = RubyGauge.getSwitchs( $*, 'f', '-fl2' ).last[2,2]
|
71
|
+
|
72
|
+
(@@LINES_FORMAT = { 's' => "#{lineCount}" }).default = "\n #{lineCount} line#{lineCount == 1 ? '' : 's'} of code\n"
|
73
|
+
(@@FILES_FORMAT = { 's' => " #{fileCount}" }).default = " #{fileCount[0]} file#{fileCount[0] == 1 ? '' : 's'}\n"
|
74
|
+
print @@LINES_FORMAT[format[0,1]]
|
75
|
+
print @@FILES_FORMAT[format[0,1]] unless format[1,1] == '1'
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
def RubyGauge.getSwitchs( commandline, pattern, default=nil )
|
83
|
+
|
84
|
+
RubyGauge.getTokens( commandline, '^(-|\/)' + pattern, default )
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def RubyGauge.getTokens( commandline, pattern, default=nil )
|
90
|
+
|
91
|
+
tokens = []
|
92
|
+
|
93
|
+
commandline.each do |token|
|
94
|
+
if token =~ /#{pattern}/
|
95
|
+
tokens.push token
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
if tokens.empty? && default
|
100
|
+
tokens.push default
|
101
|
+
end
|
102
|
+
|
103
|
+
tokens
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
# Counts lines of ruby code in filetree recursively.
|
109
|
+
#
|
110
|
+
# A line is counted as code if it is not empty and not solely comment.
|
111
|
+
#
|
112
|
+
# == parameters
|
113
|
+
# * pathnames: Array of String of file or directory pathname
|
114
|
+
# (relative or absolute)
|
115
|
+
# * fileCount: Array of Numeric, length 1. Just an example of a
|
116
|
+
# 'reference' parameter
|
117
|
+
# * return: Fixnum of the line count
|
118
|
+
#
|
119
|
+
def RubyGauge.countLinesInFileTree( pathnames, fileCount=[] )
|
120
|
+
|
121
|
+
fileCount[0] = 0
|
122
|
+
lineCount = 0
|
123
|
+
|
124
|
+
# scan directory tree
|
125
|
+
Find.find( *pathnames ) do |fileOrDirName|
|
126
|
+
|
127
|
+
# filter file types (to ruby)
|
128
|
+
if FileTest.file?( fileOrDirName ) &&
|
129
|
+
FileTest.readable?( fileOrDirName ) &&
|
130
|
+
fileOrDirName =~ /\.(rb|rbw)\Z/
|
131
|
+
|
132
|
+
fileCount[0] += 1
|
133
|
+
|
134
|
+
filePathname = File.expand_path( fileOrDirName )
|
135
|
+
|
136
|
+
# read file
|
137
|
+
File.open( filePathname, 'r' ) do |file|
|
138
|
+
|
139
|
+
# scan file lines
|
140
|
+
file.each_line do |line|
|
141
|
+
# select non blank, non comment-only line
|
142
|
+
unless line =~ /^\s*(#|\Z)/
|
143
|
+
lineCount += 1
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
lineCount
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
@@BANNER = "-------------------------------------------------------------\n" +
|
158
|
+
"RubyGauge 2005 (v1)\n" +
|
159
|
+
"Copyright (c) 2005, Harrison Ainsworth.\n\n" +
|
160
|
+
"http://hxa7241.org/\n" +
|
161
|
+
"-------------------------------------------------------------\n"
|
162
|
+
|
163
|
+
@@HELP = "RubyGauge counts lines of code in ruby source files.\n\n" +
|
164
|
+
"* directories are looked in recursively for source files\n" +
|
165
|
+
"* source files with the following name extensions are recognized: .rb .rbw\n" +
|
166
|
+
"* a line is counted as code if it is not empty and not solely comment\n" +
|
167
|
+
"\nusage:\n" +
|
168
|
+
" RubyGauge.rb [-f...] (file|directory)pathname ...\n" +
|
169
|
+
" RubyGauge.rb -help|-?\n" +
|
170
|
+
"\nswitches:\n" +
|
171
|
+
" -f<[l|s][1|2]> set output format to long/short, linecount only / linecount and filecount (defaults to -fl2)\n" +
|
172
|
+
" -help|-? prints this message\n"
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
RubyGauge.main
|