From 539752a54cf3426c98e65136206df9f9553d9e73 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 27 Jun 2011 21:54:03 -0300 Subject: Move Coffee generators and templates to Coffee Railtie and create javascript_engine ("js") for apps that remove Coffee gem --- railties/lib/rails/generators/js/assets/assets_generator.rb | 13 +++++++++++++ .../lib/rails/generators/js/assets/templates/javascript.js | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 railties/lib/rails/generators/js/assets/assets_generator.rb create mode 100644 railties/lib/rails/generators/js/assets/templates/javascript.js (limited to 'railties/lib/rails/generators/js/assets') diff --git a/railties/lib/rails/generators/js/assets/assets_generator.rb b/railties/lib/rails/generators/js/assets/assets_generator.rb new file mode 100644 index 0000000000..d134a9e392 --- /dev/null +++ b/railties/lib/rails/generators/js/assets/assets_generator.rb @@ -0,0 +1,13 @@ +require "rails/generators/named_base" + +module Js + module Generators + class AssetsGenerator < Rails::Generators::NamedBase + source_root File.expand_path("../templates", __FILE__) + + def copy_javascript + copy_file "javascript.js", File.join('app/assets/javascripts', class_path, "#{file_name}.js") + end + end + end +end diff --git a/railties/lib/rails/generators/js/assets/templates/javascript.js b/railties/lib/rails/generators/js/assets/templates/javascript.js new file mode 100644 index 0000000000..dee720facd --- /dev/null +++ b/railties/lib/rails/generators/js/assets/templates/javascript.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. -- cgit v1.2.3