Sha256: 5a67b5cf58503af36f94c809a616d598f32fb48b88340384690b5acff9eb653f
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require_relative "../lib/template-ruby" require "dorian/arguments" parsed = Dorian::Arguments.parse( input: { type: :string, alias: :i }, parse: { type: :boolean, alias: :p }, profile: :boolean, profiler: :string, timeout: { type: :integer, alias: :t }, version: { type: :boolean, alias: :v }, help: { type: :boolean, alias: :h } ) abort Template::Version.to_s if parsed.options.version abort parsed.help if parsed.options.help input = parsed.options.input.to_s input = File.read(input) if File.exist?(input) input += parsed.arguments.join(" ") input += parsed.files.map { |file| File.read(file) }.join abort parsed.help if input.empty? profile = parsed.options.profile || !parsed.options.profiler.empty? require "ruby-prof" if profile RubyProf.start if profile if parsed.options.parse pp Template::Parser.parse(input).to_raw else print( Template.evaluate( input, output: $stdout, error: $stderr, timeout: parsed.options.timeout ) ) end if profile result = RubyProf.stop printer = if parsed.options.profiler == "html" RubyProf::GraphHtmlPrinter.new(result) else RubyProf::FlatPrinter.new(result) end printer.print($stdout) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
template-ruby-1.1.2 | bin/template |
template-ruby-1.1.0 | bin/template |