#!/usr/bin/env ruby require "find" require "active_support/core_ext/string" # for camelize RENAME_RULES = { "bubble" => "card", "closed" => "closed", "poppable" => "closeable", "pop" => "closure", "bucket" => "board" } EXTENSIONS = %w[.rb .yml .html .js .css .erb] EXCLUDED_DIRS = %w[db .git script/renaming vendor/javascript] # Helper to build replacement regex patterns respecting case and separators def build_patterns(from, to) boundary = "(?<=\\A|[^a-zA-Z0-9])#{from}(?=[^a-zA-Z0-9]|\\z)" camel = from.camelize camel_plural = camel.pluralize underscore_plural = from.pluralize.underscore dasherized_plural = underscore_plural.dasherize [ # Match lowercase boundary-delimited [ /#{boundary}/, to ], # Match capitalized version (e.g., Bubble => Card) [ /(? cards(:logo)) [ /(?