forked from seattlerb/flay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
103 lines (80 loc) · 3.63 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
= flay
home :: http://ruby.sadi.st/
repo :: https://github.com/seattlerb/flay
rdoc :: http://seattlerb.rubyforge.org/flay
== DESCRIPTION:
Flay analyzes code for structural similarities. Differences in literal
values, variable, class, method names, whitespace, programming style,
braces vs do/end, etc are all ignored. Making this totally rad.
== FEATURES/PROBLEMS:
* Plugin system allows other languages to be flayed.
* Ships with .rb and .erb. javascript and others will be available separately.
* Includes FlayTask for Rakefiles.
* Differences in literal values, variable, class, and method names are ignored.
* Differences in whitespace, programming style, braces vs do/end, etc are ignored.
* Works across files.
* Reports differences at any level of code.
* Totally rad.
* Adds a score multiplier to identical nodes.
* Run verbose to see an N-way diff of the code.
== TODO:
* Editor integration (emacs, textmate, other contributions welcome).
* Score sequence fragments (a;b;c;d;e) vs (b;c;d) etc.
== SYNOPSIS:
% flay -v ~/Work/svn/ruby/ruby_1_8/lib/cgi.rb
Processing /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb...
Matches found in :defn (mass = 184)
A: /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb:1470
B: /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb:1925
A: def checkbox_group(name = "", *values)
B: def radio_group(name = "", *values)
if name.kind_of?(Hash) then
values = name["VALUES"]
name = name["NAME"]
end
values.collect do |value|
if value.kind_of?(String) then
A: (checkbox(name, value) + value)
B: (radio_button(name, value) + value)
else
if (value[(value.size - 1)] == true) then
A: (checkbox(name, value[0], true) + value[(value.size - 2)])
B: (radio_button(name, value[0], true) + value[(value.size - 2)])
else
A: (checkbox(name, value[0]) + value[(value.size - 1)])
B: (radio_button(name, value[0]) + value[(value.size - 1)])
end
end
end.to_s
end
IDENTICAL Matches found in :for (mass*2 = 144)
A: /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb:2160
B: /Users/ryan/Work/svn/ruby/ruby_1_8/lib/cgi.rb:2217
for element in ["HTML", "BODY", "P", "DT", "DD", "LI", "OPTION", "THEAD", "TFOOT", "TBODY", "COLGROUP", "TR", "TH", "TD", "HEAD"] do
methods = (methods + ((" def #{element.downcase}(attributes = {})\n" + nO_element_def(element)) + " end\n"))
end
...
== REQUIREMENTS:
* ruby_parser
* sexp_processor
== INSTALL:
* sudo gem install flay
== LICENSE:
(The MIT License)
Copyright (c) Ryan Davis, Seattle.rb
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.