Giter Club home page Giter Club logo

activefacts-compositions's People

Contributors

cjheath avatar danielheath avatar graemeport avatar kirillrdy avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

activefacts-compositions's Issues

Usage message

Running schema_compositor does nothing (appears to be a synonym for /bin/true).

A usage message / suggestion to try --help would probably be better.

Running schema_compositor --help tells me there are a variety of compositors and generators, but not how to invoke them.

It would aid usage if the help message started with something like:

Usage: schema_compositor --<compositor> --<generator> [cql file]

Include generator command in warning comments

Currently files get # Auto-generated from CQL, edits will be lost prepended to them.

I propose starting them with:

# Auto-generated from 'bundle exec schema_compositor --relational=surrogates --rails/models=concern=Relations,output=app/models/relations warehouse.cql', edits will be lost.

Generation failed for provided sample

My repo: https://gist.github.com/DanielHeath/eba77378b400ebc876e24625e0c661cf

This contains the latest released version of activefacts-compositions and dependencies, and the CinemaTickets model.

  $ schema_compositor --binary --rails/models CinemaTickets.cql
gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:129:in `model_key': undefined method `all_index_field' for nil:NilClass (NoMethodError)
  from gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:143:in `model_body'
  from gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:106:in `generate_composite'
  from gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:47:in `block in generate'
  from gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:47:in `map'
  from gems/activefacts-compositions-1.9.19/lib/activefacts/generator/rails/models.rb:47:in `generate'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:129:in `block (2 levels) in process_files'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:128:in `each'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:128:in `block in process_files'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:85:in `each'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:85:in `process_files'
  from gems/activefacts-compositions-1.9.19/bin/schema_compositor:195:in `<top (required)>'
  from bin/schema_compositor:23:in `load'
  from bin/schema_compositor:23:in `<main>'

afcomp crashes if there is byebug

Steps to reproduce
afgen # in enviroment with no byebug installed

LoadError: cannot load such file -- byebug
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/lib/activefacts/generator/doc/glossary.rb:11:in `require'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/lib/activefacts/generator/doc/glossary.rb:11:in `<top (required)>'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:41:in `require'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:41:in `block (2 levels) in enumerate_available'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:39:in `select'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:39:in `block in enumerate_available'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/tracing-2.0.8/lib/tracing.rb:292:in `trace'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:36:in `enumerate_available'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/activefacts-compositions-1.9.18/bin/afcomp:183:in `<top (required)>'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/bin/afcomp:23:in `load'
  /kita/world/ruby-2.5.0/lib/ruby/gems/2.5.0/bin/afcomp:23:in `<top (required)>'

its a trivial fix, but I've noticed that glossary generator requires byebug, but its never listed as a dependecy.

Further more there are 2 references to "debugger" in code also with no mention of which debugger is being used

Rails model generator generaes duplicate ralationships name

example cql

vocabulary Warehousing;

Transfer Request ID is written as Auto Counter;
Warehouse ID is written as Auto Counter;

Transfer Request is identified by its ID;

Warehouse is identified by its ID;
Transfer Request is from one Warehouse (as Origin);
Transfer Request is to one Warehouse (as Destination);

running
schema_compositor --relational --rails/models Warehousing.cql
results in following

module TransferRequest
  extend ActiveSupport::Concern
  included do
    self.primary_key = 'transfer_request_id'

    # Transfer Request is to Destination
    belongs_to :destination, :class_name => 'Warehouse', :foreign_key => :destination_warehouse_id

    # Transfer Request is from Origin
    belongs_to :origin, :class_name => 'Warehouse', :foreign_key => :origin_warehouse_id

  end
end

module Warehouse
  extend ActiveSupport::Concern
  included do
    self.primary_key = 'warehouse_id'

    # Transfer Request is to Destination
    has_many :transfer_requests, :class_name => 'TransferRequest', :foreign_key => :destination_warehouse_id, :dependent => :destroy

    # Transfer Request is from Origin
    has_many :transfer_requests, :class_name => 'TransferRequest', :foreign_key => :origin_warehouse_id, :dependent => :destroy

  end
end

there are two has many transport_requests relationships being generated.
could we use roles ( i think they are called roles )
eg transfer_requests_as_origin and transfer_requests_as_destinations
it doesnt sound good from english point of view, perhaps this has_many relationship is not useful, but
has_many :destinations, :through => :transfer_requests_as_destinations, :source => :destination
( i might have got names wrong ( need cofee ))
but basic idea, for a given warehouse, give me all warehouses that I sent stuff to as relationship 1, and give me all warehouses that sent stuff to us as relationship 2.

Hope this makes sense

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.