Module: RubyNext::Language::GemTranspiler
- Defined in:
- lib/ruby-next/language/setup.rb
Overview
Module responsible for transpiling a library at load time
Class Method Summary collapse
Class Method Details
.maybe_transpile(root_dir, lib_dir, target_dir) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 command = "bundle exec ruby-next nextify " \ "./#{lib_dir} -o #{target_dir} --min-version=#{RubyNext.current_ruby_version}" unless system("#{command} > /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 |