pry-helper 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a183f019f5bf5b3c3fe36d26687b5cd8d08f45d34ec628c734f08e35a8de8ed
4
- data.tar.gz: 4f9f94dc18258f514af2263e7b33fc2ab6d99dc13d3f6fa4903f75aa2b2dd94a
3
+ metadata.gz: 1787736cd728af05efd8a7a4c32a37443ae2d515a6fd0e04388f5f1b0bf1da8c
4
+ data.tar.gz: 3b33b3a938d0abed4d640bc3be872d90a65c773ec6a2eb603b8e603b567ee3bd
5
5
  SHA512:
6
- metadata.gz: e62ec3a4851f8351f3d2d7bc0a235eb7fe5e8de501c8f48b76d36f2306629394edba6480dea3dc4a9051edb4577b390c3b508fc4601a726031c70cd861f3d68f
7
- data.tar.gz: bb27b6fe1389c76c6bfdb76b8dff54071366e10ba40eb829bc26e5202d94d96b28b42d8fc6d459cb9b5b19c10845e6063b17830fe15b25beec34d02ef9bfae1c
6
+ metadata.gz: 1318ed35714bf51daa81f1e5f4b5db7aaa8b67165ba981f5b5163f9b3a391f0126033504f0011b90cc51797c6ce9ae8ccb3b379948a4173f0d20967e84d815c4
7
+ data.tar.gz: 58fa2d0feb8003d4a3afed21818596d55bbcb054f5a938f3506e46960b71fadbcf5961e61d78717ae4f0c5d9aed253e5f063133f144231ebf3943c136f118ba1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pry-helper (0.1.0)
4
+ pry-helper (0.1.2)
5
5
  activerecord
6
6
  activesupport
7
7
  caxlsx
@@ -14,12 +14,12 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activemodel (7.0.3.1)
18
- activesupport (= 7.0.3.1)
19
- activerecord (7.0.3.1)
20
- activemodel (= 7.0.3.1)
21
- activesupport (= 7.0.3.1)
22
- activesupport (7.0.3.1)
17
+ activemodel (7.0.4)
18
+ activesupport (= 7.0.4)
19
+ activerecord (7.0.4)
20
+ activemodel (= 7.0.4)
21
+ activesupport (= 7.0.4)
22
+ activesupport (7.0.4)
23
23
  concurrent-ruby (~> 1.0, >= 1.0.2)
24
24
  i18n (>= 1.6, < 2)
25
25
  minitest (>= 5.1)
@@ -36,10 +36,8 @@ GEM
36
36
  concurrent-ruby (~> 1.0)
37
37
  marcel (1.0.2)
38
38
  method_source (1.0.0)
39
- mini_portile2 (2.8.0)
40
39
  minitest (5.16.3)
41
- nokogiri (1.13.8)
42
- mini_portile2 (~> 2.8.0)
40
+ nokogiri (1.13.8-x86_64-darwin)
43
41
  racc (~> 1.4)
44
42
  pry (0.14.1)
45
43
  coderay (~> 1.1)
@@ -59,7 +57,7 @@ GEM
59
57
  unicode-display_width (>= 1.1.1, < 3)
60
58
  tzinfo (2.0.5)
61
59
  concurrent-ruby (~> 1.0)
62
- unicode-display_width (2.2.0)
60
+ unicode-display_width (2.3.0)
63
61
  webrick (1.7.0)
64
62
  yard (0.9.28)
65
63
  webrick (~> 1.7.0)
@@ -105,6 +105,12 @@ module PryHelper
105
105
  @@models = []
106
106
 
107
107
  ActiveRecord::Base.connection.tap do |conn|
108
+ Rails.root.join("app/models").tap do |path|
109
+ Dir.glob("#{path}/**/*.rb").each do |file|
110
+ file_name = File.basename(file, '.rb')
111
+ file_name.classify.constantize
112
+ end
113
+ end
108
114
  defined_models = ::ApplicationRecord.descendants
109
115
  tables = conn.tables
110
116
  if conn.adapter_name == 'Mysql2'
@@ -124,7 +130,7 @@ module PryHelper
124
130
  tables.each do |table_name|
125
131
  table_comment = comments[table_name]
126
132
  primary_keys[table_name].tap do |pkey|
127
- table_name.camelize.tap do |const_name|
133
+ table_name.classify.camelize.tap do |const_name|
128
134
  const_name = 'Modul' if const_name == 'Module'
129
135
  const_name = 'Clazz' if const_name == 'Class'
130
136
  if model_class = defined_models.find { |m| m.table_name == table_name }
@@ -1,3 +1,3 @@
1
1
  module PryHelper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/pry-helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- if Rails.const_defined? 'Console'
1
+ if defined? Rails && Rails.const_defined? 'Console'
2
2
  Pry.hooks.add_hook(:when_started, :pry_helper) do |output, binding, pry|
3
3
  require 'terminal-table'
4
4
  require 'table_print'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Xiang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord