flay 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +4 -2
- data/History.txt +10 -0
- data/bin/flay +0 -1
- data/lib/flay.rb +20 -8
- metadata +11 -11
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 2.1.0 / 2013-02-13
|
2
|
+
|
3
|
+
* 5 minor enhancements:
|
4
|
+
|
5
|
+
* Added --timeout option. Defaults to 10 seconds.
|
6
|
+
* Added ability for plugins to define options_<pluginname> method to extend options.
|
7
|
+
* Flay no longer defaults to '.' if no args given. Allows plugins to do more
|
8
|
+
* Moved #analyze down to #report. #process only processes, nothing more.
|
9
|
+
* Sort output for more stable reporting. Better for diffing against, my dear.
|
10
|
+
|
1
11
|
=== 2.0.1 / 2012-12-18
|
2
12
|
|
3
13
|
* 2 bug fixes:
|
data/bin/flay
CHANGED
data/lib/flay.rb
CHANGED
@@ -15,7 +15,7 @@ class File
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class Flay
|
18
|
-
VERSION = '2.0
|
18
|
+
VERSION = '2.1.0'
|
19
19
|
|
20
20
|
def self.default_options
|
21
21
|
{
|
@@ -23,10 +23,11 @@ class Flay
|
|
23
23
|
:mass => 16,
|
24
24
|
:summary => false,
|
25
25
|
:verbose => false,
|
26
|
+
:timeout => 10,
|
26
27
|
}
|
27
28
|
end
|
28
29
|
|
29
|
-
def self.parse_options
|
30
|
+
def self.parse_options args = ARGV
|
30
31
|
options = self.default_options
|
31
32
|
|
32
33
|
OptionParser.new do |opts|
|
@@ -46,7 +47,8 @@ class Flay
|
|
46
47
|
abort "--fuzzy is no longer supported. Sorry. It sucked."
|
47
48
|
end
|
48
49
|
|
49
|
-
opts.on('-m', '--mass MASS', Integer,
|
50
|
+
opts.on('-m', '--mass MASS', Integer,
|
51
|
+
"Sets mass threshold (default = #{options[:mass]})") do |m|
|
50
52
|
options[:mass] = m.to_i
|
51
53
|
end
|
52
54
|
|
@@ -62,13 +64,23 @@ class Flay
|
|
62
64
|
options[:summary] = true
|
63
65
|
end
|
64
66
|
|
67
|
+
opts.on('-t', '--timeout TIME', Integer,
|
68
|
+
"Set the timeout. (default = #{options[:timeout]})") do |t|
|
69
|
+
options[:timeout] = t.to_i
|
70
|
+
end
|
71
|
+
|
65
72
|
extensions = ['rb'] + Flay.load_plugins
|
66
73
|
|
67
74
|
opts.separator ""
|
68
75
|
opts.separator "Known extensions: #{extensions.join(', ')}"
|
69
76
|
|
77
|
+
extensions.each do |meth|
|
78
|
+
msg = "options_#{meth}"
|
79
|
+
send msg, opts, options if self.respond_to?(msg)
|
80
|
+
end
|
81
|
+
|
70
82
|
begin
|
71
|
-
opts.parse!
|
83
|
+
opts.parse! args
|
72
84
|
rescue => e
|
73
85
|
abort "#{e}\n\n#{opts}"
|
74
86
|
end
|
@@ -155,8 +167,6 @@ class Flay
|
|
155
167
|
warn " skipping #{file}: #{e.message}"
|
156
168
|
end
|
157
169
|
end
|
158
|
-
|
159
|
-
analyze
|
160
170
|
end
|
161
171
|
|
162
172
|
def analyze
|
@@ -172,7 +182,7 @@ class Flay
|
|
172
182
|
|
173
183
|
def process_rb file
|
174
184
|
begin
|
175
|
-
RubyParser.new.process(File.binread(file), file)
|
185
|
+
RubyParser.new.process(File.binread(file), file, option[:timeout])
|
176
186
|
rescue Timeout::Error
|
177
187
|
warn "TIMEOUT parsing #{file}. Skipping."
|
178
188
|
end
|
@@ -251,6 +261,8 @@ class Flay
|
|
251
261
|
end
|
252
262
|
|
253
263
|
def report prune = nil
|
264
|
+
analyze
|
265
|
+
|
254
266
|
puts "Total score (lower is better) = #{self.total}"
|
255
267
|
puts
|
256
268
|
|
@@ -282,7 +294,7 @@ class Flay
|
|
282
294
|
puts "%d) %s code found in %p (mass%s = %d)" %
|
283
295
|
[count, match, node.first, bonus, mass]
|
284
296
|
|
285
|
-
nodes.each_with_index do |x, i|
|
297
|
+
nodes.sort_by { |x| [x.file, x.line] }.each_with_index do |x, i|
|
286
298
|
if option[:diff] then
|
287
299
|
c = (?A.ord + i).chr
|
288
300
|
puts " #{c}: #{x.file}:#{x.line}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Davis
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
37
|
-----END CERTIFICATE-----
|
38
38
|
|
39
|
-
date:
|
39
|
+
date: 2013-02-14 00:00:00 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sexp_processor
|
@@ -76,11 +76,11 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ~>
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
79
|
+
hash: 23
|
80
80
|
segments:
|
81
81
|
- 4
|
82
|
-
-
|
83
|
-
version: "4.
|
82
|
+
- 6
|
83
|
+
version: "4.6"
|
84
84
|
type: :development
|
85
85
|
version_requirements: *id003
|
86
86
|
- !ruby/object:Gem::Dependency
|
@@ -106,11 +106,11 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
hash:
|
109
|
+
hash: 13
|
110
110
|
segments:
|
111
111
|
- 3
|
112
|
-
-
|
113
|
-
version: "3.
|
112
|
+
- 5
|
113
|
+
version: "3.5"
|
114
114
|
type: :development
|
115
115
|
version_requirements: *id005
|
116
116
|
description: |-
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
requirements: []
|
170
170
|
|
171
171
|
rubyforge_project: seattlerb
|
172
|
-
rubygems_version: 1.8.
|
172
|
+
rubygems_version: 1.8.25
|
173
173
|
signing_key:
|
174
174
|
specification_version: 3
|
175
175
|
summary: Flay analyzes code for structural similarities
|
metadata.gz.sig
CHANGED
Binary file
|