Sha256: 3bfd35c60f4256d311709438d7b0d9427137d34124d93684db2d8518385fd07d
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
require 'kangaroo/commands/base' require 'kangaroo/commands/endpoint' require 'kangaroo/viz' module Kangaroo module Commands class Viz < Base def run super initialize_global_endpoint init_viz.generate end protected def set_load_associations *args @load_associations = true end def set_file file @file = file end def set_type type @type = type end def setup_options p super setup_option p, '--load_associations', 'Wether to load associated models too.' setup_option p, "--type FILE", "Specify output type (e.g. png, pdf, svg, etc. see ruby-graphviz)" setup_option p, "--file TYPE", "Specify output file (e.g. kangaroo_models.png)" end def initialize_global_endpoint ::Kang.connect configuration, logger ::Kang.load_models! ::Kang.load_associated_models! if @load_associations end def init_viz Kangaroo::Viz::Base.new(::Kang.namespace).tap do |viz| viz.namespace.dont_load_models = !@load_associations viz.file = @file || "kangaroo_viz.png" viz.type = @type || "png" end end def banner "".tap do |s| s << 'kangviz - Generate graphviz for OpenERP models.' s << '' s << 'Usage:' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kangaroo-0.1.0.alpha1 | lib/kangaroo/commands/viz.rb |