Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extra config files to be listed via cli #275

Closed

Conversation

danielevans
Copy link
Contributor

In applications with complex entities having the ability to generate multiple ERDs with different settings is useful. For example, each diagram could be focused on a specific segment of the data model.

@kerrizor
Copy link
Collaborator

First off, thank you for submitting this AND for having patience with my tardy response.

I like this, but am going to put off merging this because I need to solve the split between the CLI and rake task invocations for v1.6 (#289)

@sfcgeorge
Copy link

This is what I have done in our app to allow multiple graphs. I've got the default top level one, then graphs for each sub-section of the app with a config file each.

if Rails.env.development?
  Rake::Task["db:migrate"].enhance do
    Rake::Task["erd"].invoke

    Dir.glob(".erdconfig_*").each do |f|
      puts "Loading #{f}"

      # Set default title & filename which can be overridden in .erdconfig_*
      name = f.split("_").last
      ENV["title"] = name.titleize
      ENV["filename"] = "erd_#{name}"

      YAML.load_file(f).each do |key, value|
        value = value.join(",") if value.is_a?(Array)
        ENV[key.to_s] = value.to_s
      end

      Rake::Task["erd"].reenable
      Rake::Task["erd:options"].reenable
      Rake::Task["erd:generate"].reenable
      Rake::Task["erd"].invoke
    end
  end
end

@kerrizor
Copy link
Collaborator

Closing in favor of #326, a rebase of this PR. Thank you for the contribution (and your patience!) @danielevans

@kerrizor kerrizor closed this May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants