lib/js_routes/instance.rb in js-routes-2.2.9 vs lib/js_routes/instance.rb in js-routes-2.2.10
- old
+ new
@@ -1,9 +1,10 @@
# typed: strict
require "js_routes/configuration"
require "js_routes/route"
require "js_routes/types"
+require 'fileutils'
module JsRoutes
class Instance # :nodoc:
include JsRoutes::Types
extend T::Sig
@@ -53,9 +54,16 @@
File.open(file_path, 'w') do |f|
f.write source_code
end
end
+ end
+
+ sig { void }
+ def remove!
+ path = Rails.root.join(@configuration.output_file)
+ FileUtils.rm_rf(path)
+ FileUtils.rm_rf(path.sub(%r{\.js\z}, '.d.ts'))
end
protected
sig { returns(T::Hash[String, String]) }