Sha256: fe8eb2b3cc7c1332507b209f0733b95efef5488a28974b7401451e7788752d96

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

require 'yaml'
require 'active_support/all'
require "maprename/renamer"

module Maprename
  class App
    def initialize(config_file)
      @config = YAML.load(IO.read(config_file)).with_indifferent_access
    end

    def run!(dry = false)
      input_files.each do |file|
        file = File.join(@config[:input][:directory], file)
        Maprename::Renamer.new(file, @config).rename!(dry)
      end
    end

    def input_files
      Dir.children(@config[:input][:directory]).grep(Regexp.new(@config[:input][:pattern]))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maprename-0.1.0 lib/maprename/app.rb