Class: RailsEngineToolkit::Actions::RemoveEngine
- Inherits:
-
Object
- Object
- RailsEngineToolkit::Actions::RemoveEngine
- Defined in:
- lib/rails_engine_toolkit/actions/remove_engine.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(argv, stdin:, stdout:, root:, stderr: nil) ⇒ RemoveEngine
constructor
A new instance of RemoveEngine.
Constructor Details
#initialize(argv, stdin:, stdout:, root:, stderr: nil) ⇒ RemoveEngine
Returns a new instance of RemoveEngine.
6 7 8 9 10 11 12 13 |
# File 'lib/rails_engine_toolkit/actions/remove_engine.rb', line 6 def initialize(argv, stdin:, stdout:, root:, stderr: nil) @engine_name = argv[0] @stdin = stdin @stdout = stdout @stderr = stderr @root = Pathname(root) @project = Project.new(@root) end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rails_engine_toolkit/actions/remove_engine.rb', line 15 def call @project.validate_root! validate_engine! warn_if_root_migrations_exist! confirm_deletion! remove_mounts remove_gemfile_entry FileUtils.rm_rf(@project.engine_path(@engine_name)) Utils.safe_system('bundle', 'install', chdir: @root) @stdout.puts("Removed engine: #{@engine_name}") end |