aam 0.0.13 → 0.0.14
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/examples/0100_example.rb +5 -5
- data/lib/aam/annotation.rb +1 -1
- data/lib/aam/generator.rb +2 -2
- data/lib/aam/version.rb +1 -1
- data/test/test_aam.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f2e237766cc4aebb981ae843b061980f73a5a19aea5e981df784a1a4fa96f7a
|
4
|
+
data.tar.gz: db1533ca813417f4cfc3066328959a6aa7e00c594211a11854c826ede9872ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bc66294cb01e90c72bc2982632770d1e7e8f25e994e57e24af8490524dcb3053958ae1cd328f04ad7fb6d1b1784e4e5eb1a4535feda16efc70d0b7d0d433bdb
|
7
|
+
data.tar.gz: 17730f79a62f99ec2eebb246a505bcc9e8210a3c186440342f33455fcbf3b052f2ce41d4f78fc7d7c2775bf13d5f498492ff98ed876c6a4a4a5c300490fd6ed0
|
data/examples/0100_example.rb
CHANGED
@@ -63,7 +63,7 @@ puts Aam::Generator.new(SubArticle).generate
|
|
63
63
|
# >> # |------+------+---------+-------------+------+-------|
|
64
64
|
# >> # | id | Id | integer | NOT NULL PK | | |
|
65
65
|
# >> # | name | Name | string | | | A! |
|
66
|
-
# >> # | flag | Flag | boolean | DEFAULT(
|
66
|
+
# >> # | flag | Flag | boolean | DEFAULT(0) | | |
|
67
67
|
# >> # |------+------+---------+-------------+------+-------|
|
68
68
|
# >> # == Schema Information ==
|
69
69
|
# >> #
|
@@ -78,10 +78,10 @@ puts Aam::Generator.new(SubArticle).generate
|
|
78
78
|
# >> # | foo_id | Foo | integer | | => (foo_type)#id | |
|
79
79
|
# >> # |----------+----------+---------+-------------+----------------------------+-------|
|
80
80
|
# >> #
|
81
|
-
# >>
|
81
|
+
# >> # - Remarks ----------------------------------------------------------------------
|
82
82
|
# >> # User.has_many :articles
|
83
83
|
# >> # [Warning: Need to add index] create_articles マイグレーションに add_index :articles, [:foo_id, :foo_type] を追加してください
|
84
|
-
# >>
|
84
|
+
# >> # --------------------------------------------------------------------------------
|
85
85
|
# >> # == Schema Information ==
|
86
86
|
# >> #
|
87
87
|
# >> # Blog (blogs as Blog)
|
@@ -105,8 +105,8 @@ puts Aam::Generator.new(SubArticle).generate
|
|
105
105
|
# >> # | foo_id | Foo | integer | | :blog => Blog#id と => (foo_type)#id | |
|
106
106
|
# >> # |----------+----------+---------+-------------+--------------------------------------+-------|
|
107
107
|
# >> #
|
108
|
-
# >>
|
108
|
+
# >> # - Remarks ----------------------------------------------------------------------
|
109
109
|
# >> # Blog.has_many :sub_articles, foreign_key: :foo_id
|
110
110
|
# >> # User.has_many :articles
|
111
111
|
# >> # [Warning: Need to add index] create_articles マイグレーションに add_index :articles, [:foo_id, :foo_type] を追加してください
|
112
|
-
# >>
|
112
|
+
# >> # --------------------------------------------------------------------------------
|
data/lib/aam/annotation.rb
CHANGED
@@ -122,7 +122,7 @@ module Aam
|
|
122
122
|
if body.match(regexp)
|
123
123
|
body = body.sub(regexp, schema_info)
|
124
124
|
elsif body.include?(MAGIC_COMMENT_LINE)
|
125
|
-
body = body.sub(/#{Regexp.escape(MAGIC_COMMENT_LINE)}\s*/) {MAGIC_COMMENT_LINE + schema_info}
|
125
|
+
body = body.sub(/#{Regexp.escape(MAGIC_COMMENT_LINE)}\s*/) { MAGIC_COMMENT_LINE + "\n" + schema_info }
|
126
126
|
else
|
127
127
|
body = body.sub(/^\s*/, schema_info)
|
128
128
|
end
|
data/lib/aam/generator.rb
CHANGED
@@ -34,9 +34,9 @@ module Aam
|
|
34
34
|
out << rows.to_t.lines.collect { |e| "# #{e}" }.join
|
35
35
|
if @memos.present?
|
36
36
|
out << "#\n"
|
37
|
-
out << "# - Remarks
|
37
|
+
out << "# - Remarks ----------------------------------------------------------------------\n"
|
38
38
|
out << @memos.sort.collect { |row| "# #{row}\n" }.join
|
39
|
-
out << "#
|
39
|
+
out << "# --------------------------------------------------------------------------------\n"
|
40
40
|
end
|
41
41
|
out.join
|
42
42
|
end
|
data/lib/aam/version.rb
CHANGED
data/test/test_aam.rb
CHANGED
@@ -76,11 +76,11 @@ EOT
|
|
76
76
|
# | xxx_id | Xxx | integer | | => (xxx_type)#id | |
|
77
77
|
# |----------+----------+---------+-------------+----------------------------+-------|
|
78
78
|
#
|
79
|
-
|
79
|
+
# - Remarks ----------------------------------------------------------------------
|
80
80
|
# User.has_many :articles
|
81
81
|
# [Warning: Need to add index] create_articles マイグレーションに add_index :articles, :user_id を追加してください
|
82
82
|
# [Warning: Need to add index] create_articles マイグレーションに add_index :articles, [:xxx_id, :xxx_type] を追加してください
|
83
|
-
|
83
|
+
# --------------------------------------------------------------------------------
|
84
84
|
EOT
|
85
85
|
Aam::Generator.new(SubArticle).generate == <<-EOT.strip_heredoc
|
86
86
|
# == Schema Information ==
|
@@ -96,10 +96,10 @@ EOT
|
|
96
96
|
# | xxx_id | Xxx | integer | | :blog => Blog#id と => (xxx_type)#id | |
|
97
97
|
# |----------+----------+---------+-------------+--------------------------------------+-------|
|
98
98
|
#
|
99
|
-
|
99
|
+
# - 備考 -------------------------------------------------------------------------
|
100
100
|
# ・[Warning: Need to add index] create_articles マイグレーションに add_index :articles, :user_id を追加してください
|
101
101
|
# ・[Warning: Need to add index] create_articles マイグレーションに add_index :articles, [:xxx_id, :xxx_type] を追加してください
|
102
|
-
|
102
|
+
# --------------------------------------------------------------------------------
|
103
103
|
EOT
|
104
104
|
end
|
105
105
|
|
@@ -136,12 +136,12 @@ EOT
|
|
136
136
|
# | xxx_id | Xxx | integer | | | |
|
137
137
|
# |----------+----------+---------+-------------+------+-------|
|
138
138
|
#
|
139
|
-
|
139
|
+
# - Remarks ----------------------------------------------------------------------
|
140
140
|
# [Warning: Need to add index] create_foos マイグレーションに add_index :foos, :user_id を追加してください
|
141
141
|
# [Warning: Need to add index] create_foos マイグレーションに add_index :foos, [:xxx_id, :xxx_type] を追加してください
|
142
142
|
# [Warning: Need to add relation] Foo モデルに belongs_to :user を追加してください
|
143
143
|
# [Warning: Need to add relation] Foo モデルに belongs_to :xxx, polymorphic: true を追加してください
|
144
|
-
|
144
|
+
# --------------------------------------------------------------------------------
|
145
145
|
EOT
|
146
146
|
end
|
147
147
|
end
|