Sha256: ea7434c45e727a78da79343a77a1d14ecd83bac89110282a170656406cbd8a8e

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

module CacheableFlash
  # Copies javascript libraries flash.js and jquery.cookie.js to public/javascripts/ (Rails 3.0.X only, Rails 3.1 has asset pipeline)
  #
  # @example
  #   $ rails generate cacheable_flash:install
  #
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('../../../../../vendor/assets/javascripts/', __FILE__)

    # Rails 3.1 has the asset pipeline, no need to copy javascript files anymore
    # Rails 3.0 doesn't have an asset pipeline, so we copy in javascript files
    desc "Copies some JS files to public/javascripts/"
    def copy_files
      # Also raise this deprecation in rails 4
      if (::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1) || ::Rails::VERSION::MAJOR > 3
        ActiveSupport::Deprecation.warn("Rails 3.1 has the asset pipeline, so you only need to copy javascript files if you aren't using it.")
      end
      template 'flash.js',     'public/javascripts/flash.js'
      template 'jquery.cookie.js', 'public/javascripts/jquery.cookie.js'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cacheable_flash-0.3.4 lib/generators/cacheable_flash/install/install_generator.rb
cacheable_flash-0.3.3 lib/generators/cacheable_flash/install/install_generator.rb