Sha256: e863f9700c84c264486a2aa2c333437519079a8d0337837aea2936e622349131

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/ruby -w
#
# Evaluates eRuby directives in the given eRuby template and
# writes the result to the standard output stream (STDOUT).
#
#
# Usage:
#
#   ember [Options] [Source]
#
#
#   Source:   Path to an eRuby template file.  If this parameter is
#             not specified, then the result of reading the standard
#             input stream (STDIN) will be used as the eRuby template.
#
#
# Options:
#

#--
# Copyright 2009 Suraj N. Kurapati
# See the LICENSE file for details.
#++

require 'rubygems'
gem 'inochi', '~> 1'
require 'inochi'

options = Inochi.main :Ember do
  opt :shorthand, 'Treat lines beginning with "%" as directives'
  opt :infer_end, 'Add "end" statements based on indentation'
  opt :unindent, 'Unindent block content hierarchically'
  opt :compile, 'Print template program and exit'
end

template =
  if source = ARGV.shift
    Ember::Template.load_file(source, options)
  else
    Ember::Template.new(STDIN.read, options)
  end

if options[:compile]
  puts template.program
else
  puts template.render
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ember-0.0.0 bin/ember