Class: Synvert::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/synvert/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.run(args = ARGV) ⇒ Object



7
8
9
# File 'lib/synvert/cli.rb', line 7

def self.run(args = ARGV)
  new.run(args)
end

Instance Method Details

#run(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/synvert/cli.rb', line 11

def run(args)
  optparse = OptionParser.new do |opts|
    opts.banner = "Usage: synvert path"
  end
  paths = optparse.parse(args)
  Configuration.instance.set :path, paths.first || Dir.pwd

  load(File.join(File.dirname(__FILE__), 'factory_girl/syntax_methods.rb'))

  ObjectSpace.each_object Synvert::Rewriter do |rewriter|
    rewriter.process
  end
end