Sha256: 1a4cd4194688011a4f4a2b28348ebedf7e33919649b8df3ce8b8c704e4b46828

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

require "rails"
require_relative "../rails_server_monitor"
module RailsServerMonitor
  class CompileLocally
    class << self
      def compile
        new.compile(skip_check: true)
      end

      def compile_force
        new.compile(skip_check: false)
      end
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-server-monitor-0.2.1 lib/rails_server_monitor/compile_locally.rb