Sha256: 0ee938e6f4336bb15edf57a102fc81ccfd7bc11438d2e89a163a4f08d414b609

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

#! /usr/bin/env ruby
#
#       ActiveFacts: Read a Vocabulary (from a NORMA, CQL or other file) and run a generator
#
# Copyright (c) 2009 Clifford Heath. Read the LICENSE file.
#
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
$:.unshift File.dirname(File.expand_path(__FILE__))+"/../lib"

require 'activefacts/metamodel'
require 'activefacts/compositions/binary'
require 'activefacts/compositions/relational'

arg = ARGV.shift

# Load the file type input method
if arg
  arg, *options = *arg.split(/=/)
  extension = arg.sub(/\A.*\./,'').downcase
  input_handler = "activefacts/input/#{extension}"
  require input_handler

  input_class = extension.upcase
  input_klass = ActiveFacts::Input.const_get(input_class.to_sym)
  raise "Expected #{input_handler} to define #{input_class}" unless input_klass
end

# Read the input file:
begin
  if input_klass
    vocabulary = input_klass.readfile(arg, *options)
  else
    vocabulary = true
  end

  exit 0 unless vocabulary

  vocabulary.finalise unless vocabulary == true

  compositor = ActiveFacts::Compositions::Relational.new(vocabulary.constellation, "test")
  compositor.generate

rescue => e
  $stderr.puts "#{e.message}"
  # puts "\t#{e.backtrace*"\n\t"}"
  $stderr.puts "\t#{e.backtrace*"\n\t"}" if trace :exception
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activefacts-compositions-1.9.1 bin/schema_compositor
activefacts-compositions-1.9.0 bin/schema_compositor