Skip to content

Commit

Permalink
Smaller improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
eelcoj committed Dec 15, 2024
1 parent 7dfc432 commit 00f2f45
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/rails_icons/sync/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def sync

move_library

clean_temp_directory
purge_temp_directory
rescue => error
say "[Rails Icons] Failed to sync icons: #{error.message}", :red

Expand All @@ -44,7 +44,7 @@ def process_variants = Sync::ProcessVariants.new(@temp_directory, @library).proc

def remove_non_svg_files
Pathname.glob("#{@temp_directory}/**/*")
.select { |p| p.file? && p.extname != ".svg" }
.select { _1.file? && _1.extname != ".svg" }
.each(&:delete)

say "[Rails Icons] Non-SVG files removed successfully"
Expand All @@ -59,9 +59,7 @@ def move_library
say "[Rails Icons] Synced '#{@library[:name]}' library successfully #{%w[😃 🎉 ].sample}", :green
end

def clean_temp_directory
FileUtils.rm_rf(TEMP_DIRECTORY) if Dir.exist?(TEMP_DIRECTORY)
end
def purge_temp_directory = FileUtils.rm_rf(TEMP_DIRECTORY)

def post_error_clean_up
if yes?("Do you want to remove the temp files? ('#{@temp_directory}') [y/n]")
Expand Down

0 comments on commit 00f2f45

Please sign in to comment.