Sha256: 7ba096eb2c55647fd070a325793ce9c404803d29183da3231ac0634c294b0ef7
Contents?: true
Size: 1.65 KB
Versions: 5
Compression:
Stored size: 1.65 KB
Contents
# # ActiveFacts Generators. # Provides help for afgen - from afgen --help # # Copyright (c) 2009 Clifford Heath. Read the LICENSE file. # require 'activefacts/registry' module ActiveFacts module Generators # Generate nothing from an ActiveFacts vocabulary. This is useful to check the file can be read ok. # Invoke as # afgen --null <file>.cql class HELP private def initialize(vocabulary, *options) generators = $:. map{|path| Dir[path+"/activefacts/generators/**/*.rb"]. reject{|p| p =~ %r{/(transform|helpers)/} }. map{|p| p.sub(%r{.*/activefacts/generators/}, '').sub(/\.rb/,'') } } transformers = $:. map{|path| Dir[path+"/activefacts/generators/transform/**/*.rb"]. map{|p| p.sub(%r{.*/activefacts/generators/}, '').sub(/\.rb/,'') } } puts %Q{ Usage: afgen [ --transformer[=options] ... ] [ --generator[=options] ... ] file.inp[=options] options are comma-separated lists. Use =help to get more information. Available generators are: #{generators.flatten.uniq.sort.join("\n\t") } Available transformers are: #{transformers.flatten.uniq.sort.join("\n\t") } inp is the name of a file input handler. Available input handlers are: #{$:.map{|path| Dir[path+"/activefacts/input/**.rb"].map{|p| p.sub(%r{.*/}, '').sub(/\.rb/,'') } }.flatten.uniq.sort.join("\n\t") } } end public def generate(out = $>) end end end end ActiveFacts::Registry.generator('help', ActiveFacts::Generators::HELP)
Version data entries
5 entries across 5 versions & 1 rubygems