From a42351acbc5406ab0825befe641144b4cb1ee6bf Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 16 Jan 2017 22:27:51 +0900 Subject: Add `app:update` task to engines Occasionally we update the file generated by engine. Therefore, I think that there is a task for updating as well as application in the engine, it is convenient for updating. --- railties/lib/rails/engine/updater.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 railties/lib/rails/engine/updater.rb (limited to 'railties/lib/rails/engine/updater.rb') diff --git a/railties/lib/rails/engine/updater.rb b/railties/lib/rails/engine/updater.rb new file mode 100644 index 0000000000..2ecf994a5c --- /dev/null +++ b/railties/lib/rails/engine/updater.rb @@ -0,0 +1,19 @@ +require "rails/generators" +require "rails/generators/rails/plugin/plugin_generator" + +module Rails + class Engine + class Updater + class << self + def generator + @generator ||= Rails::Generators::PluginGenerator.new ["plugin"], + { engine: true }, destination_root: ENGINE_ROOT + end + + def run(action) + generator.send(action) + end + end + end + end +end -- cgit v1.2.3