Sha256: 048be65e8de270068f62dc81b7b8d9ff012f5f932ebcb7587a8fd4f4fe986479

Contents?: true

Size: 721 Bytes

Versions: 45

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

require 'open3'

module Proscenium
  class Precompile
    def self.call
      new.call
    end

    def call
      Rails.application.config.proscenium.glob_types.find do |type, globs|
        cmd = "#{cli type} --root #{Rails.root} '#{globs.join "' '"}' --write"
        _, stderr, status = Open3.capture3(cmd)

        raise stderr unless status.success?
        raise "#{type} compiliation failed -- #{stderr}" unless stderr.empty?
      end
    end

    private

    def cli(type)
      if ENV['PROSCENIUM_TEST']
        "deno run -q --import-map import_map.json -A lib/proscenium/compilers/#{type}.js"
      else
        Gem.bin_path 'proscenium', type.to_s
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
proscenium-0.6.0-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.6.0-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.6.0-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.5.1-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.5.1-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.5.1-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.5.0-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.5.0-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.5.0-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.4.2-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.4.2-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.4.2-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.4.1-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.4.1-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.4.1-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.4.0-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.4.0-x86_64-darwin lib/proscenium/precompile.rb
proscenium-0.4.0-x86_64-linux lib/proscenium/precompile.rb
proscenium-0.3.0-arm64-darwin lib/proscenium/precompile.rb
proscenium-0.3.0-x86_64-darwin lib/proscenium/precompile.rb