Sha256: 2a756fcb16b92ce044089700253e7527b20f3a5b9631870c1044c4006b79d4d8

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

module Judge
  module Generators
    class InstallGenerator < ::Rails::Generators::Base

      desc %Q{For use where asset pipeline is disabled.
Installs judge.js and optionally installs underscore.js and json2.js.

Copy judge.js to public/javascripts:
  $ rails generate judge:install

Copy judge.js to different path:
  $ rails generate judge:install path

Copy judge.js and dependencies:
  $ rails generate judge:install path --underscore --json2
}

      argument :path, :type => :string, :default => "public/javascripts"
      class_option :underscore, :type => :boolean, :default => false, :desc => "Install underscore.js"
      class_option :json2, :type => :boolean, :default => false, :desc => "Install json2.js"
      source_root File.expand_path("../../../../..", __FILE__)

      def exec
        unless !::Rails.application.config.assets.enabled
          say_status("deprecated", "You don't need to use this generator as your app is running on Rails >= 3.1 with the asset pipeline enabled")
          return
        end
        say_status("copying", "judge.js", :green)
        copy_file("app/assets/javascripts/judge.js", "#{path}/judge.js")
        if options.underscore?
          say_status("copying", "underscore.js", :green)
          copy_file("vendor/assets/javascripts/underscore.js", "#{path}/underscore.js")
        end
        if options.json2?
          say_status("copying", "json2.js", :green)
          copy_file("vendor/assets/javascripts/json2.js", "#{path}/json2.js")
        end
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
judge-3.1.0 lib/generators/judge/install/install_generator.rb
judge-3.0.0 lib/generators/judge/install/install_generator.rb
judge-2.1.1 lib/generators/judge/install/install_generator.rb
judge-2.1.0 lib/generators/judge/install/install_generator.rb
judge-2.0.6 lib/generators/judge/install/install_generator.rb
judge-2.0.5 lib/generators/judge/install/install_generator.rb
judge-2.0.4 lib/generators/judge/install/install_generator.rb
judge-2.0.3 lib/generators/judge/install/install_generator.rb
judge-2.0.2 lib/generators/judge/install/install_generator.rb
judge-2.0.1 lib/generators/judge/install/install_generator.rb
judge-2.0.0 lib/generators/judge/install/install_generator.rb