Class: Opal::CliRunners::Bun

Inherits:
Object
  • Object
show all
Defined in:
lib/opal/cli_runners/bun.rb

Defined Under Namespace

Classes: MissingBun

Class Method Summary collapse

Class Method Details

.call(data) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/opal/cli_runners/bun.rb', line 11

def self.call(data)
  argv = data[:argv].dup.to_a

  SystemRunner.call(data) do |tempfile|
    opts = Shellwords.shellwords(ENV['BUN_OPTS'] || '')
    [
      'bun',
      'run',
      *opts,
      tempfile.path,
      *argv
    ]
  end
rescue Errno::ENOENT
  raise MissingBun, 'Please install Bun to be able to run Opal scripts.'
end