Sha256: 4d956874b2dce44fd5b9b2c34b690eddacaf3cc26d1fb2a11616c175930995a8

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

# -*- coding: utf-8 -*-
require 'erb'
require 'pp'


NPARAM_MAX = 8
NTIMES     = (0..NPARAM_MAX)


def version ()
  open("VERSION") {|f| f.readline.chomp}
end

def glob (*patterns)
  paths = []
  patterns.each do |pattern|
    paths.concat Dir.glob(pattern)
  end
  paths
end

def erb (str)
  ERB.new(str, nil, "%").result binding
end

def compile (path, out)
  open(path) do |input|
    open(out, "w") do |output|
      output.write erb(input.read)
    end
  end
#rescue
end

def params (n, sep = "", &block)
  raise "block not given." unless block
  return "" if n == 0
  (1..n).map(&block).join(sep)
end

def convertions (paths, convs)
  raise "empty conversion." if convs.empty?
  paths.map! do |path|
    convpath = path
    convs.each do |from, to|
      convpath = convpath.sub(/#{from.gsub('.', '\.')}$/, to)
    end
    [path, convpath]
  end
  Hash[*paths.flatten]
end

alias sh_original sh

def sh (s)
  sh_original s
#rescue
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rucy-0.1.0 support.rb