Sha256: 6eafecfce84e52e7bc1dc8fdfa58978af4983890efa2f947f0a697d3fbe0a95a

Contents?: true

Size: 1.64 KB

Versions: 13

Compression:

Stored size: 1.64 KB

Contents

#
#       ActiveFacts Generators.
#       Provides help for afgen - from afgen --help
#
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
#
require 'activefacts/persistence'

module ActiveFacts
  module Generate
    # 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/generate/**/*.rb"].
	      reject{|p|
		p =~ %r{/(transform|helpers)/}
	      }.
	      map{|p|
                p.sub(%r{.*/activefacts/generate/}, '').sub(/\.rb/,'')
              }
          }
	transformers = $:.
	  map{|path|
            Dir[path+"/activefacts/generate/transform/**/*.rb"].
	      map{|p|
                p.sub(%r{.*/activefacts/generate/}, '').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::Generate::HELP)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
activefacts-1.6.0 lib/activefacts/generate/help.rb
activefacts-1.5.3 lib/activefacts/generate/help.rb
activefacts-1.5.2 lib/activefacts/generate/help.rb
activefacts-1.5.1 lib/activefacts/generate/help.rb
activefacts-1.5.0 lib/activefacts/generate/help.rb
activefacts-1.3.0 lib/activefacts/generate/help.rb
activefacts-1.2.1 lib/activefacts/generate/help.rb
activefacts-1.2.0 lib/activefacts/generate/help.rb
activefacts-1.1.0 lib/activefacts/generate/help.rb
activefacts-1.0.2 lib/activefacts/generate/help.rb
activefacts-1.0.1 lib/activefacts/generate/help.rb
activefacts-1.0.0 lib/activefacts/generate/help.rb
activefacts-0.8.18 lib/activefacts/generate/help.rb