Skip to content

Instantly share code, notes, and snippets.

@winks
Created February 15, 2013 21:44
Show Gist options
  • Save winks/4963783 to your computer and use it in GitHub Desktop.
Save winks/4963783 to your computer and use it in GitHub Desktop.
Want to know which methods Topaz lacks? Fret not, use this handy script!
#!/bin/sh
if [[ "x${2}" = "x" ]]; then
echo "Usage: $0 /path/to/mri /path/to/topaz"
exit 1
fi
mri_dir=`readlink -f $1`
topaz_dir=`readlink -f $2`
echo "Using MRI dir : $mri_dir"
echo "Using Topaz dir: $topaz_dir"
parts="string
array
range
random
proc
object
numeric
hash
file
encoding
dir
class
bignum
time"
for part in $parts; do
echo $part
filename="/tmp/___mri_${part}.txt"
grep "rb_define_method" ${mri_dir}/${part}.c | cut -d'"' -f 2 | sort -u > $filename
wc -l $filename
filename="/tmp/___topaz_${part}.txt"
grep classdef.method ${topaz_dir}/topaz/objects/${part}object.py | cut -d'"' -f 2 | sort > $filename
awk '/\(\"\"\"/,/\"\"\"\)/' ${topaz_dir}/topaz/objects/${part}object.py | awk '/ def/{print $2}' >> $filename
sort -u $filename -o $filename
wc -l $filename
done
$ sh collect.sh ./ruby-1.9.3-p385 ./topaz-upstream
Using MRI dir : /home/florian/code/python/topaz/ruby-1.9.3-p385
Using Topaz dir: /home/florian/code/python/topaz/topaz-upstream
string
108 /tmp/___mri_string.txt
51 /tmp/___topaz_string.txt
array
87 /tmp/___mri_array.txt
41 /tmp/___topaz_array.txt
range
20 /tmp/___mri_range.txt
8 /tmp/___topaz_range.txt
random
8 /tmp/___mri_random.txt
1 /tmp/___topaz_random.txt
proc
31 /tmp/___mri_proc.txt
4 /tmp/___topaz_proc.txt
object
75 /tmp/___mri_object.txt
22 /tmp/___topaz_object.txt
numeric
63 /tmp/___mri_numeric.txt
6 /tmp/___topaz_numeric.txt
hash
54 /tmp/___mri_hash.txt
25 /tmp/___topaz_hash.txt
file
52 /tmp/___mri_file.txt
15 /tmp/___topaz_file.txt
encoding
8 /tmp/___mri_encoding.txt
0 /tmp/___topaz_encoding.txt
dir
12 /tmp/___mri_dir.txt
3 /tmp/___topaz_dir.txt
class
3 /tmp/___mri_class.txt
5 /tmp/___topaz_class.txt
bignum
36 /tmp/___mri_bignum.txt
14 /tmp/___topaz_bignum.txt
time
58 /tmp/___mri_time.txt
3 /tmp/___topaz_time.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment