Skip to content

Instantly share code, notes, and snippets.

@DanielJette
Created April 25, 2019 14:08
Show Gist options
  • Save DanielJette/b7b8f83ef8948a16466b76e671a9872d to your computer and use it in GitHub Desktop.
Save DanielJette/b7b8f83ef8948a16466b76e671a9872d to your computer and use it in GitHub Desktop.
Rename fixtures and screenshots
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'find'
def rename_files(pattern, new_name)
file_paths = []
Find.find('.') do |path|
file_paths << path if path =~ /#{pattern}/
end
file_paths
file_paths.each do |path|
puts "Rename #{path} to #{path.sub(pattern, new_name)}"
File.rename(path, path.sub(pattern, new_name))
end
end
rename_files("AddCustomLineItemViewRendererScreenshotTest", "AddCustomLineItemViewRendererTest")
rename_files("AddVariantOptionValuesViewRendererTests", "AddVariantOptionValuesViewRendererTest")
rename_files("ChannelDetailsRendererTests", "ChannelDetailsRendererTest")
rename_files("DraftOrderEditDiscountViewRendererScreenshotTest", "DraftOrderEditDiscountViewRendererTest")
rename_files("EditLineItemViewRendererScreenshotTest", "EditLineItemViewRendererTest")
rename_files("EditVariantOptionsViewRendererTests", "EditVariantOptionsViewRendererTest")
rename_files("ImagePreviewRendererTests", "ImagePreviewRendererTest")
rename_files("OrderRefundViewRendererScreenshotTest", "OrderRefundViewRendererTest")
rename_files("ProductDetailRendererTests", "ProductDetailRendererTest")
rename_files("ProductDetailsOverflowViewRendererTests", "ProductDetailsOverflowViewRendererTest")
rename_files("ProductImagePreviewViewRendererTests", "ProductImagePreviewViewRendererTest")
rename_files("ProductOrganizationViewRendererTests", "ProductOrganizationViewRendererTest")
rename_files("ProductPublicationsViewRendererTests", "ProductPublicationsViewRendererTest")
rename_files("ProductShippingViewRendererTests", "ProductShippingViewRendererTest")
rename_files("ProductVariantInventoryViewRendererTests", "ProductVariantInventoryViewRendererTest")
rename_files("RemoveChannelRendererTests", "RemoveChannelRendererTest")
rename_files("RenameVariantOptionNameRendererTests", "RenameVariantOptionNameRendererTest")
rename_files("RichTextEditorViewRendererTests", "RichTextEditorViewRendererTest")
rename_files("AddCustomLineItemViewRendererScreenshotTest", "AddCustomLineItemViewRendererTest")
rename_files("AddVariantOptionValuesViewRendererTests", "AddVariantOptionValuesViewRendererTest")
rename_files("ChannelDetailsRendererTests", "ChannelDetailsRendererTest")
rename_files("DraftOrderEditDiscountViewRendererScreenshotTest", "DraftOrderEditDiscountViewRendererTest")
rename_files("EditLineItemViewRendererScreenshotTest", "EditLineItemViewRendererTest")
rename_files("EditVariantOptionsViewRendererTests", "EditVariantOptionsViewRendererTest")
rename_files("ImagePreviewRendererTests", "ImagePreviewRendererTest")
rename_files("OrderRefundViewRendererScreenshotTest", "OrderRefundViewRendererTest")
rename_files("ProductDetailRendererTests", "ProductDetailRendererTest")
rename_files("ProductDetailsOverflowViewRendererTests", "ProductDetailsOverflowViewRendererTest")
rename_files("ProductImagePreviewViewRendererTests", "ProductImagePreviewViewRendererTest")
rename_files("ProductOrganizationViewRendererTests", "ProductOrganizationViewRendererTest")
rename_files("ProductPublicationsViewRendererTests", "ProductPublicationsViewRendererTest")
rename_files("ProductShippingViewRendererTests", "ProductShippingViewRendererTest")
rename_files("ProductVariantInventoryViewRendererTests", "ProductVariantInventoryViewRendererTest")
rename_files("RemoveChannelRendererTests", "RemoveChannelRendererTest")
rename_files("RenameVariantOptionNameRendererTests", "RenameVariantOptionNameRendererTest")
rename_files("RichTextEditorViewRendererTests", "RichTextEditorViewRendererTest")
rename_files("StaffMemberViewRendererScreenshotTest", "StaffMemberViewRendererTest")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment