rwdtinker 1.63 → 1.64

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.txt CHANGED
@@ -227,6 +227,9 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
227
227
  Thanks, Steven Gibson
228
228
 
229
229
  == Changelog
230
+ Version 1.64
231
+ fix jump with no location
232
+
230
233
  Version 1.63
231
234
  changed handling of application name returned
232
235
  added jump seletion options
@@ -10,11 +10,11 @@ JumpLink = Hash.new { |hh, kk| hh[kk] = "ERROR: link not found: #{kk.inspect}.";
10
10
  locationlink.each { |kk, vv| JumpLink[kk] = vv }
11
11
 
12
12
  def runjumplinkcommand
13
-
13
+ if @a_jumplinkinput
14
14
  runjumplocation = "#{JumpLink[:"#{@a_jumplinkinput}"]}"
15
15
 
16
16
  self.send(runjumplocation)
17
-
17
+ end
18
18
  end
19
19
 
20
20
 
@@ -1,4 +1,4 @@
1
- ##VERSION:1.63
1
+ ##VERSION:1.64
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
  $rwdjumplink = ["helpscreen","tinkerbackwindow","returntomain","opendocuments","editconfiguration"]
15
- RwdTinkerVersion = "1.63"
15
+ RwdTinkerVersion = "1.64"
@@ -227,6 +227,9 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
227
227
  Thanks, Steven Gibson
228
228
 
229
229
  == Changelog
230
+ Version 1.64
231
+ fixed jump with no location
232
+
230
233
  Version 1.63
231
234
  changed handling of application name returned
232
235
  added jump seletion options
@@ -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
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.8
3
3
  specification_version: 1
4
4
  name: rwdtinker
5
5
  version: !ruby/object:Gem::Version
6
- version: "1.63"
7
- date: 2005-04-03
6
+ version: "1.64"
7
+ date: 2005-04-05
8
8
  summary: rwdtinker application is a framework to program for RubyWebDialogs.
9
9
  require_paths:
10
10
  - "."
@@ -141,6 +141,7 @@ files:
141
141
  - rwd_files/rwdindex.html
142
142
  - rwd_files/tinker.png
143
143
  - zips/rwdahelloworld-0.5.zip
144
+ - tests/RubyGauge.rb
144
145
  - tests/totranslate.lang
145
146
  - tests/cleancnf.sh
146
147
  - tests/rdep.rb