Skip to content

Move sync_generator logic into classes #42

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

Merged
merged 2 commits into from
Dec 15, 2024
Merged

Move sync_generator logic into classes #42

merged 2 commits into from
Dec 15, 2024

Conversation

eelcoj
Copy link
Collaborator

@eelcoj eelcoj commented Dec 14, 2024

The goal of this PR is to keep things tidier:

  • use the sync_generator only as a "gateway" to Sync::Engine
  • extract some logic from the Sync::Engine into its own class that is only concerned with "processing variants" (mainly in anticipation for Phosphor Icons #40 and to make testing easier)


move_library

clean_temp_directory
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

purge_temp_directory is probably a better name


def remove_non_svg_files
Pathname.glob("#{@temp_directory}/**/*")
.select { |p| p.file? && p.extname != ".svg" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.select { _1.file? && _1.extname != ".svg" } ?

end

def clean_temp_directory
FileUtils.rm_rf(TEMP_DIRECTORY) if Dir.exist?(TEMP_DIRECTORY)
Copy link
Collaborator Author

@eelcoj eelcoj Dec 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unneeded if-check rm_rf does not raise an error if the directory doesn't exist. While at it: this probably doesn't need to be in a separate method?

@eelcoj eelcoj merged commit 3201b96 into main Dec 15, 2024
3 checks passed
@eelcoj eelcoj deleted the refactor branch December 15, 2024 19:05
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