ParseTree 1.4.0 → 1.4.1

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/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ *** 1.4.1 / 2006-04-10
2
+
3
+ + 4 minor enhancements:
4
+ + parse_tree_show -f output is much cleaner now.
5
+ + ParseTree does a much more elegant job of handling different versions.
6
+ + ParseTree now has all node names in ParseTree::NODE_NAMES.
7
+ + ParseTree now raises exceptions instead of freakin'.
8
+ + 3 bug fixes:
9
+ + Used multiruby to test against 1.8.2-4, 1.8 cvs, and 1.9 cvs.
10
+ + Fixed incompatibilites introduced in ruby 1.8.4.
11
+ + Fixed some incompatibilites introduced in ruby 1.9.x.
12
+
1
13
  *** 1.4.0 / 2005-10-15
2
14
 
3
15
  + 5 minor enhancements
data/Manifest.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  History.txt
2
- Makefile
2
+ Rakefile
3
3
  Manifest.txt
4
4
  ParseTree.gemspec
5
5
  README.txt
data/README.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  ParseTree
2
+ http://rubyforge.org/projects/parsetree/
2
3
  http://www.zenspider.com/ZSS/Products/ParseTree/
3
4
  support@zenspider.com
4
5
 
@@ -36,10 +37,12 @@ becomes:
36
37
  + Uses RubyInline, so it just drops in.
37
38
  + Includes SexpProcessor and CompositeSexpProcessor.
38
39
  + Allows you to write very clean filters.
39
- + Includes show.rb, which lets you quickly snoop code.
40
- + Includes abc.rb, which lets you get abc metrics on code.
40
+ + Includes parse_tree_show, which lets you quickly snoop code.
41
+ + echo "1+1" | parse_tree_show -f for quick snippet output.
42
+ + Includes parse_tree_abc, which lets you get abc metrics on code.
41
43
  + abc metrics = numbers of assignments, branches, and calls.
42
44
  + whitespace independent metric for method complexity.
45
+ + Includes parse_tree_deps, which shows you basic class level dependencies.
43
46
  + Only works on methods in classes/modules, not arbitrary code.
44
47
  + Does not work on the core classes, as they are not ruby (yet).
45
48
 
@@ -64,6 +67,10 @@ or:
64
67
 
65
68
  % ./parse_tree_show myfile.rb
66
69
 
70
+ or:
71
+
72
+ % echo "1+1" | ./parse_tree_show -f
73
+
67
74
  or:
68
75
 
69
76
  % ./parse_tree_abc myfile.rb
@@ -74,9 +81,8 @@ or:
74
81
 
75
82
  ** INSTALL:
76
83
 
77
- + sudo make install
78
- + renames show.rb to parse_tree_show
79
- + renames abc.rb to parse_tree_abc
84
+ + sudo rake install
85
+ + or: sudo gem install ParseTree
80
86
 
81
87
  ** LICENSE:
82
88
 
data/Rakefile ADDED
@@ -0,0 +1,80 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rbconfig'
4
+ require 'rake/rdoctask'
5
+
6
+ PREFIX = ENV['PREFIX'] || Config::CONFIG['prefix']
7
+ RUBYLIB = Config::CONFIG['sitelibdir']
8
+ RUBY_DEBUG = ENV['RUBY_DEBUG']
9
+ RUBY_FLAGS = ENV['RUBY_FLAGS'] || "-w -Ilib#{File::PATH_SEPARATOR}bin#{File::PATH_SEPARATOR}../../RubyInline/dev"
10
+ FILTER = ENV['FILTER']
11
+
12
+ LIB_FILES = %w(composite_sexp_processor.rb parse_tree.rb sexp.rb sexp_processor.rb)
13
+ TEST_FILES = %w(test_sexp_processor.rb)
14
+ BIN_FILES = %w(parse_tree_abc parse_tree_show parse_tree_deps)
15
+
16
+ task :default => :test
17
+
18
+ task :test do
19
+ ruby "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
20
+ end
21
+
22
+ task :multi do
23
+ sh "multiruby #{RUBY_FLAGS} test/test_all.rb #{FILTER}"
24
+ end
25
+
26
+ # we only install test_sexp_processor.rb to help make ruby_to_c's
27
+ # subclass tests work.
28
+
29
+ Rake::RDocTask.new(:docs) do |rd|
30
+ rd.main = "SexpProcessor"
31
+ rd.rdoc_files.include('./**/*').exclude('something.rb').exclude('test_*')
32
+ rd.options << '-d'
33
+ rd.options << '-Ipng'
34
+ end
35
+
36
+ task :install do
37
+ [
38
+ ['lib', LIB_FILES, RUBYLIB, 0444],
39
+ ['test', TEST_FILES, RUBYLIB, 0444],
40
+ ['bin', BIN_FILES, File.join(PREFIX, 'bin'), 0555]
41
+ ].each do |dir, list, dest, mode|
42
+ Dir.chdir dir do
43
+ list.each do |f|
44
+ install f, dest, :mode => mode
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ task :uninstall do
51
+ Dir.chdir RUBYLIB do
52
+ rm_f LIB_FILES
53
+ rm_f TEST_FILES
54
+ end
55
+ Dir.chdir File.join(PREFIX, 'bin') do
56
+ rm_f BIN_FILES
57
+ end
58
+ end
59
+
60
+ task :audit do
61
+ sh "ZenTest -Ilib#{File::PATH_SEPARATOR}test #{LIB_FILES.collect{|e| File.join('lib', e)}.join(' ')} test/test_all.rb"
62
+ # test_composite_sexp_processor.rb test_sexp_processor.rb
63
+ end
64
+
65
+ task :clean do
66
+ inline_dir = File.expand_path("~/.ruby_inline")
67
+ rm_rf inline_dir if test ?d, inline_dir
68
+ %w(diff diff.txt demo.rb *.gem **/*~).each do |pattern|
69
+ files = Dir[pattern]
70
+ rm_rf files unless files.empty?
71
+ end
72
+ end
73
+
74
+ task :demo do
75
+ verbose(false){sh "echo 1+1 | ruby #{RUBY_FLAGS} ./bin/parse_tree_show -f"}
76
+ end
77
+
78
+ task :gem do
79
+ ruby "ParseTree.gemspec"
80
+ end
data/bin/parse_tree_show CHANGED
@@ -38,6 +38,9 @@ new_classes = discover_new_classes_from do
38
38
  end
39
39
 
40
40
  result = ParseTree.new.parse_tree(*new_classes)
41
+
42
+ result = result[0][3][2][1][2..-1] if $f
43
+
41
44
  unless defined? $q then
42
45
  pp result
43
46
  else
data/lib/parse_tree.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/local/bin/ruby -w
2
2
 
3
- begin require 'rubygems' rescue LoadError end
3
+ begin require 'rubygems'; rescue LoadError; end
4
+
4
5
  require 'inline'
5
6
 
6
7
  ##
@@ -24,7 +25,7 @@ require 'inline'
24
25
 
25
26
  class ParseTree
26
27
 
27
- VERSION = '1.4.0'
28
+ VERSION = '1.4.1'
28
29
 
29
30
  ##
30
31
  # Initializes a ParseTree instance. Includes newline nodes if
@@ -94,15 +95,87 @@ class ParseTree
94
95
  parse_tree_for_meth(klass, method.to_sym, @include_newlines)
95
96
  end
96
97
 
98
+ if RUBY_VERSION < "1.8.4" then
99
+ inline do |builder|
100
+ builder.add_type_converter("bool", '', '')
101
+ builder.c_singleton "
102
+ bool has_alloca() {
103
+ (void)self;
104
+ #ifdef C_ALLOCA
105
+ return Qtrue;
106
+ #else
107
+ return Qfalse;
108
+ #endif
109
+ }"
110
+ end
111
+ else
112
+ def self.has_alloca
113
+ true
114
+ end
115
+ end
116
+
117
+
118
+ NODE_NAMES = [
119
+ # 00
120
+ :method, :fbody, :cfunc, :scope, :block,
121
+ :if, :case, :when, :opt_n, :while,
122
+ # 10
123
+ :until, :iter, :for, :break, :next,
124
+ :redo, :retry, :begin, :rescue, :resbody,
125
+ # 20
126
+ :ensure, :and, :or, :not, :masgn,
127
+ :lasgn, :dasgn, :dasgn_curr, :gasgn, :iasgn,
128
+ # 30
129
+ :cdecl, :cvasgn, :cvdecl, :op_asgn1, :op_asgn2,
130
+ :op_asgn_and, :op_asgn_or, :call, :fcall, :vcall,
131
+ # 40
132
+ :super, :zsuper, :array, :zarray, :hash,
133
+ :return, :yield, :lvar, :dvar, :gvar,
134
+ # 50
135
+ :ivar, :const, :cvar, :nth_ref, :back_ref,
136
+ :match, :match2, :match3, :lit, :str,
137
+ # 60
138
+ :dstr, :xstr, :dxstr, :evstr, :dregx,
139
+ :dregx_once, :args, :argscat, :argspush, :splat,
140
+ # 70
141
+ :to_ary, :svalue, :block_arg, :block_pass, :defn,
142
+ :defs, :alias, :valias, :undef, :class,
143
+ # 80
144
+ :module, :sclass, :colon2, :colon3, :cref,
145
+ :dot2, :dot3, :flip2, :flip3, :attrset,
146
+ # 90
147
+ :self, :nil, :true, :false, :defined,
148
+ # 95
149
+ :newline, :postexe, :alloca, :dmethod, :bmethod,
150
+ # 100
151
+ :memo, :ifunc, :dsym, :attrasgn,
152
+ # 104
153
+ :last
154
+ ]
155
+
156
+ if RUBY_VERSION < "1.8.4" then
157
+ NODE_NAMES.delete :alloca unless has_alloca
158
+ end
159
+
160
+ if RUBY_VERSION > "1.9" then
161
+ NODE_NAMES.insert NODE_NAMES.index(:hash), :values
162
+ NODE_NAMES.insert NODE_NAMES.index(:defined), :errinfo
163
+ NODE_NAMES.insert NODE_NAMES.index(:last), :prelude, :lambda
164
+ NODE_NAMES.delete :dmethod
165
+ NODE_NAMES[128] = NODE_NAMES.delete :newline
166
+ end
167
+
97
168
  ############################################################
98
169
  # END of rdoc methods
99
170
  ############################################################
100
171
 
101
172
  inline do |builder|
173
+ builder.add_type_converter("bool", '', '')
102
174
  builder.add_type_converter("VALUE", '', '')
103
175
  builder.add_type_converter("ID *", '', '')
104
176
  builder.add_type_converter("NODE *", '(NODE *)', '(VALUE)')
105
177
  builder.include '"intern.h"'
178
+ builder.include '"version.h"'
106
179
  builder.include '"node.h"'
107
180
  builder.include '"st.h"'
108
181
  builder.include '"env.h"'
@@ -129,14 +202,20 @@ class ParseTree
129
202
  # builder.add_compile_flags "-Wmissing-prototypes"
130
203
  # builder.add_compile_flags "-Wsign-compare"
131
204
 
205
+ def self.if_version(test, version, str)
206
+ RUBY_VERSION.send(test, version) ? str : ""
207
+ end
208
+
132
209
  builder.prefix %{
133
210
  #define nd_3rd u3.node
211
+ }
134
212
 
213
+ builder.prefix %{
135
214
  struct METHOD {
136
215
  VALUE klass, rklass;
137
216
  VALUE recv;
138
217
  ID id, oid;
139
- #{ RUBY_VERSION <= "1.8.2" ? "" : "int safe_level;" }
218
+ #{if_version :>, "1.8.2", "int safe_level;"}
140
219
  NODE *body;
141
220
  };
142
221
 
@@ -159,51 +238,9 @@ class ParseTree
159
238
  struct BLOCK *outer;
160
239
  struct BLOCK *prev;
161
240
  };
241
+ } unless RUBY_VERSION >= "1.9"
162
242
 
163
- static char node_type_string[][60] = {
164
- // 00
165
- "method", "fbody", "cfunc", "scope", "block",
166
- "if", "case", "when", "opt_n", "while",
167
- // 10
168
- "until", "iter", "for", "break", "next",
169
- "redo", "retry", "begin", "rescue", "resbody",
170
- // 20
171
- "ensure", "and", "or", "not", "masgn",
172
- "lasgn", "dasgn", "dasgn_curr", "gasgn", "iasgn",
173
- // 30
174
- "cdecl", "cvasgn", "cvdecl", "op_asgn1", "op_asgn2",
175
- "op_asgn_and", "op_asgn_or", "call", "fcall", "vcall",
176
- // 40
177
- "super", "zsuper", "array", "zarray", "hash",
178
- "return", "yield", "lvar", "dvar", "gvar",
179
- // 50
180
- "ivar", "const", "cvar", "nth_ref", "back_ref",
181
- "match", "match2", "match3", "lit", "str",
182
- // 60
183
- "dstr", "xstr", "dxstr", "evstr", "dregx",
184
- "dregx_once", "args", "argscat", "argspush", "splat",
185
- // 70
186
- "to_ary", "svalue", "block_arg", "block_pass", "defn",
187
- "defs", "alias", "valias", "undef", "class",
188
- // 80
189
- "module", "sclass", "colon2", "colon3", "cref",
190
- "dot2", "dot3", "flip2", "flip3", "attrset",
191
- // 90
192
- "self", "nil", "true", "false", "defined",
193
- // 95
194
- "newline", "postexe",
195
- #ifdef C_ALLOCA
196
- "alloca",
197
- #endif
198
- "dmethod", "bmethod",
199
- // 100 / 99
200
- "memo", "ifunc", "dsym", "attrasgn",
201
- // 104 / 103
202
- "last"
203
- };
204
- }
205
-
206
- builder.c_raw %q^
243
+ builder.c_raw %Q@
207
244
  static void add_to_parse_tree(VALUE ary,
208
245
  NODE * n,
209
246
  VALUE newlines,
@@ -213,16 +250,21 @@ static void add_to_parse_tree(VALUE ary,
213
250
  VALUE old_ary = Qnil;
214
251
  VALUE current;
215
252
  VALUE node_name;
253
+ static VALUE node_names = Qnil;
254
+
255
+ if (NIL_P(node_names)) {
256
+ node_names = rb_const_get_at(rb_const_get_at(rb_cObject,rb_intern("ParseTree")),rb_intern("NODE_NAMES"));
257
+ }
216
258
 
217
259
  if (!node) return;
218
260
 
219
261
  again:
220
262
 
221
263
  if (node) {
222
- node_name = ID2SYM(rb_intern(node_type_string[nd_type(node)]));
264
+ node_name = rb_ary_entry(node_names, nd_type(node));
223
265
  if (RTEST(ruby_debug)) {
224
- fprintf(stderr, "%15s: %s%s%s\n",
225
- node_type_string[nd_type(node)],
266
+ fprintf(stderr, "%15s: %s%s%s\\n",
267
+ rb_id2name(SYM2ID(node_name)),
226
268
  (RNODE(node)->u1.node != NULL ? "u1 " : " "),
227
269
  (RNODE(node)->u2.node != NULL ? "u2 " : " "),
228
270
  (RNODE(node)->u3.node != NULL ? "u3 " : " "));
@@ -244,7 +286,6 @@ again_no_block:
244
286
  add_to_parse_tree(current, node, newlines, locals);
245
287
  break;
246
288
  }
247
-
248
289
  contnode = node->nd_next;
249
290
 
250
291
  // NOTE: this will break the moment there is a block w/in a block
@@ -420,6 +461,7 @@ again_no_block:
420
461
  }
421
462
  break;
422
463
 
464
+ #{if_version :>, "1.9", '#if 0'}
423
465
  case NODE_DMETHOD:
424
466
  {
425
467
  struct METHOD *data;
@@ -428,9 +470,10 @@ again_no_block:
428
470
  add_to_parse_tree(current, data->body, newlines, locals);
429
471
  break;
430
472
  }
473
+ #{if_version :>, "1.9", '#endif'}
431
474
 
432
475
  case NODE_METHOD:
433
- fprintf(stderr, "u1 = %p u2 = %p u3 = %p\n", node->nd_1st, node->nd_2nd, node->nd_3rd);
476
+ fprintf(stderr, "u1 = %p u2 = %p u3 = %p\\n", node->nd_1st, node->nd_2nd, node->nd_3rd);
434
477
  add_to_parse_tree(current, node->nd_3rd, newlines, locals);
435
478
  break;
436
479
 
@@ -564,12 +607,11 @@ again_no_block:
564
607
  add_to_parse_tree(current, node->nd_body, newlines, locals);
565
608
  break;
566
609
 
567
- case NODE_ARGS:
568
- if (locals &&
569
- (node->nd_cnt || node->nd_opt || node->nd_rest != -1)) {
610
+ case NODE_ARGS: {
611
+ long arg_count = (long)node->nd_rest;
612
+ if (locals && (node->nd_cnt || node->nd_opt || arg_count != -1)) {
570
613
  int i;
571
614
  NODE *optnode;
572
- long arg_count;
573
615
 
574
616
  for (i = 0; i < node->nd_cnt; i++) {
575
617
  // regular arg names
@@ -584,18 +626,19 @@ again_no_block:
584
626
  optnode = optnode->nd_next;
585
627
  }
586
628
 
587
- arg_count = node->nd_rest;
588
629
  if (arg_count > 0) {
589
630
  // *arg name
590
- VALUE sym = rb_str_intern(rb_str_plus(rb_str_new2("*"), rb_str_new2(rb_id2name(locals[node->nd_rest + 1]))));
631
+ VALUE sym = rb_str_intern(rb_str_plus(rb_str_new2("*"), rb_str_new2(rb_id2name(locals[i + 3]))));
591
632
  rb_ary_push(current, sym);
633
+ } else if (arg_count == 0) {
634
+ // nothing to do in this case, empty list
592
635
  } else if (arg_count == -1) {
593
636
  // nothing to do in this case, handled above
594
637
  } else if (arg_count == -2) {
595
638
  // nothing to do in this case, no name == no use
596
639
  } else {
597
- puts("not a clue what this arg value is");
598
- exit(1);
640
+ rb_raise(rb_eArgError,
641
+ "not a clue what this arg value is: %ld", arg_count);
599
642
  }
600
643
 
601
644
  optnode = node->nd_opt;
@@ -604,7 +647,7 @@ again_no_block:
604
647
  add_to_parse_tree(current, node->nd_opt, newlines, locals);
605
648
  }
606
649
  }
607
- break;
650
+ } break;
608
651
 
609
652
  case NODE_LVAR:
610
653
  case NODE_DVAR:
@@ -676,7 +719,7 @@ again_no_block:
676
719
  add_to_parse_tree(current, node->nd_3rd, newlines, locals);
677
720
  break;
678
721
 
679
- case NODE_DSYM: // :"#{foo}" u1 u2 u3
722
+ case NODE_DSYM: // :"\#\{foo}" u1 u2 u3
680
723
  add_to_parse_tree(current, node->nd_3rd, newlines, locals);
681
724
  break;
682
725
 
@@ -702,11 +745,11 @@ again_no_block:
702
745
  // case NODE_LMASK:
703
746
  // case NODE_LSHIFT:
704
747
  default:
705
- rb_warn("Unhandled node #%d type '%s'", nd_type(node), node_type_string[nd_type(node)]);
748
+ rb_warn("Unhandled node #%d type '%s'", nd_type(node), rb_id2name(SYM2ID(rb_ary_entry(node_names, nd_type(node)))));
706
749
  if (RNODE(node)->u1.node != NULL) rb_warning("unhandled u1 value");
707
750
  if (RNODE(node)->u2.node != NULL) rb_warning("unhandled u2 value");
708
751
  if (RNODE(node)->u3.node != NULL) rb_warning("unhandled u3 value");
709
- if (RTEST(ruby_debug)) fprintf(stderr, "u1 = %p u2 = %p u3 = %p\n", node->nd_1st, node->nd_2nd, node->nd_3rd);
752
+ if (RTEST(ruby_debug)) fprintf(stderr, "u1 = %p u2 = %p u3 = %p\\n", node->nd_1st, node->nd_2nd, node->nd_3rd);
710
753
  rb_ary_push(current, INT2FIX(-99));
711
754
  rb_ary_push(current, INT2FIX(nd_type(node)));
712
755
  break;
@@ -722,9 +765,9 @@ again_no_block:
722
765
  goto again_no_block;
723
766
  }
724
767
  }
725
- ^ # end of add_to_parse_tree block
768
+ @ # end of add_to_parse_tree block
726
769
 
727
- builder.c %q{
770
+ builder.c %Q{
728
771
  static VALUE parse_tree_for_meth(VALUE klass, VALUE method, VALUE newlines) {
729
772
  VALUE n;
730
773
  NODE *node = NULL;
@@ -734,6 +777,11 @@ static VALUE parse_tree_for_meth(VALUE klass, VALUE method, VALUE newlines) {
734
777
  (void) self; // quell warnings
735
778
  (void) argc; // quell warnings
736
779
 
780
+ VALUE version = rb_const_get_at(rb_cObject,rb_intern("RUBY_VERSION"));
781
+ if (strcmp(StringValuePtr(version), #{RUBY_VERSION.inspect})) {
782
+ rb_fatal("bad version, %s != #{RUBY_VERSION}\\n", StringValuePtr(version));
783
+ }
784
+
737
785
  id = rb_to_id(method);
738
786
  if (st_lookup(RCLASS(klass)->m_tbl, id, &n)) {
739
787
  node = (NODE*)n;
@@ -133,7 +133,6 @@ class SexpProcessor
133
133
  # SexpProcessor
134
134
 
135
135
  def initialize
136
- @collection = []
137
136
  @default_method = nil
138
137
  @warn_on_default = true
139
138
  @auto_shift_type = false
data/test/something.rb CHANGED
@@ -202,8 +202,8 @@ class Something
202
202
 
203
203
  def self.dmethod_maker
204
204
  define_method :dmethod_added, self.method(:bmethod_maker)
205
- end
205
+ end if RUBY_VERSION < "1.9"
206
206
 
207
207
  bmethod_maker
208
- dmethod_maker
208
+ dmethod_maker if RUBY_VERSION < "1.9"
209
209
  end
@@ -1,5 +1,12 @@
1
1
  #!/usr/local/bin/ruby -w
2
2
 
3
+ dir = File.expand_path "~/.ruby_inline"
4
+ if test ?d, dir then
5
+ require 'fileutils'
6
+ puts "nuking #{dir}"
7
+ FileUtils.rm_r dir
8
+ end
9
+
3
10
  require 'test/unit'
4
11
  require 'parse_tree'
5
12
  require 'test/something'
@@ -308,7 +315,7 @@ class TestParseTree < Test::Unit::TestCase
308
315
  [:iter,
309
316
  [:fcall, :define_method, [:array, [:lit, :bmethod_added]]],
310
317
  [:dasgn_curr, :x],
311
- [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]]]]]]
318
+ [:call, [:dvar, :x], :+, [:array, [:lit, 1]]]]]]]] if RUBY_VERSION < "1.9"
312
319
 
313
320
  @@attrasgn = [:defn,
314
321
  :attrasgn,
metadata CHANGED
@@ -1,10 +1,10 @@
1
- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11.1
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11.6
3
3
  specification_version: 1
4
4
  name: ParseTree
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.4.0
7
- date: 2005-10-17 00:00:00 -07:00
6
+ version: 1.4.1
7
+ date: 2006-04-10 00:00:00 -07:00
8
8
  summary: Extract and enumerate ruby parse trees.
9
9
  require_paths:
10
10
  - lib
@@ -26,11 +26,12 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
26
26
  platform: ruby
27
27
  signing_key:
28
28
  cert_chain:
29
+ post_install_message:
29
30
  authors:
30
31
  - Ryan Davis
31
32
  files:
32
33
  - History.txt
33
- - Makefile
34
+ - Rakefile
34
35
  - Manifest.txt
35
36
  - README.txt
36
37
  - bin/parse_tree_abc
data/Makefile DELETED
@@ -1,57 +0,0 @@
1
- RUBY?=ruby
2
- RUBY_DEBUG?=
3
- RUBY_FLAGS?=-w -Ilib:bin:../../RubyInline/dev
4
- RUBY_LIB?=$(shell $(RUBY) -rrbconfig -e 'include Config; print CONFIG["sitelibdir"]')
5
- PREFIX?=/usr/local
6
- FILTER?=
7
-
8
- LIB_FILES= \
9
- composite_sexp_processor.rb \
10
- parse_tree.rb \
11
- sexp.rb \
12
- sexp_processor.rb \
13
- $(END)
14
-
15
- TEST_FILES= \
16
- test_sexp_processor.rb \
17
- $(END)
18
-
19
- BIN_FILES= \
20
- parse_tree_abc \
21
- parse_tree_show \
22
- parse_tree_deps \
23
- $(END)
24
-
25
- all test: FORCE
26
- $(RUBY) $(RUBY_DEBUG) $(RUBY_FLAGS) test/test_all.rb $(FILTER)
27
-
28
- # we only install test_sexp_processor.rb to help make ruby_to_c's
29
- # subclass tests work.
30
-
31
- docs:
32
- rdoc -d -I png --main SexpProcessor -x test_\* -x something.rb
33
-
34
- install:
35
- cd lib && install -m 0444 $(LIB_FILES) $(RUBY_LIB)
36
- cd test && install -m 0444 $(TEST_FILES) $(RUBY_LIB)
37
- cd bin && install -m 0555 $(BIN_FILES) $(PREFIX)/bin
38
-
39
- uninstall:
40
- cd $(RUBY_LIB) && rm -f $(LIB_FILES) $(TEST_FILES)
41
- cd $(PREFIX)/bin && rm -f $(BIN_FILES)
42
-
43
- audit:
44
- ZenTest -I=lib:test $(addprefix lib/,$(LIB_FILES)) test/test_all.rb
45
- # test_composite_sexp_processor.rb test_sexp_processor.rb
46
-
47
- clean:
48
- -find . -name \*~ | xargs rm
49
- -rm -fr diff diff.txt *.gem doc $$HOME/.ruby_inline
50
-
51
- demo:
52
- echo 1+1 | $(RUBY) $(RUBY_FLAGS) ./bin/parse_tree_show -f
53
-
54
- gem:
55
- ruby ParseTree.gemspec
56
-
57
- FORCE: