class RenameGem::Renamer::Runner

Constants

EXCLUDED_DIRS

Attributes

context[R]
options[R]
reporter[R]

Public Class Methods

new(options) click to toggle source
# File lib/rename_gem/renamer/runner.rb, line 10
def initialize(options)
  @options = options
  @reporter = Reporter.new
  @context = Context.new(Dir.pwd, options[:path], options[:from], options[:to])
end

Public Instance Methods

run() click to toggle source
# File lib/rename_gem/renamer/runner.rb, line 16
def run
  directory = DirectoryHandler.new(context)
  recurse!(directory)

  reporter.print
end

Private Instance Methods

excluded_directory?(path) click to toggle source
# File lib/rename_gem/renamer/runner.rb, line 37
def excluded_directory?(path)
  EXCLUDED_DIRS.include? path.filename
end
recurse!(directory) click to toggle source
# File lib/rename_gem/renamer/runner.rb, line 25
def recurse!(directory)
  directory.change_files unless excluded_directory?(directory.path)

  directory.directories.each do |sub_directory|
    recurse!(sub_directory)

    sub_directory.rename unless excluded_directory?(sub_directory.path)
  end

  reporter << directory.results
end