rails-mermaid_erd_markdown 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS.md +1 -0
- data/.github/workflows/CI.yml +42 -0
- data/.github/workflows/codeql.yml +93 -0
- data/.rubocop.yml +30 -6
- data/.ruby-version +1 -0
- data/Gemfile +6 -9
- data/Gemfile.lock +77 -69
- data/README.md +36 -9
- data/Rakefile +1 -1
- data/bin/console +1 -1
- data/bin/rubocop +29 -0
- data/docs/examples/erd.yml +1 -1
- data/lib/rails-mermaid_erd_markdown/configuration.rb +11 -3
- data/lib/rails-mermaid_erd_markdown/generator.rb +169 -0
- data/lib/rails-mermaid_erd_markdown/markdown_document.rb +104 -0
- data/lib/rails-mermaid_erd_markdown/source_data.rb +63 -0
- data/lib/rails-mermaid_erd_markdown/version.rb +1 -1
- data/lib/rails-mermaid_erd_markdown.rb +3 -93
- data/rails-mermaid_erd_markdown.gemspec +5 -3
- data/test/example_output/mock_ERD.md +48 -0
- data/test/example_output/mock_ERD_index.md +10 -0
- data/test/example_output/mock_ERD_model.md +46 -0
- data/test/mock_data/models.rb +105 -0
- data/test/test_helper.rb +4 -2
- data/test/test_rails/rails-mermaid_erd_markdown/test_generator.rb +54 -0
- data/test/test_rails/rails-mermaid_erd_markdown/test_markdown_document.rb +76 -0
- data/test/test_rails/rails-mermaid_erd_markdown/test_source_data.rb +70 -0
- data/test/test_rails/test_rails-mermaid_erd_markdown.rb +0 -40
- metadata +19 -63
- data/test/dummy-rails/.dockerignore +0 -37
- data/test/dummy-rails/.ruby-version +0 -1
- data/test/dummy-rails/Rakefile +0 -6
- data/test/dummy-rails/app/assets/config/manifest.js +0 -4
- data/test/dummy-rails/app/assets/images/.keep +0 -0
- data/test/dummy-rails/app/assets/stylesheets/application.css +0 -15
- data/test/dummy-rails/app/channels/application_cable/channel.rb +0 -4
- data/test/dummy-rails/app/channels/application_cable/connection.rb +0 -4
- data/test/dummy-rails/app/controllers/application_controller.rb +0 -2
- data/test/dummy-rails/app/controllers/concerns/.keep +0 -0
- data/test/dummy-rails/app/helpers/application_helper.rb +0 -2
- data/test/dummy-rails/app/javascript/application.js +0 -3
- data/test/dummy-rails/app/javascript/controllers/application.js +0 -9
- data/test/dummy-rails/app/javascript/controllers/hello_controller.js +0 -7
- data/test/dummy-rails/app/javascript/controllers/index.js +0 -11
- data/test/dummy-rails/app/jobs/application_job.rb +0 -7
- data/test/dummy-rails/app/mailers/application_mailer.rb +0 -4
- data/test/dummy-rails/app/models/application_record.rb +0 -3
- data/test/dummy-rails/app/models/concerns/.keep +0 -0
- data/test/dummy-rails/app/views/layouts/application.html.erb +0 -16
- data/test/dummy-rails/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy-rails/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy-rails/bin/bundle +0 -114
- data/test/dummy-rails/bin/docker-entrypoint +0 -8
- data/test/dummy-rails/bin/importmap +0 -4
- data/test/dummy-rails/bin/rails +0 -4
- data/test/dummy-rails/bin/rake +0 -4
- data/test/dummy-rails/bin/setup +0 -33
- data/test/dummy-rails/config/application.rb +0 -27
- data/test/dummy-rails/config/boot.rb +0 -3
- data/test/dummy-rails/config/cable.yml +0 -10
- data/test/dummy-rails/config/credentials.yml.enc +0 -1
- data/test/dummy-rails/config/database.yml +0 -25
- data/test/dummy-rails/config/environment.rb +0 -5
- data/test/dummy-rails/config/environments/development.rb +0 -76
- data/test/dummy-rails/config/environments/production.rb +0 -97
- data/test/dummy-rails/config/environments/test.rb +0 -64
- data/test/dummy-rails/config/importmap.rb +0 -7
- data/test/dummy-rails/config/initializers/content_security_policy.rb +0 -25
- data/test/dummy-rails/config/initializers/filter_parameter_logging.rb +0 -8
- data/test/dummy-rails/config/initializers/inflections.rb +0 -16
- data/test/dummy-rails/config/initializers/permissions_policy.rb +0 -13
- data/test/dummy-rails/config/locales/en.yml +0 -31
- data/test/dummy-rails/config/puma.rb +0 -35
- data/test/dummy-rails/config/routes.rb +0 -10
- data/test/dummy-rails/config/storage.yml +0 -34
- data/test/dummy-rails/config.ru +0 -6
- data/test/dummy-rails/db/seeds.rb +0 -9
- data/test/dummy-rails/test/application_system_test_case.rb +0 -5
- data/test/dummy-rails/test/channels/application_cable/connection_test.rb +0 -13
- data/test/dummy-rails/test/controllers/.keep +0 -0
- data/test/dummy-rails/test/fixtures/files/.keep +0 -0
- data/test/dummy-rails/test/helpers/.keep +0 -0
- data/test/dummy-rails/test/integration/.keep +0 -0
- data/test/dummy-rails/test/mailers/.keep +0 -0
- data/test/dummy-rails/test/models/.keep +0 -0
- data/test/dummy-rails/test/system/.keep +0 -0
- data/test/dummy-rails/test/test_helper.rb +0 -15
- data/test/dummy-rails/vendor/.keep +0 -0
- data/test/dummy-rails/vendor/javascript/.keep +0 -0
- data/test/util/mock_ERD.md +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67e66530c607079c622c67375de2af66f2e7622c10049a8972ee54daceced528
|
4
|
+
data.tar.gz: 79d8cde31fdd334cc53bb43e8bc86088d1525561cd8c05ad523dfd36b287a57c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3657a451d92dc2520057b37c5fe75486ec1f6ecbfde168ae498e4b1213b40acca495cff3307aa704e99940b35069b1d9e61af8dd5d4b73dc92a489a4fb0c1d
|
7
|
+
data.tar.gz: 58fd1f844c7b8c16645bcdd48f7532d9175e1d53b0ad90ddef9a05021cdd2fa7e00968140d9bace215b4545f8917226b2f788adb15b6ece53c58857896cf1b10
|
@@ -0,0 +1 @@
|
|
1
|
+
* @humzahkiani # Applies to all files and directories
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub. They are
|
2
|
+
# provided by a third-party and are governed by separate terms of service,
|
3
|
+
# privacy policy, and support documentation.
|
4
|
+
#
|
5
|
+
# This workflow will install a prebuilt Ruby version, install dependencies, and
|
6
|
+
# run tests and linters.
|
7
|
+
name: 'CI'
|
8
|
+
on:
|
9
|
+
push:
|
10
|
+
branches: ['main']
|
11
|
+
pull_request:
|
12
|
+
branches: ['main']
|
13
|
+
jobs:
|
14
|
+
test:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
env:
|
17
|
+
RAILS_ENV: test
|
18
|
+
steps:
|
19
|
+
- name: Checkout code
|
20
|
+
uses: actions/checkout@v4
|
21
|
+
# Add or replace dependency steps here
|
22
|
+
- name: Install Ruby and gems
|
23
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
24
|
+
with:
|
25
|
+
bundler-cache: true
|
26
|
+
# Add or replace database setup steps here
|
27
|
+
# Add or replace test runners here
|
28
|
+
- name: Run tests
|
29
|
+
run: bundle exec rake
|
30
|
+
|
31
|
+
lint:
|
32
|
+
runs-on: ubuntu-latest
|
33
|
+
steps:
|
34
|
+
- name: Checkout code
|
35
|
+
uses: actions/checkout@v4
|
36
|
+
- name: Install Ruby and gems
|
37
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
38
|
+
with:
|
39
|
+
bundler-cache: true
|
40
|
+
# Add or replace any other lints here
|
41
|
+
- name: Lint Ruby files
|
42
|
+
run: bin/rubocop --parallel
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: 'CodeQL'
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: ['main']
|
17
|
+
pull_request:
|
18
|
+
branches: ['main']
|
19
|
+
|
20
|
+
jobs:
|
21
|
+
analyze:
|
22
|
+
name: Analyze (${{ matrix.language }})
|
23
|
+
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
24
|
+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
25
|
+
# - https://gh.io/supported-runners-and-hardware-resources
|
26
|
+
# - https://gh.io/using-larger-runners (GitHub.com only)
|
27
|
+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
|
28
|
+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
29
|
+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
30
|
+
permissions:
|
31
|
+
# required for all workflows
|
32
|
+
security-events: write
|
33
|
+
|
34
|
+
# required to fetch internal or private CodeQL packs
|
35
|
+
packages: read
|
36
|
+
|
37
|
+
# only required for workflows in private repositories
|
38
|
+
actions: read
|
39
|
+
contents: read
|
40
|
+
|
41
|
+
strategy:
|
42
|
+
fail-fast: false
|
43
|
+
matrix:
|
44
|
+
include:
|
45
|
+
- language: javascript-typescript
|
46
|
+
build-mode: none
|
47
|
+
- language: ruby
|
48
|
+
build-mode: none
|
49
|
+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
|
50
|
+
# Use `c-cpp` to analyze code written in C, C++ or both
|
51
|
+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
|
52
|
+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
53
|
+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
|
54
|
+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
|
55
|
+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
|
56
|
+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
|
57
|
+
steps:
|
58
|
+
- name: Checkout repository
|
59
|
+
uses: actions/checkout@v4
|
60
|
+
|
61
|
+
# Initializes the CodeQL tools for scanning.
|
62
|
+
- name: Initialize CodeQL
|
63
|
+
uses: github/codeql-action/init@v3
|
64
|
+
with:
|
65
|
+
languages: ${{ matrix.language }}
|
66
|
+
build-mode: ${{ matrix.build-mode }}
|
67
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
68
|
+
# By default, queries listed here will override any specified in a config file.
|
69
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
70
|
+
|
71
|
+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
72
|
+
# queries: security-extended,security-and-quality
|
73
|
+
|
74
|
+
# If the analyze step fails for one of the languages you are analyzing with
|
75
|
+
# "We were unable to automatically build your code", modify the matrix above
|
76
|
+
# to set the build mode to "manual" for that language. Then modify this step
|
77
|
+
# to build your code.
|
78
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
79
|
+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
80
|
+
- if: matrix.build-mode == 'manual'
|
81
|
+
shell: bash
|
82
|
+
run: |
|
83
|
+
echo 'If you are using a "manual" build mode for one or more of the' \
|
84
|
+
'languages you are analyzing, replace this with the commands to build' \
|
85
|
+
'your code, for example:'
|
86
|
+
echo ' make bootstrap'
|
87
|
+
echo ' make release'
|
88
|
+
exit 1
|
89
|
+
|
90
|
+
- name: Perform CodeQL Analysis
|
91
|
+
uses: github/codeql-action/analyze@v3
|
92
|
+
with:
|
93
|
+
category: '/language:${{matrix.language}}'
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,37 @@
|
|
1
1
|
AllCops:
|
2
|
-
|
2
|
+
NewCops: enable
|
3
|
+
TargetRubyVersion: 2.6
|
4
|
+
Exclude:
|
5
|
+
- 'test/**/*'
|
6
|
+
- 'vendor/**/*'
|
7
|
+
|
8
|
+
Naming/FileName:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/Documentation:
|
12
|
+
Enabled: false
|
3
13
|
|
4
14
|
Style/StringLiterals:
|
5
|
-
|
6
|
-
|
15
|
+
Enabled: true
|
16
|
+
EnforcedStyle: double_quotes
|
7
17
|
|
8
18
|
Style/StringLiteralsInInterpolation:
|
9
|
-
|
10
|
-
|
19
|
+
Enabled: true
|
20
|
+
EnforcedStyle: double_quotes
|
11
21
|
|
12
22
|
Layout/LineLength:
|
13
|
-
|
23
|
+
Max: 120
|
24
|
+
|
25
|
+
Metrics/AbcSize:
|
26
|
+
Exclude:
|
27
|
+
- 'lib/rails-mermaid_erd_markdown/configuration.rb'
|
28
|
+
- 'lib/rails-mermaid_erd_markdown/source_data.rb'
|
29
|
+
- 'lib/rails-mermaid_erd_markdown/generator.rb'
|
30
|
+
|
31
|
+
Metrics/ClassLength:
|
32
|
+
Max: 125
|
33
|
+
|
34
|
+
Metrics/MethodLength:
|
35
|
+
Max: 25
|
36
|
+
Exclude:
|
37
|
+
- 'lib/rails-mermaid_erd_markdown/configuration.rb'
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.0
|
data/Gemfile
CHANGED
@@ -5,12 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
# Specify your gem's dependencies in rails-mermaid_erd_markdown.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
gem "rake"
|
11
|
-
|
12
|
-
gem "
|
13
|
-
|
14
|
-
gem "rubocop", "~> 1.21"
|
15
|
-
|
16
|
-
gem "sqlite3", "~> 1.4"
|
8
|
+
group :development do
|
9
|
+
gem "minitest"
|
10
|
+
gem "rake"
|
11
|
+
gem "rubocop"
|
12
|
+
gem "sqlite3"
|
13
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,41 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rails-mermaid_erd_markdown (0.
|
4
|
+
rails-mermaid_erd_markdown (0.3.0)
|
5
5
|
rails (>= 5.2)
|
6
|
+
rails-mermaid_erd (~> 0.4.2)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
actioncable (7.1.3.
|
11
|
-
actionpack (= 7.1.3.
|
12
|
-
activesupport (= 7.1.3.
|
11
|
+
actioncable (7.1.3.4)
|
12
|
+
actionpack (= 7.1.3.4)
|
13
|
+
activesupport (= 7.1.3.4)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
16
|
zeitwerk (~> 2.6)
|
16
|
-
actionmailbox (7.1.3.
|
17
|
-
actionpack (= 7.1.3.
|
18
|
-
activejob (= 7.1.3.
|
19
|
-
activerecord (= 7.1.3.
|
20
|
-
activestorage (= 7.1.3.
|
21
|
-
activesupport (= 7.1.3.
|
17
|
+
actionmailbox (7.1.3.4)
|
18
|
+
actionpack (= 7.1.3.4)
|
19
|
+
activejob (= 7.1.3.4)
|
20
|
+
activerecord (= 7.1.3.4)
|
21
|
+
activestorage (= 7.1.3.4)
|
22
|
+
activesupport (= 7.1.3.4)
|
22
23
|
mail (>= 2.7.1)
|
23
24
|
net-imap
|
24
25
|
net-pop
|
25
26
|
net-smtp
|
26
|
-
actionmailer (7.1.3.
|
27
|
-
actionpack (= 7.1.3.
|
28
|
-
actionview (= 7.1.3.
|
29
|
-
activejob (= 7.1.3.
|
30
|
-
activesupport (= 7.1.3.
|
27
|
+
actionmailer (7.1.3.4)
|
28
|
+
actionpack (= 7.1.3.4)
|
29
|
+
actionview (= 7.1.3.4)
|
30
|
+
activejob (= 7.1.3.4)
|
31
|
+
activesupport (= 7.1.3.4)
|
31
32
|
mail (~> 2.5, >= 2.5.4)
|
32
33
|
net-imap
|
33
34
|
net-pop
|
34
35
|
net-smtp
|
35
36
|
rails-dom-testing (~> 2.2)
|
36
|
-
actionpack (7.1.3.
|
37
|
-
actionview (= 7.1.3.
|
38
|
-
activesupport (= 7.1.3.
|
37
|
+
actionpack (7.1.3.4)
|
38
|
+
actionview (= 7.1.3.4)
|
39
|
+
activesupport (= 7.1.3.4)
|
39
40
|
nokogiri (>= 1.8.5)
|
40
41
|
racc
|
41
42
|
rack (>= 2.2.4)
|
@@ -43,35 +44,35 @@ GEM
|
|
43
44
|
rack-test (>= 0.6.3)
|
44
45
|
rails-dom-testing (~> 2.2)
|
45
46
|
rails-html-sanitizer (~> 1.6)
|
46
|
-
actiontext (7.1.3.
|
47
|
-
actionpack (= 7.1.3.
|
48
|
-
activerecord (= 7.1.3.
|
49
|
-
activestorage (= 7.1.3.
|
50
|
-
activesupport (= 7.1.3.
|
47
|
+
actiontext (7.1.3.4)
|
48
|
+
actionpack (= 7.1.3.4)
|
49
|
+
activerecord (= 7.1.3.4)
|
50
|
+
activestorage (= 7.1.3.4)
|
51
|
+
activesupport (= 7.1.3.4)
|
51
52
|
globalid (>= 0.6.0)
|
52
53
|
nokogiri (>= 1.8.5)
|
53
|
-
actionview (7.1.3.
|
54
|
-
activesupport (= 7.1.3.
|
54
|
+
actionview (7.1.3.4)
|
55
|
+
activesupport (= 7.1.3.4)
|
55
56
|
builder (~> 3.1)
|
56
57
|
erubi (~> 1.11)
|
57
58
|
rails-dom-testing (~> 2.2)
|
58
59
|
rails-html-sanitizer (~> 1.6)
|
59
|
-
activejob (7.1.3.
|
60
|
-
activesupport (= 7.1.3.
|
60
|
+
activejob (7.1.3.4)
|
61
|
+
activesupport (= 7.1.3.4)
|
61
62
|
globalid (>= 0.3.6)
|
62
|
-
activemodel (7.1.3.
|
63
|
-
activesupport (= 7.1.3.
|
64
|
-
activerecord (7.1.3.
|
65
|
-
activemodel (= 7.1.3.
|
66
|
-
activesupport (= 7.1.3.
|
63
|
+
activemodel (7.1.3.4)
|
64
|
+
activesupport (= 7.1.3.4)
|
65
|
+
activerecord (7.1.3.4)
|
66
|
+
activemodel (= 7.1.3.4)
|
67
|
+
activesupport (= 7.1.3.4)
|
67
68
|
timeout (>= 0.4.0)
|
68
|
-
activestorage (7.1.3.
|
69
|
-
actionpack (= 7.1.3.
|
70
|
-
activejob (= 7.1.3.
|
71
|
-
activerecord (= 7.1.3.
|
72
|
-
activesupport (= 7.1.3.
|
69
|
+
activestorage (7.1.3.4)
|
70
|
+
actionpack (= 7.1.3.4)
|
71
|
+
activejob (= 7.1.3.4)
|
72
|
+
activerecord (= 7.1.3.4)
|
73
|
+
activesupport (= 7.1.3.4)
|
73
74
|
marcel (~> 1.0)
|
74
|
-
activesupport (7.1.3.
|
75
|
+
activesupport (7.1.3.4)
|
75
76
|
base64
|
76
77
|
bigdecimal
|
77
78
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -84,19 +85,19 @@ GEM
|
|
84
85
|
ast (2.4.2)
|
85
86
|
base64 (0.2.0)
|
86
87
|
bigdecimal (3.1.8)
|
87
|
-
builder (3.
|
88
|
-
concurrent-ruby (1.
|
88
|
+
builder (3.3.0)
|
89
|
+
concurrent-ruby (1.3.3)
|
89
90
|
connection_pool (2.4.1)
|
90
91
|
crass (1.0.6)
|
91
92
|
date (3.3.4)
|
92
93
|
drb (2.2.1)
|
93
|
-
erubi (1.
|
94
|
+
erubi (1.13.0)
|
94
95
|
globalid (1.2.1)
|
95
96
|
activesupport (>= 6.1)
|
96
97
|
i18n (1.14.5)
|
97
98
|
concurrent-ruby (~> 1.0)
|
98
99
|
io-console (0.7.2)
|
99
|
-
irb (1.
|
100
|
+
irb (1.14.0)
|
100
101
|
rdoc (>= 4.0.0)
|
101
102
|
reline (>= 0.4.2)
|
102
103
|
json (2.7.2)
|
@@ -113,7 +114,7 @@ GEM
|
|
113
114
|
mini_mime (1.1.5)
|
114
115
|
minitest (5.23.1)
|
115
116
|
mutex_m (0.2.0)
|
116
|
-
net-imap (0.4.
|
117
|
+
net-imap (0.4.14)
|
117
118
|
date
|
118
119
|
net-protocol
|
119
120
|
net-pop (0.1.2)
|
@@ -123,7 +124,11 @@ GEM
|
|
123
124
|
net-smtp (0.5.0)
|
124
125
|
net-protocol
|
125
126
|
nio4r (2.7.3)
|
126
|
-
nokogiri (1.16.
|
127
|
+
nokogiri (1.16.7-arm64-darwin)
|
128
|
+
racc (~> 1.4)
|
129
|
+
nokogiri (1.16.7-x86_64-darwin)
|
130
|
+
racc (~> 1.4)
|
131
|
+
nokogiri (1.16.7-x86_64-linux)
|
127
132
|
racc (~> 1.4)
|
128
133
|
parallel (1.24.0)
|
129
134
|
parser (3.3.1.0)
|
@@ -132,7 +137,7 @@ GEM
|
|
132
137
|
psych (5.1.2)
|
133
138
|
stringio
|
134
139
|
racc (1.8.0)
|
135
|
-
rack (3.
|
140
|
+
rack (3.1.7)
|
136
141
|
rack-session (2.0.0)
|
137
142
|
rack (>= 3.0.0)
|
138
143
|
rack-test (2.1.0)
|
@@ -140,20 +145,20 @@ GEM
|
|
140
145
|
rackup (2.1.0)
|
141
146
|
rack (>= 3)
|
142
147
|
webrick (~> 1.8)
|
143
|
-
rails (7.1.3.
|
144
|
-
actioncable (= 7.1.3.
|
145
|
-
actionmailbox (= 7.1.3.
|
146
|
-
actionmailer (= 7.1.3.
|
147
|
-
actionpack (= 7.1.3.
|
148
|
-
actiontext (= 7.1.3.
|
149
|
-
actionview (= 7.1.3.
|
150
|
-
activejob (= 7.1.3.
|
151
|
-
activemodel (= 7.1.3.
|
152
|
-
activerecord (= 7.1.3.
|
153
|
-
activestorage (= 7.1.3.
|
154
|
-
activesupport (= 7.1.3.
|
148
|
+
rails (7.1.3.4)
|
149
|
+
actioncable (= 7.1.3.4)
|
150
|
+
actionmailbox (= 7.1.3.4)
|
151
|
+
actionmailer (= 7.1.3.4)
|
152
|
+
actionpack (= 7.1.3.4)
|
153
|
+
actiontext (= 7.1.3.4)
|
154
|
+
actionview (= 7.1.3.4)
|
155
|
+
activejob (= 7.1.3.4)
|
156
|
+
activemodel (= 7.1.3.4)
|
157
|
+
activerecord (= 7.1.3.4)
|
158
|
+
activestorage (= 7.1.3.4)
|
159
|
+
activesupport (= 7.1.3.4)
|
155
160
|
bundler (>= 1.15.0)
|
156
|
-
railties (= 7.1.3.
|
161
|
+
railties (= 7.1.3.4)
|
157
162
|
rails-dom-testing (2.2.0)
|
158
163
|
activesupport (>= 5.0.0)
|
159
164
|
minitest
|
@@ -163,9 +168,9 @@ GEM
|
|
163
168
|
nokogiri (~> 1.14)
|
164
169
|
rails-mermaid_erd (0.4.2)
|
165
170
|
rails (>= 5.2)
|
166
|
-
railties (7.1.3.
|
167
|
-
actionpack (= 7.1.3.
|
168
|
-
activesupport (= 7.1.3.
|
171
|
+
railties (7.1.3.4)
|
172
|
+
actionpack (= 7.1.3.4)
|
173
|
+
activesupport (= 7.1.3.4)
|
169
174
|
irb
|
170
175
|
rackup (>= 1.0.0)
|
171
176
|
rake (>= 12.2)
|
@@ -176,7 +181,7 @@ GEM
|
|
176
181
|
rdoc (6.7.0)
|
177
182
|
psych (>= 4.0.0)
|
178
183
|
regexp_parser (2.9.2)
|
179
|
-
reline (0.5.
|
184
|
+
reline (0.5.9)
|
180
185
|
io-console (~> 0.5)
|
181
186
|
rexml (3.2.8)
|
182
187
|
strscan (>= 3.0.9)
|
@@ -195,7 +200,9 @@ GEM
|
|
195
200
|
parser (>= 3.3.1.0)
|
196
201
|
ruby-progressbar (1.13.0)
|
197
202
|
sqlite3 (1.7.3-arm64-darwin)
|
198
|
-
|
203
|
+
sqlite3 (1.7.3-x86_64-darwin)
|
204
|
+
sqlite3 (1.7.3-x86_64-linux)
|
205
|
+
stringio (3.1.1)
|
199
206
|
strscan (3.1.0)
|
200
207
|
thor (1.3.1)
|
201
208
|
timeout (0.4.1)
|
@@ -206,18 +213,19 @@ GEM
|
|
206
213
|
websocket-driver (0.7.6)
|
207
214
|
websocket-extensions (>= 0.1.0)
|
208
215
|
websocket-extensions (0.1.5)
|
209
|
-
zeitwerk (2.6.
|
216
|
+
zeitwerk (2.6.17)
|
210
217
|
|
211
218
|
PLATFORMS
|
212
219
|
arm64-darwin-23
|
220
|
+
x86_64-darwin-22
|
221
|
+
x86_64-linux
|
213
222
|
|
214
223
|
DEPENDENCIES
|
215
|
-
minitest
|
216
|
-
rails-mermaid_erd
|
224
|
+
minitest
|
217
225
|
rails-mermaid_erd_markdown!
|
218
|
-
rake
|
219
|
-
rubocop
|
220
|
-
sqlite3
|
226
|
+
rake
|
227
|
+
rubocop
|
228
|
+
sqlite3
|
221
229
|
|
222
230
|
BUNDLED WITH
|
223
231
|
2.3.3
|
data/README.md
CHANGED
@@ -22,18 +22,45 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
To generate a mermaid ERD in markdown, run `rails generate_erd` or `rake generate_erd` from the terminal
|
24
24
|
|
25
|
-
The default path for the generated ERD is `app/models/ERD.md`. You can modify this by creating an `erd.yml` file in the root directory
|
26
|
-
and modifying the `result_path` as seen in the example at `docs/examples/erd.yml`. Make sure to include the markdown file name you
|
27
|
-
wish to generate in the path.
|
25
|
+
The default path for the generated ERD is `app/models/ERD.md`. You can modify this by creating an `erd.yml` file in the root directory and modifying the `output_path` as seen in the example at `docs/examples/erd.yml`. Make sure to include the markdown file name you wish to generate in the path.
|
28
26
|
|
29
|
-
If an ERD already exists at the path specified, it will be parsed to determine if it is up to date. If it is, nothing happens. If it
|
30
|
-
is not, the ERD is ed.
|
27
|
+
If an ERD already exists at the path specified, it will be parsed to determine if it is up to date. If it is, nothing happens. If it is not up to date, the ERD will be updated.
|
31
28
|
|
32
|
-
One can create self-updating, living documentation by integrating this rake task into their CI. This ensures that the ERD is always up
|
33
|
-
to date and accurately describes the latest state of the models and their relationships.
|
29
|
+
One can create self-updating, living documentation by integrating this rake task into their CI. This ensures that the ERD is always up to date and accurately describes the latest state of the models and their relationships.
|
34
30
|
|
35
|
-
You can view the ERD by navigating to the file in Github, which supports rendering mermaid diagrams from code. If you are a Visual
|
36
|
-
|
31
|
+
You can view the ERD by navigating to the file in Github, which supports rendering mermaid diagrams from code. If you are a Visual Studio Code user, you can use the [Markdown Preview Enhanced](https://marketplace.visualstudio.com/items?itemName=shd101wyy.markdown-preview-enhanced) extension to view the ERD directly in your IDE.
|
32
|
+
|
33
|
+
If your entity diagram is too large to be displayed you can set a `split_output` configuration to `true` to generate multiple ERD files based on each model in your project. You can also set a `relationship_depth` configuration to include more than 1 level (the default) of associations in each document.
|
34
|
+
|
35
|
+
## Example ERD
|
36
|
+
|
37
|
+
```mermaid
|
38
|
+
erDiagram
|
39
|
+
%% --------------------------------------------------------
|
40
|
+
%% Entity-Relationship Diagram
|
41
|
+
%% --------------------------------------------------------
|
42
|
+
|
43
|
+
%% table name: articles
|
44
|
+
Article{
|
45
|
+
integer id PK
|
46
|
+
string title
|
47
|
+
text content
|
48
|
+
datetime created_at
|
49
|
+
datetime updated_at
|
50
|
+
}
|
51
|
+
|
52
|
+
%% table name: comments
|
53
|
+
Comment{
|
54
|
+
integer id PK
|
55
|
+
string commenter
|
56
|
+
text body
|
57
|
+
integer article_id FK
|
58
|
+
datetime created_at
|
59
|
+
datetime updated_at
|
60
|
+
}
|
61
|
+
|
62
|
+
Comment }o--|| Article : "BT:article"
|
63
|
+
```
|
37
64
|
|
38
65
|
## Development
|
39
66
|
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "bundler/setup"
|
5
|
-
require "rails
|
5
|
+
require "rails-mermaid_erd_markdown"
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
data/bin/rubocop
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/docs/examples/erd.yml
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "yaml"
|
2
4
|
|
3
5
|
module MermaidErdMarkdown
|
4
6
|
class Configuration
|
5
|
-
attr_accessor :output_path
|
7
|
+
attr_accessor :output_path, :split_output, :relationship_depth
|
6
8
|
|
7
9
|
def initialize
|
8
10
|
config = {
|
9
|
-
output_path: "app/models/ERD.md"
|
11
|
+
output_path: "app/models/ERD.md",
|
12
|
+
split_output: false,
|
13
|
+
relationship_depth: 1
|
10
14
|
}
|
11
15
|
erd_config_path = "erd.yml"
|
12
16
|
|
13
17
|
begin
|
14
18
|
erd_yml = YAML.safe_load File.open(erd_config_path)
|
15
|
-
@output_path = erd_yml["erd"]["output_path"]
|
19
|
+
@output_path = erd_yml["erd"]["output_path"] || config[:output_path]
|
20
|
+
@split_output = erd_yml["erd"]["split_output"] || config[:split_output]
|
21
|
+
@relationship_depth = erd_yml["erd"]["relationship_depth"] || config[:relationship_depth]
|
16
22
|
rescue StandardError
|
17
23
|
@output_path = config[:output_path]
|
24
|
+
@split_output = config[:split_output]
|
25
|
+
@relationship_depth = config[:relationship_depth]
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|