Sha256: 742e5dd8419f5a72d072740382134e903ffe003ad4f64900a4c0e30428c0a1c9
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require 'wlang' require 'wlang/wlang_command_options' require 'wlang/dialects/standard_dialects' module WLang # # Provides the _wlang_ commandline tool. See 'wlang --help' for documentation. # class WLangCommand # Creates a commandline instance. def initialize() end # Run _wlang_ commandline on specific arguments def run(args) # parse the options options = Options.new.parse(args) # get output buffer buffer = STDOUT if options.output_file buffer = File.new(options.output_file, "w") end source = File.read(options.template_file) dialect = options.template_dialect braces = options.template_brace context = options.context_object unless options.context_name.nil? context = {options.context_name => context} end template = WLang::Template.new(source, dialect, context, braces) template.source_file = options.template_file if options.verbosity>1 puts "Instantiating #{options.template_file}" puts "Using dialect #{dialect} : #{dialect.class}" puts "Block delimiters are " << Template::BLOCK_SYMBOLS[braces].inspect puts "Context is " << context.inspect end buffer << template.instantiate # Flush and close if needed if File===buffer buffer.flush buffer.close end end end # class WLang end # module WLang
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wlang-0.8.5 | lib/wlang/wlang_command.rb |
wlang-0.8.4 | lib/wlang/wlang_command.rb |