namespace :asset_manager do
  desc "Migrates Assets to Asset Manager."
  task migrate_assets: :environment do
    MigrateAssetsToAssetManager.new.perform
  end
end

namespace :asset_manager do
  desc "Migrates Assets to Asset Manager."
  task :migrate_assets, [:target_dir] => :environment do |_, args|
    abort(usage_string) unless args[:target_dir]
    MigrateAssetsToAssetManager.new(args[:target_dir]).perform
  end

  private

  def usage_string
    %{Usage: asset_manager:migrate_assets[<path>]

      Where <path> is a subdirectory under Whitehall.clean_uploads_root e.g. `system/uploads/organisation/logo`
    }
  end
end

Make target_dir parameter of migrate_assets rake task
Make target_dir parameter of migrate_assets rake task
