flay 1.4.3 → 2.0.0.b1
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 +15 -0
- data/README.txt +3 -1
- data/Rakefile +2 -2
- data/lib/flay.rb +10 -19
- data/test/test_flay.rb +6 -11
- metadata +47 -26
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
=== 2.0.0.b1 / 2012-08-07
|
2
|
+
|
3
|
+
* 2 major enhancements:
|
4
|
+
|
5
|
+
* Parses ruby 1.9! (still in beta)
|
6
|
+
* Moved Sexp#deep_each and Sexp#each_sexp to sexp_processor
|
7
|
+
|
8
|
+
* 1 minor enhancements:
|
9
|
+
|
10
|
+
* Use File.binread (File.read in 1.8) to bypass encoding errors
|
11
|
+
|
12
|
+
* 1 bug fix:
|
13
|
+
|
14
|
+
* Fixed failing tests against ruby_parser 3
|
15
|
+
|
1
16
|
=== 1.4.3 / 2011-08-10
|
2
17
|
|
3
18
|
* 1 bug fix:
|
data/README.txt
CHANGED
@@ -27,10 +27,11 @@ braces vs do/end, etc are all ignored. Making this totally rad.
|
|
27
27
|
|
28
28
|
* Editor integration (emacs, textmate, other contributions welcome).
|
29
29
|
* Score sequence fragments (a;b;c;d;e) vs (b;c;d) etc.
|
30
|
+
* Persistent DB for efficient cross-project flaying.
|
30
31
|
|
31
32
|
== SYNOPSIS:
|
32
33
|
|
33
|
-
% flay -v ~/Work/svn/ruby/ruby_1_8/lib/cgi.rb
|
34
|
+
% flay -v --diff ~/Work/svn/ruby/ruby_1_8/lib/cgi.rb
|
34
35
|
Processing /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb...
|
35
36
|
|
36
37
|
Matches found in :defn (mass = 184)
|
@@ -72,6 +73,7 @@ braces vs do/end, etc are all ignored. Making this totally rad.
|
|
72
73
|
|
73
74
|
* ruby_parser
|
74
75
|
* sexp_processor
|
76
|
+
* ruby2ruby -- soft dependency: only if you want to use --diff
|
75
77
|
|
76
78
|
== INSTALL:
|
77
79
|
|
data/Rakefile
CHANGED
@@ -15,8 +15,8 @@ Hoe.spec 'flay' do
|
|
15
15
|
self.rubyforge_name = 'seattlerb'
|
16
16
|
self.flay_threshold = 250
|
17
17
|
|
18
|
-
extra_deps << ['sexp_processor', '~>
|
19
|
-
extra_deps << ['ruby_parser', '~>
|
18
|
+
extra_deps << ['sexp_processor', '~> 4.0']
|
19
|
+
extra_deps << ['ruby_parser', '~> 3.0.0.a4']
|
20
20
|
end
|
21
21
|
|
22
22
|
# vim: syntax=ruby
|
data/lib/flay.rb
CHANGED
@@ -5,8 +5,16 @@ require 'rubygems'
|
|
5
5
|
require 'sexp_processor'
|
6
6
|
require 'ruby_parser'
|
7
7
|
|
8
|
+
class File
|
9
|
+
RUBY19 = "<3".respond_to? :encoding
|
10
|
+
|
11
|
+
class << self
|
12
|
+
alias :binread :read unless RUBY19
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
8
16
|
class Flay
|
9
|
-
VERSION = '
|
17
|
+
VERSION = '2.0.0.b1'
|
10
18
|
|
11
19
|
def self.default_options
|
12
20
|
{
|
@@ -162,7 +170,7 @@ class Flay
|
|
162
170
|
end
|
163
171
|
|
164
172
|
def process_rb file
|
165
|
-
RubyParser.new.process(File.
|
173
|
+
RubyParser.new.process(File.binread(file), file)
|
166
174
|
end
|
167
175
|
|
168
176
|
def process_sexp pt
|
@@ -303,21 +311,4 @@ class Sexp
|
|
303
311
|
end
|
304
312
|
hashes
|
305
313
|
end
|
306
|
-
|
307
|
-
# REFACTOR: move to sexp.rb
|
308
|
-
def deep_each(&block)
|
309
|
-
self.each_sexp do |sexp|
|
310
|
-
block[sexp]
|
311
|
-
sexp.deep_each(&block)
|
312
|
-
end
|
313
|
-
end
|
314
|
-
|
315
|
-
# REFACTOR: move to sexp.rb
|
316
|
-
def each_sexp
|
317
|
-
self.each do |sexp|
|
318
|
-
next unless Sexp === sexp
|
319
|
-
|
320
|
-
yield sexp
|
321
|
-
end
|
322
|
-
end
|
323
314
|
end
|
data/test/test_flay.rb
CHANGED
@@ -53,7 +53,7 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
53
53
|
def test_process_sexp
|
54
54
|
flay = Flay.new
|
55
55
|
|
56
|
-
s =
|
56
|
+
s = Ruby18Parser.new.process <<-RUBY
|
57
57
|
def x(n)
|
58
58
|
if n % 2 == 0
|
59
59
|
return n
|
@@ -63,9 +63,7 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
63
63
|
end
|
64
64
|
RUBY
|
65
65
|
|
66
|
-
expected = [
|
67
|
-
# HACK [:defn],
|
68
|
-
[:scope]] # only ones big enough
|
66
|
+
expected = [] # only ones big enough
|
69
67
|
|
70
68
|
flay.process_sexp s
|
71
69
|
|
@@ -77,7 +75,7 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
77
75
|
def test_process_sexp_full
|
78
76
|
flay = Flay.new(:mass => 1)
|
79
77
|
|
80
|
-
s =
|
78
|
+
s = Ruby18Parser.new.process <<-RUBY
|
81
79
|
def x(n)
|
82
80
|
if n % 2 == 0
|
83
81
|
return n
|
@@ -87,14 +85,11 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
87
85
|
end
|
88
86
|
RUBY
|
89
87
|
|
90
|
-
expected = [[:
|
91
|
-
[:block],
|
92
|
-
[:call, :call],
|
88
|
+
expected = [[:call, :call],
|
93
89
|
[:call],
|
94
90
|
[:if],
|
95
91
|
[:return],
|
96
|
-
[:return]
|
97
|
-
[:scope]]
|
92
|
+
[:return]]
|
98
93
|
|
99
94
|
flay.process_sexp s
|
100
95
|
|
@@ -124,7 +119,7 @@ class TestSexp < MiniTest::Unit::TestCase
|
|
124
119
|
|
125
120
|
flay = Flay.new opts
|
126
121
|
|
127
|
-
s =
|
122
|
+
s = Ruby18Parser.new.process <<-RUBY
|
128
123
|
class Dog
|
129
124
|
def x
|
130
125
|
return "Hello"
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 4094303487
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
- b
|
7
11
|
- 1
|
8
|
-
|
9
|
-
- 3
|
10
|
-
version: 1.4.3
|
12
|
+
version: 2.0.0.b1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Ryan Davis
|
@@ -36,7 +38,7 @@ cert_chain:
|
|
36
38
|
FBHgymkyj/AOSqKRIpXPhjC6
|
37
39
|
-----END CERTIFICATE-----
|
38
40
|
|
39
|
-
date:
|
41
|
+
date: 2012-08-07 00:00:00 Z
|
40
42
|
dependencies:
|
41
43
|
- !ruby/object:Gem::Dependency
|
42
44
|
name: sexp_processor
|
@@ -46,11 +48,11 @@ dependencies:
|
|
46
48
|
requirements:
|
47
49
|
- - ~>
|
48
50
|
- !ruby/object:Gem::Version
|
49
|
-
hash:
|
51
|
+
hash: 27
|
50
52
|
segments:
|
51
|
-
-
|
53
|
+
- 4
|
52
54
|
- 0
|
53
|
-
version: "
|
55
|
+
version: "4.0"
|
54
56
|
type: :runtime
|
55
57
|
version_requirements: *id001
|
56
58
|
- !ruby/object:Gem::Dependency
|
@@ -61,11 +63,14 @@ dependencies:
|
|
61
63
|
requirements:
|
62
64
|
- - ~>
|
63
65
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
66
|
+
hash: 4094286549
|
65
67
|
segments:
|
66
|
-
-
|
68
|
+
- 3
|
67
69
|
- 0
|
68
|
-
|
70
|
+
- 0
|
71
|
+
- a
|
72
|
+
- 4
|
73
|
+
version: 3.0.0.a4
|
69
74
|
type: :runtime
|
70
75
|
version_requirements: *id002
|
71
76
|
- !ruby/object:Gem::Dependency
|
@@ -74,31 +79,45 @@ dependencies:
|
|
74
79
|
requirement: &id003 !ruby/object:Gem::Requirement
|
75
80
|
none: false
|
76
81
|
requirements:
|
77
|
-
- -
|
82
|
+
- - ~>
|
78
83
|
- !ruby/object:Gem::Version
|
79
|
-
hash:
|
84
|
+
hash: 3
|
80
85
|
segments:
|
81
|
-
- 2
|
82
86
|
- 3
|
83
|
-
-
|
84
|
-
version:
|
87
|
+
- 2
|
88
|
+
version: "3.2"
|
85
89
|
type: :development
|
86
90
|
version_requirements: *id003
|
87
91
|
- !ruby/object:Gem::Dependency
|
88
|
-
name:
|
92
|
+
name: rdoc
|
89
93
|
prerelease: false
|
90
94
|
requirement: &id004 !ruby/object:Gem::Requirement
|
91
95
|
none: false
|
92
96
|
requirements:
|
93
97
|
- - ~>
|
94
98
|
- !ruby/object:Gem::Version
|
95
|
-
hash:
|
99
|
+
hash: 19
|
96
100
|
segments:
|
97
|
-
-
|
101
|
+
- 3
|
98
102
|
- 10
|
99
|
-
version: "
|
103
|
+
version: "3.10"
|
100
104
|
type: :development
|
101
105
|
version_requirements: *id004
|
106
|
+
- !ruby/object:Gem::Dependency
|
107
|
+
name: hoe
|
108
|
+
prerelease: false
|
109
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ~>
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
hash: 7
|
115
|
+
segments:
|
116
|
+
- 3
|
117
|
+
- 0
|
118
|
+
version: "3.0"
|
119
|
+
type: :development
|
120
|
+
version_requirements: *id005
|
102
121
|
description: |-
|
103
122
|
Flay analyzes code for structural similarities. Differences in literal
|
104
123
|
values, variable, class, method names, whitespace, programming style,
|
@@ -146,16 +165,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
166
|
none: false
|
148
167
|
requirements:
|
149
|
-
- - "
|
168
|
+
- - ">"
|
150
169
|
- !ruby/object:Gem::Version
|
151
|
-
hash:
|
170
|
+
hash: 25
|
152
171
|
segments:
|
153
|
-
-
|
154
|
-
|
172
|
+
- 1
|
173
|
+
- 3
|
174
|
+
- 1
|
175
|
+
version: 1.3.1
|
155
176
|
requirements: []
|
156
177
|
|
157
178
|
rubyforge_project: seattlerb
|
158
|
-
rubygems_version: 1.8.
|
179
|
+
rubygems_version: 1.8.24
|
159
180
|
signing_key:
|
160
181
|
specification_version: 3
|
161
182
|
summary: Flay analyzes code for structural similarities
|
metadata.gz.sig
CHANGED
Binary file
|