Class: Gooby::CodeScanner

Inherits:
GoobyObject show all
Defined in:
lib/gooby.rb

Overview

This class reads and scans the Gooby code for various purposes.

Primarily, it is used to regenerate, on an ongoing basis, the various 
regression tests in file 'ts_gooby.rb'.  Regeneration retains the current 
test methods, adds stubs for new test methods, and flags obsolete methods. 

It is also used to create a Gooby class, module, and method "quick reference"
- somewhat similar to the TextMate symbol list.  

TODO: Method indexing and where used" functionality.

Instance Method Summary collapse

Methods included from GoobyKernel

#default_delimiter, #invalid_altitude, #invalid_latitude, #invalid_longitude, #invalid_time, #project_author, #project_copyright, #project_date, #project_embedded_comment, #project_license, #project_name, #project_version_number, #project_year, #read_as_ascii_lines, #read_lines, #strip_lines, #tokenize

Constructor Details

#initialize(argv) ⇒ CodeScanner

Returns a new instance of CodeScanner.



2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
# File 'lib/gooby.rb', line 2310

def initialize(argv)

  function = 'outline'
  if (argv.size > 0)
    function = argv[0]
  end
        
  @codebase_file = 'gooby.rb'
  @testbase_file = 'ts_gooby.rb'
  @code_lines    = read_lines("lib/#{@codebase_file}") 
  @test_lines    = read_lines("tests/#{@testbase_file}") 
  
  puts "code lines = #{@code_lines.size}" 
  puts "test lines = #{@test_lines.size}"

  @tokens_hash       = CounterHash.new      
  @module_names_hash = CounterHash.new 
  @class_names_hash  = CounterHash.new
  @method_names_hash = CounterHash.new
  @mc_line_num_array = Array.new
  @type_names        = Hash.new      
  @code_hash         = Hash.new
  @test_hash         = Hash.new
  @api_hash          = Hash.new
  @merged_hash       = Hash.new
  @exclude_classes   = Array.new 
                    
  regenerate_test_suite  if (function == 'regenerate_test_suite')
  regenerate_test_suite  if (function == 'tests') 

  model_class_outline    if (function == 'model_class_outline')  
  model_class_outline    if (function == 'outline')  
           
  quick_reference_guide  if (function == 'quick_reference_guide')      
  quick_reference_guide  if (function == 'qrg')   
  
  mcm_references         if (function == 'mcm_references')  
  mcm_references         if (function == 'mcm') 
end