Sha256: a1633f60a341659ae12a9940a073d8ae80e8179bb3a5abdf4700f8e1b73808b6

Contents?: true

Size: 699 Bytes

Versions: 5

Compression:

Stored size: 699 Bytes

Contents

namespace :workarea do
  desc 'Initial setup for installation'
  task theme_cleanup: :environment do
    puts 'Cleaning up your theme for release!'
    original_sha = File.read('./lib/workarea/theme/override_commit').strip
    changed_files = `git diff --name-only HEAD #{original_sha}`.split("\n")

    # Remove any files that are unchanged since the original commit SHA
    # Reverse each to remove files within directories before attempting to delete the dir
    Dir['app/**/*'].reverse_each do |path|
      next if changed_files.include?(path)

      if File.directory?(path)
        Dir.rmdir path if Dir.entries(path).size == 2
      else
        File.delete(path)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
workarea-nvy_theme-1.2.1 lib/tasks/theme_cleanup.rake
workarea-nvy_theme-1.2.0 lib/tasks/theme_cleanup.rake
workarea-nvy_theme-1.1.4 lib/tasks/theme_cleanup.rake
workarea-nvy_theme-1.1.3 lib/tasks/theme_cleanup.rake
workarea-nvy_theme-1.1.2 lib/tasks/theme_cleanup.rake