arql 0.2.5 → 0.2.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 032762276fe5d2c764f71eae665d16e2e4786368c7f154e7bd19be5188a49027
4
- data.tar.gz: 73b8ceedbcd0abdc5c87c186374c8cfe0db50e0c22d1e645d2c10396ec8c4aa3
3
+ metadata.gz: 92f3117b0baa9b0c54cc683a73251094697b5e2fb8ed7cb329f37b43ad0bbe2e
4
+ data.tar.gz: 2b839cf6ec293f162faa2f29c7d7421679185c4874f1a4c826d13d4be26350a8
5
5
  SHA512:
6
- metadata.gz: cc70e4f11ff7bcfc4f0654d8a3e59ac2ae666e55237dff7d62e408c3c6bba200b22f3e064ea17dc513a94bbd4eacefa8f369d4d79c24d9a9ada857efa00c58af
7
- data.tar.gz: 34491bfc5588a4bae89f26f889c5863e700f79b926902bb769c3e122082342706252fc41bcf461244bfc82e8f5a5e7dbf1eb4bd3c43d726f1d9fb9f5164170b0
6
+ metadata.gz: c07790dbd1bbff85f9fee6f86346967ecac0e70c0334255eb7041b475a41b7d569a01f40d0d2f8757de34362dcaaff839e31a27d13865f1f40f533ce409388fc
7
+ data.tar.gz: a82ae15b63a25e22e7a50e6a1a1dc8173dc5881c5c032851fe69e8639dcfc860d734a557f74dfce38868dac2dd86b2f9e2c94b8e487fa17271967b0eb56d6367
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arql (0.2.5)
4
+ arql (0.2.6)
5
5
  activerecord (~> 6.0.3)
6
6
  activesupport (~> 6.0.3)
7
7
  caxlsx (~> 3.0.2)
@@ -5,25 +5,29 @@ module Arql::Commands
5
5
  class << self
6
6
  def models
7
7
  t = []
8
- t << ['Table Name', 'Model Class', 'Abbr']
8
+ t << ['Table Name', 'Model Class', 'Abbr', 'Comment']
9
9
  t << nil
10
10
  Arql::Definition.models.each do |definition|
11
- t << [definition[:table], definition[:model].name, definition[:abbr] || '']
11
+ t << [definition[:table], definition[:model].name, definition[:abbr] || '', definition[:comment] || '']
12
12
  end
13
13
  t
14
14
  end
15
15
 
16
- def models_table
16
+ def models_table(regexp)
17
17
  Terminal::Table.new do |t|
18
- models.each { |row| t << (row || :separator) }
18
+ models.each_with_index { |row, idx| t << (row || :separator) if row.nil? ||
19
+ regexp.nil? ||
20
+ idx.zero? ||
21
+ row.any? { |e| e =~ regexp }
22
+ }
19
23
  end
20
24
  end
21
25
  end
22
26
  end
23
27
 
24
- Pry.commands.block_command 'm' do
28
+ Pry.commands.block_command 'm' do |regexp|
25
29
  puts
26
- puts Models::models_table
30
+ puts Models::models_table(regexp.try { |e| eval(e) })
27
31
  end
28
32
 
29
33
  Pry.commands.alias_command 'l', 'm'
@@ -83,6 +83,7 @@ module Arql
83
83
  @@models = []
84
84
  ActiveRecord::Base.connection.tap do |conn|
85
85
  conn.tables.each do |table_name|
86
+ table_comment = conn.table_comment(table_name)
86
87
  conn.primary_key(table_name).tap do |pkey|
87
88
  table_name.camelize.tap do |const_name|
88
89
  const_name = 'Modul' if const_name == 'Module'
@@ -115,7 +116,8 @@ module Arql
115
116
  @@models << {
116
117
  model: const,
117
118
  abbr: abbr_const,
118
- table: table_name
119
+ table: table_name,
120
+ comment: table_comment
119
121
  }
120
122
  end
121
123
  end
@@ -135,6 +137,7 @@ module Arql
135
137
  ActiveRecord::Base.connection.tap do |conn|
136
138
  Object.const_set('ArqlModel', Class.new(ActiveRecord::Base) { self.abstract_class = true })
137
139
  conn.tables.each do |table_name|
140
+ table_comment = conn.table_comment(table_name)
138
141
  conn.primary_key(table_name).tap do |pkey|
139
142
  table_name.camelize.tap do |const_name|
140
143
  const_name = 'Modul' if const_name == 'Module'
@@ -167,7 +170,8 @@ module Arql
167
170
  @@models << {
168
171
  model: const,
169
172
  abbr: abbr_const,
170
- table: table_name
173
+ table: table_name,
174
+ comment: table_comment
171
175
  }
172
176
  end
173
177
  end
@@ -1,3 +1,3 @@
1
1
  module Arql
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-01 00:00:00.000000000 Z
11
+ date: 2020-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2