schema_doc 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/Gemfile.lock +57 -0
- data/lib/schema_doc/document.rb +1 -1
- data/lib/schema_doc/version.rb +1 -1
- data/schema_doc.gemspec +1 -1
- data/spec/helper.rb +7 -3
- data/spec/schema_doc/document_spec.rb +12 -0
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de7315ab4e254938328c0acfdce54a58f9169c329d5c473ffaad3b81aca91675
|
4
|
+
data.tar.gz: 5a6b26ed9c8b57a03ae054f0e68b66885951d5cda75fe187b7cfeb441b95881c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8bd9c1154c5be36875336f29a90f0ffc85e1b1c43a1d3664f05b0b2d18b0498022d1e6e85e0f101c483829d1983cfcd9cb9a0b99a5970ab2ae04abb5def625e
|
7
|
+
data.tar.gz: b331c3d7ec6e178460dab62eb9f1a2c80383cbf7949b46178be2e280984517b878dbac406485a149a3ec6d10e2dc62820eb07d76fc61a43c5defdadc08f6db61
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
schema_doc (0.0.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activemodel (6.0.3.2)
|
10
|
+
activesupport (= 6.0.3.2)
|
11
|
+
activerecord (6.0.3.2)
|
12
|
+
activemodel (= 6.0.3.2)
|
13
|
+
activesupport (= 6.0.3.2)
|
14
|
+
activesupport (6.0.3.2)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 0.7, < 2)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
tzinfo (~> 1.1)
|
19
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
20
|
+
concurrent-ruby (1.1.6)
|
21
|
+
diff-lcs (1.4.4)
|
22
|
+
i18n (1.8.3)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
minitest (5.14.1)
|
25
|
+
rake (13.0.1)
|
26
|
+
rspec (3.9.0)
|
27
|
+
rspec-core (~> 3.9.0)
|
28
|
+
rspec-expectations (~> 3.9.0)
|
29
|
+
rspec-mocks (~> 3.9.0)
|
30
|
+
rspec-core (3.9.2)
|
31
|
+
rspec-support (~> 3.9.3)
|
32
|
+
rspec-expectations (3.9.2)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-mocks (3.9.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.9.0)
|
38
|
+
rspec-support (3.9.3)
|
39
|
+
sqlite3 (1.4.2)
|
40
|
+
thread_safe (0.3.6)
|
41
|
+
tzinfo (1.2.7)
|
42
|
+
thread_safe (~> 0.1)
|
43
|
+
zeitwerk (2.3.1)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
activerecord
|
50
|
+
bundler
|
51
|
+
rake (>= 3.2.16)
|
52
|
+
rspec
|
53
|
+
schema_doc!
|
54
|
+
sqlite3
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
2.0.2
|
data/lib/schema_doc/document.rb
CHANGED
@@ -7,7 +7,7 @@ module SchemaDoc
|
|
7
7
|
document = []
|
8
8
|
|
9
9
|
model_classes_group_by_table_name.sort.each do |table_name, model_classes|
|
10
|
-
document << table_document(table_name, model_classes)
|
10
|
+
document << table_document(table_name, model_classes.sort_by(&:name))
|
11
11
|
end
|
12
12
|
|
13
13
|
document.join
|
data/lib/schema_doc/version.rb
CHANGED
data/schema_doc.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rake", ">= 3.2.16"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "activerecord"
|
data/spec/helper.rb
CHANGED
@@ -14,7 +14,7 @@ ActiveRecord::Base.establish_connection(
|
|
14
14
|
'database' => dbfile
|
15
15
|
)
|
16
16
|
|
17
|
-
class CreateUsers < ActiveRecord::Migration
|
17
|
+
class CreateUsers < ActiveRecord::Migration[6.0]
|
18
18
|
def self.up
|
19
19
|
create_table :users do |t|
|
20
20
|
t.string :nick
|
@@ -26,7 +26,7 @@ class CreateUsers < ActiveRecord::Migration
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
class CreateBlogs < ActiveRecord::Migration
|
29
|
+
class CreateBlogs < ActiveRecord::Migration[6.0]
|
30
30
|
def self.up
|
31
31
|
create_table :blogs do |t|
|
32
32
|
t.string :name
|
@@ -39,7 +39,7 @@ class CreateBlogs < ActiveRecord::Migration
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
class CreateEntries < ActiveRecord::Migration
|
42
|
+
class CreateEntries < ActiveRecord::Migration[6.0]
|
43
43
|
def self.up
|
44
44
|
create_table :entries do|t|
|
45
45
|
t.string :title
|
@@ -66,3 +66,7 @@ end
|
|
66
66
|
class Entry < ActiveRecord::Base
|
67
67
|
belongs_to :blog
|
68
68
|
end
|
69
|
+
|
70
|
+
class AnotherUser < ActiveRecord::Base
|
71
|
+
self.table_name = 'users'
|
72
|
+
end
|
@@ -1,6 +1,18 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe SchemaDoc::Document do
|
4
|
+
describe '.read' do
|
5
|
+
subject { described_class.read }
|
6
|
+
let(:blog) { subject.index('Blog') }
|
7
|
+
let(:user) { subject.index('User') }
|
8
|
+
let(:another_user) { subject.index('AnotherUser') }
|
9
|
+
|
10
|
+
it 'sorts by tables then model names' do
|
11
|
+
expect(another_user).to be < user
|
12
|
+
expect(blog).to be < another_user
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
4
16
|
describe 'send(:table_document)' do
|
5
17
|
let :document do
|
6
18
|
SchemaDoc::Document.send(:table_document, *args)
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schema_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mizokami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- ".travis.yml"
|
92
92
|
- Gemfile
|
93
|
+
- Gemfile.lock
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
95
96
|
- Rakefile
|
@@ -126,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
127
|
- !ruby/object:Gem::Version
|
127
128
|
version: '0'
|
128
129
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.5.1
|
130
|
+
rubygems_version: 3.1.2
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Output database schema in markdown style.
|