lib/synvert/cli.rb in synvert-0.0.1 vs lib/synvert/cli.rb in synvert-0.0.2

- old
+ new

@@ -1,24 +1,25 @@ # coding: utf-8 +require 'optparse' require 'find' module Synvert class CLI - def self.run - new.run + def self.run(args = ARGV) + new.run(args) end - def initialize - @checking_visitor = CheckingVisitor.new - end + 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 - def run - Find.find(".") do |path| - if FileTest.directory?(path) - next - else - @checking_visitor.convert_file(path) if path =~ /\.rb$/ - end + load(File.join(File.dirname(__FILE__), 'factory_girl/syntax_methods.rb')) + + ObjectSpace.each_object Synvert::Rewriter do |rewriter| + rewriter.process end end end end