Sha256: 14280eeb6568c65410aae0f0c3b5de63bf735c9fdf079e181fd38b6759f0ae8d

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

Contents

class BowerVendor::CleanGenerator < Rails::Generators::Base
  attr_accessor :utils

  class_option :force, type: :boolean, desc: 'Delete vendored bower assets without prompting'
  class_option :cached, type: :boolean, desc: "Delete only the bower cache from #{BowerVendor::BOWER_ROOT}"
  desc 'Cleans bower assets (CAUTION: Vendored asset directories for all bower packages will be deleted!)'
  def clean_packages
    return false unless Dir.exist? BowerVendor::BOWER_ROOT
    if !options.cached?
      @utils = BowerVendor::Utils.new
      utils.merged_paths.keys.each do |package|
        %w[javascripts stylesheets images].each do |prefix|
          path = File.join('vendor', 'assets', prefix, package)
          if Dir.exist? path
            if options.force? or yes?("Remove #{path}?", :cyan)
              remove_dir(path)
            end
          end
        end
      end
    else
      remove_dir(BowerVendor::BOWER_ROOT)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bower-vendor-0.0.5 lib/generators/bower_vendor/clean_generator.rb