module RubyNext::Language::GemTranspiler

Module responsible for transpiling a library at load time

Public Class Methods

maybe_transpile(root_dir, lib_dir, target_dir) click to toggle source
# File lib/ruby-next/language/setup.rb, line 11
def self.maybe_transpile(root_dir, lib_dir, target_dir)
  return if File.directory?(target_dir)

  Dir.chdir(root_dir) do
    unless system("bundle exec ruby-next nextify ./#{lib_dir} -o #{target_dir} > /dev/null 2>&1")
      RubyNext.warn "Traspiled files are missing in: #{target_dir}. \n" \
        "Make sure you have gem 'ruby-next' in your Gemfile to auto-transpile the required files from source on load. " \
        "Otherwise the code from #{root_dir} may not work correctly."
    end
  end
end