Sha256: 543d6fefef60d1b52fe165232ddbc9aee898b92dd181bf799c5e4b761f3b2f22

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'generators/jquery'

module Jquery
  module Generators
    class InstallGenerator < Rails::Generators::Base
      extend TemplatePath

      class_option :ui, :type => :boolean, :default => false, :desc => "Indicates when to Include JQueryUI (minified version; source: Google Libraries API)"

      def download_jquery_files
        %w(controls.js dragdrop.js effects.js prototype.js rails.js).each do |js|
          remove_file "public/javascripts/#{js}"
        end

        # Downloading latest jQuery.min
        get "http://code.jquery.com/jquery-latest.min.js", "public/javascripts/jquery.js"

        # Downloading latest jQuery drivers
        get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
      end
      
      def download_jqueryui_files
        # Downloading latest jQueryUI minified
        get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js", "public/javascripts/jqueryui.js" if options.ui?
      end
      
      def show_readme
        readme "README"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails3-generators-0.12.1 lib/generators/jquery/install/install_generator.rb