Sha256: 453dd99f536b7af619e0af10ca3cf4d894601e2b1620be144040405dae30ba24

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

module Jquery
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      desc "This generator downloads and installs jQuery 1.4.2, jQuery-ujs HEAD, and (optionally) jQuery UI 1.8.4"
      class_option :ui, :type => :boolean, :default => false, :desc => "Indicates when to Include JQueryUI (minified version; source: Google Libraries API)"

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

      def download_jquery
        # Downloading latest jQuery
        get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", "public/javascripts/jquery.min.js"
        get "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js", "public/javascripts/jquery.js"

        # Downloading latest jQueryUI minified
        get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js", "public/javascripts/jquery-ui.min.js" if options.ui?
        get "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js", "public/javascripts/jquery-ui.js" if options.ui?
      end

      def download_ujs_driver
        # Downloading latest jQuery drivers
        get "http://github.com/rails/jquery-ujs/raw/master/src/rails.js", "public/javascripts/rails.js"
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jquery-rails-0.1.3 lib/generators/jquery/install/install_generator.rb
jquery-rails-0.1.2 lib/generators/jquery/install/install_generator.rb
jquery-rails-0.1.1 lib/generators/jquery/install/install_generator.rb