Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add factory_bot_remover #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

NickLaMuro
Copy link
Owner

This script is really a one time script for searching for files that use FactoryBot.build or FactoryBot.create, and replace them with the straight ActiveRecord equivalents.

Might add some more functionality to this to auto commit as well, and search all repos at a time. We will see...

This script is really a one time script for searching for files that use
`FactoryBot.build` or `FactoryBot.create`, and replace them with the
straight `ActiveRecord` equivalents.
Refactoring of this script into a runnable class, but also so it can be
used in larger scripts.
Replaces external grep calls with custom some File/IO code.

Written in a way where each file being searched is only requires 1 open
operation, and only has to load in as much content as is necessary to do
the replace (thanks to `.rewind` and `truncate`).
Determines all original factories that need to be replaced, and replaces
them across all repos, creating a commit for each factory change.
Allows finding and replacing of FactoryBot calls that are defined
acrossed multiple lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant