Sha256: 471696f4c9916b4ccb20e661bf184cd1ac023cc5bd1ce12cc8f1a728384dfd21

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

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
  #
  # @todo Test with Rails 3.0
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('../../../../vendor/assets/javascripts', __FILE__)
    class_option :template_engine

    # 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
    if ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
      desc "Copies some JS files to public/javascripts/"
      def copy_files
        template 'flash.js',     'public/javascripts/flash.js'
        template 'jquery.cookie.js', 'public/javascripts/jquery.cookie.js'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cacheable_flash-0.2.0 lib/generators/cacheable_flash/install/install_generator.rb