Sha256: 33512afa6926aa5f50f0c7b6fb2064a24e57ed771dad8c680ed16d5f4c912510

Contents?: true

Size: 430 Bytes

Versions: 2

Compression:

Stored size: 430 Bytes

Contents

#!/usr/bin/env ruby

# Merge a file with its includes, pass filename as first argument

TMP = ENV['TMP'] || '.tmp.mtl'

unless ARGV.size == 1
  puts "usage: #{File.basename(__FILE__)} [filename]"
  abort
end

file = ARGV.first

dir = File.dirname(file)
File.open(TMP, 'w') do |out|
  File.open(file).each_line do |line|
    if line =~ /\A#include "([^"]+)"/
      line = `cat #{dir}/#{$1}.mtl`
    end
    out.puts line
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nabaztag_hack_kit-0.1.0.alpha2 bytecode/bin/mtl_merge
nabaztag_hack_kit-0.1.0.alpha1 bytecode/bin/mtl_merge