flay 1.4.2 → 1.4.3
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.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/README.txt +4 -3
- data/Rakefile +2 -1
- data/lib/flay.rb +3 -6
- data/test/test_flay.rb +55 -0
- metadata +13 -16
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
|
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
= flay
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
home :: http://ruby.sadi.st/
|
|
4
|
+
repo :: https://github.com/seattlerb/flay
|
|
5
|
+
rdoc :: http://seattlerb.rubyforge.org/flay
|
|
5
6
|
|
|
6
7
|
== DESCRIPTION:
|
|
7
8
|
|
|
@@ -80,7 +81,7 @@ braces vs do/end, etc are all ignored. Making this totally rad.
|
|
|
80
81
|
|
|
81
82
|
(The MIT License)
|
|
82
83
|
|
|
83
|
-
Copyright (c)
|
|
84
|
+
Copyright (c) Ryan Davis, Seattle.rb
|
|
84
85
|
|
|
85
86
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
86
87
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
data/lib/flay.rb
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env ruby -w
|
|
2
2
|
|
|
3
|
-
$: << "../../ruby_parser/dev/lib"
|
|
4
|
-
$: << "../../ruby2ruby/dev/lib"
|
|
5
|
-
|
|
6
3
|
require 'optparse'
|
|
7
4
|
require 'rubygems'
|
|
8
5
|
require 'sexp_processor'
|
|
9
6
|
require 'ruby_parser'
|
|
10
7
|
|
|
11
8
|
class Flay
|
|
12
|
-
VERSION = '1.4.
|
|
9
|
+
VERSION = '1.4.3'
|
|
13
10
|
|
|
14
11
|
def self.default_options
|
|
15
12
|
{
|
|
@@ -197,7 +194,7 @@ class Flay
|
|
|
197
194
|
|
|
198
195
|
def n_way_diff *data
|
|
199
196
|
data.each_with_index do |s, i|
|
|
200
|
-
c = (?A + i).chr
|
|
197
|
+
c = (?A.ord + i).chr
|
|
201
198
|
s.group = c
|
|
202
199
|
end
|
|
203
200
|
|
|
@@ -274,7 +271,7 @@ class Flay
|
|
|
274
271
|
|
|
275
272
|
nodes.each_with_index do |x, i|
|
|
276
273
|
if option[:diff] then
|
|
277
|
-
c = (?A + i).chr
|
|
274
|
+
c = (?A.ord + i).chr
|
|
278
275
|
puts " #{c}: #{x.file}:#{x.line}"
|
|
279
276
|
else
|
|
280
277
|
puts " #{x.file}:#{x.line}"
|
data/test/test_flay.rb
CHANGED
|
@@ -109,4 +109,59 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
|
109
109
|
|
|
110
110
|
assert flay.hashes.empty?
|
|
111
111
|
end
|
|
112
|
+
|
|
113
|
+
def test_report
|
|
114
|
+
# make sure we run through options parser
|
|
115
|
+
$*.clear
|
|
116
|
+
$* << "-d"
|
|
117
|
+
$* << "--mass=1"
|
|
118
|
+
$* << "-v"
|
|
119
|
+
|
|
120
|
+
opts = nil
|
|
121
|
+
capture_io do # ignored
|
|
122
|
+
opts = Flay.parse_options
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
flay = Flay.new opts
|
|
126
|
+
|
|
127
|
+
s = RubyParser.new.process <<-RUBY
|
|
128
|
+
class Dog
|
|
129
|
+
def x
|
|
130
|
+
return "Hello"
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
class Cat
|
|
134
|
+
def y
|
|
135
|
+
return "Hello"
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
RUBY
|
|
139
|
+
|
|
140
|
+
flay.process_sexp s
|
|
141
|
+
flay.analyze
|
|
142
|
+
|
|
143
|
+
out, err = capture_io do
|
|
144
|
+
flay.report nil
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
exp = <<-END.gsub(/\d+/, "N").gsub(/^ {6}/, "")
|
|
148
|
+
Total score (lower is better) = 16
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
1) Similar code found in :class (mass = 16)
|
|
152
|
+
A: (string):1
|
|
153
|
+
B: (string):6
|
|
154
|
+
|
|
155
|
+
A: class Dog
|
|
156
|
+
B: class Cat
|
|
157
|
+
A: def x
|
|
158
|
+
B: def y
|
|
159
|
+
return \"Hello\"
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
END
|
|
163
|
+
|
|
164
|
+
assert_equal '', err
|
|
165
|
+
assert_equal exp, out.gsub(/\d+/, "N")
|
|
166
|
+
end
|
|
112
167
|
end
|
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: 1
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
8
|
- 4
|
|
9
|
-
-
|
|
10
|
-
version: 1.4.
|
|
9
|
+
- 3
|
|
10
|
+
version: 1.4.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Ryan Davis
|
|
@@ -36,8 +36,7 @@ cert_chain:
|
|
|
36
36
|
FBHgymkyj/AOSqKRIpXPhjC6
|
|
37
37
|
-----END CERTIFICATE-----
|
|
38
38
|
|
|
39
|
-
date: 2011-
|
|
40
|
-
default_executable:
|
|
39
|
+
date: 2011-08-10 00:00:00 Z
|
|
41
40
|
dependencies:
|
|
42
41
|
- !ruby/object:Gem::Dependency
|
|
43
42
|
name: sexp_processor
|
|
@@ -77,12 +76,12 @@ dependencies:
|
|
|
77
76
|
requirements:
|
|
78
77
|
- - ">="
|
|
79
78
|
- !ruby/object:Gem::Version
|
|
80
|
-
hash:
|
|
79
|
+
hash: 1
|
|
81
80
|
segments:
|
|
82
81
|
- 2
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
version: 2.
|
|
82
|
+
- 3
|
|
83
|
+
- 1
|
|
84
|
+
version: 2.3.1
|
|
86
85
|
type: :development
|
|
87
86
|
version_requirements: *id003
|
|
88
87
|
- !ruby/object:Gem::Dependency
|
|
@@ -91,14 +90,13 @@ dependencies:
|
|
|
91
90
|
requirement: &id004 !ruby/object:Gem::Requirement
|
|
92
91
|
none: false
|
|
93
92
|
requirements:
|
|
94
|
-
- -
|
|
93
|
+
- - ~>
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
|
-
hash:
|
|
95
|
+
hash: 23
|
|
97
96
|
segments:
|
|
98
97
|
- 2
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
version: 2.9.1
|
|
98
|
+
- 10
|
|
99
|
+
version: "2.10"
|
|
102
100
|
type: :development
|
|
103
101
|
version_requirements: *id004
|
|
104
102
|
description: |-
|
|
@@ -127,7 +125,6 @@ files:
|
|
|
127
125
|
- lib/gauntlet_flay.rb
|
|
128
126
|
- test/test_flay.rb
|
|
129
127
|
- .gemtest
|
|
130
|
-
has_rdoc: true
|
|
131
128
|
homepage: http://ruby.sadi.st/
|
|
132
129
|
licenses: []
|
|
133
130
|
|
|
@@ -158,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
158
155
|
requirements: []
|
|
159
156
|
|
|
160
157
|
rubyforge_project: seattlerb
|
|
161
|
-
rubygems_version: 1.
|
|
158
|
+
rubygems_version: 1.8.2
|
|
162
159
|
signing_key:
|
|
163
160
|
specification_version: 3
|
|
164
161
|
summary: Flay analyzes code for structural similarities
|
metadata.gz.sig
CHANGED
|
Binary file
|