Sha256: 39166f8e3250acbfac3b77d585cc2781ec22f0b1965997e7b8fe086f51713285

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 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 protects this work.
# See 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.1 bin/ember