Class: Ruby::Reforge::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby/reforge/scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_path) ⇒ Scanner

Returns a new instance of Scanner.



9
10
11
12
# File 'lib/ruby/reforge/scanner.rb', line 9

def initialize(root_path)
  @root_path = root_path
  @issues = []
end

Instance Method Details

#scan(target_version) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby/reforge/scanner.rb', line 14

def scan(target_version)
  @target_version = normalize_version(target_version)
  @issues = []

  # Get migration rules for target version
  rules = MigrationRules.for_version(@target_version)

  # Add Rails rules if Rails project detected
  if RailsRules.detect_rails_project?(@root_path)
    rules = merge_rails_rules(rules)
  end

  # Scan Ruby files
  scan_ruby_files(rules)

  @issues
end