Sha256: ceec420d5ee676db8a337add9e0671f692b391f2737ffef8ee72e69e3725bdc6

Contents?: true

Size: 657 Bytes

Versions: 2

Compression:

Stored size: 657 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'tuga/transpiler'
require 'rubygems'

if ARGV.nil?
  puts <<~ERRO
    Código fonte não especificado. A sintaxe correta é:

    tuga ficheiro_codigo_fonte.pt
  ERRO
else
  ARGV.each do |file_path|
    next unless file_path

    unless Gem::Requirement.new('~> 3.2.0').satisfied_by?(Gem::Version.new(RUBY_VERSION))
      raise 'O requisito mínimo para executar é Ruby 3.2'
    end

    transpiler = Tuga::Transpiler.new
    tuga_code  = File.read(File.expand_path(file_path, File.dirname(__FILE__)), encoding: 'utf-8')
    ruby_code  = transpiler.to_ruby tuga_code

    eval ruby_code
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tuga-0.6.1 bin/tuga
tuga-0.6.0 bin/tuga