Class: RailsServerMonitor::CompileLocally

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_server_monitor/compile_locally.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compileObject



8
9
10
# File 'lib/rails_server_monitor/compile_locally.rb', line 8

def compile
  new.compile(skip_check: true)
end

.compile_forceObject



12
13
14
# File 'lib/rails_server_monitor/compile_locally.rb', line 12

def compile_force
  new.compile(skip_check: false)
end

Instance Method Details

#compile(skip_check:) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/rails_server_monitor/compile_locally.rb', line 17

def compile(skip_check:)
  unless skip_check
    return unless Rails.env.development? || Rails.env.test?
  end
  return if Dir.exist?(RailsServerMonitor::Engine.root.join("public", "rails-server-monitor-packs"))

  RailsServerMonitor.webpacker.commands.compile
  FileUtils.rm_rf(RailsServerMonitor::Engine.root.join("node_modules")) if ENV["KEEP_RAILS_SERVER_MONITOR_FILES"].blank?
end