model_probe 1.0.6 → 1.1.0

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
- SHA1:
3
- metadata.gz: 87ab415eaa252a11811f0502ae31564a3b3346ef
4
- data.tar.gz: 1267d9c94f1ff29e07706cf62a897a5c5608fc49
2
+ SHA256:
3
+ metadata.gz: dfbbaa56b645ab7e076623397e7af297d5113ffd6820b31e0e16468f648c9653
4
+ data.tar.gz: 42b742bd32a1f2a8fda04e7ea1b32425b14d0c58ebc63ee2543b208883f3f379
5
5
  SHA512:
6
- metadata.gz: 0dcc0b484c372dd23e761200acf7bde44a35fdf1997c11ffe5ec1af5170995e3a7e073b2243174cd1bc50566e061f874012347662c337729c3f3e7b4e3e06ee8
7
- data.tar.gz: 96a3d8ecb8ddc01e5b3b706de0c406a82d0f8df0e125f2054e8a8e13ec2e95ee24ccff0b361763c6420ee85f78bc9e463a14010b8a2c17a1446de3a1cbd92ded
6
+ metadata.gz: f84ec45449d885f167fd3ca1b6e784b03ffd4e2ace226f1868dd162e817a9223a578456eb11e86be9532a57a0e36aa6d3d848a6b88a68aed0df3a74073419ebe
7
+ data.tar.gz: ffbd50414995be1cb831677959db557ffcb4bffacb46d0ed6f2a742d1e3154bcadfaac740a43d41964fcf6e8d7165b4f3b2364572cee0ead09ca48e0ee0c0ee3
data/Gemfile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,19 +1,60 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- model_probe (1.0.6)
4
+ model_probe (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- rake (10.4.2)
9
+ ast (2.4.2)
10
+ json (2.6.3)
11
+ language_server-protocol (3.17.0.3)
12
+ lint_roller (1.0.0)
13
+ magic_frozen_string_literal (1.2.0)
14
+ parallel (1.23.0)
15
+ parser (3.2.2.1)
16
+ ast (~> 2.4.1)
17
+ rainbow (3.1.1)
18
+ regexp_parser (2.8.0)
19
+ rexml (3.2.5)
20
+ rubocop (1.50.2)
21
+ json (~> 2.3)
22
+ parallel (~> 1.10)
23
+ parser (>= 3.2.0.0)
24
+ rainbow (>= 2.2.2, < 4.0)
25
+ regexp_parser (>= 1.8, < 3.0)
26
+ rexml (>= 3.2.5, < 4.0)
27
+ rubocop-ast (>= 1.28.0, < 2.0)
28
+ ruby-progressbar (~> 1.7)
29
+ unicode-display_width (>= 2.4.0, < 3.0)
30
+ rubocop-ast (1.28.1)
31
+ parser (>= 3.2.1.0)
32
+ rubocop-performance (1.16.0)
33
+ rubocop (>= 1.7.0, < 2.0)
34
+ rubocop-ast (>= 0.4.0)
35
+ ruby-progressbar (1.13.0)
36
+ standard (1.28.2)
37
+ language_server-protocol (~> 3.17.0.2)
38
+ lint_roller (~> 1.0)
39
+ rubocop (~> 1.50.2)
40
+ standard-custom (~> 1.0.0)
41
+ standard-performance (~> 1.0.1)
42
+ standard-custom (1.0.0)
43
+ lint_roller (~> 1.0)
44
+ standard-performance (1.0.1)
45
+ lint_roller (~> 1.0)
46
+ rubocop-performance (~> 1.16.0)
47
+ standardrb (1.0.1)
48
+ standard
49
+ unicode-display_width (2.4.2)
10
50
 
11
51
  PLATFORMS
12
- ruby
52
+ arm64-darwin-22
13
53
 
14
54
  DEPENDENCIES
55
+ magic_frozen_string_literal
15
56
  model_probe!
16
- rake
57
+ standardrb
17
58
 
18
59
  BUNDLED WITH
19
- 1.13.6
60
+ 2.4.10
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Nathan Hopkins
1
+ Copyright (c) 2023 Nathan Hopkins
2
2
 
3
3
  MIT License
4
4
 
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,30 +1,74 @@
1
1
  # ModelProbe
2
2
 
3
- ## Schema introspection for ActiveRecord
3
+ ## ActiveRecord schema visualization and model organization made easy 🙌
4
4
 
5
- Provides a detailed view of the underlying schema that backs an ActiveRecord model.
5
+ Colorized table info for columns, types, nullables, indexes...
6
+ and the actual DDL used by the database to create the table.
7
+ _All this and more with ModelProbe!_
6
8
 
7
- *This functionality can be added to any object that implements [ActiveRecord's columns interface](http://rubydoc.info/docs/rails/ActiveRecord/ModelSchema/ClassMethods#columns-instance_method).*
9
+ 1. Get a clear picture of your model's underlying schema with beautiful and informative schema introspection.
10
+ 1. Generate model class definitions with a well organized, logical structure.
11
+ 1. Create sensible text fixture stubs.
8
12
 
9
- ## Installation
13
+ <!-- Tocer[start]: Auto-generated, don't remove. -->
10
14
 
11
- Add this line to your application's Gemfile:
15
+ ## Table of Contents
12
16
 
13
- gem 'model_probe'
17
+ - [Quick Start](#quick-start)
18
+ - [Supported Databases](#supported-databases)
19
+ - [Videos](#videos)
20
+ - [Screenshots](#screenshots)
14
21
 
15
- And then execute:
22
+ <!-- Tocer[finish]: Auto-generated, don't remove. -->
16
23
 
17
- $ bundle
24
+ ## Quick Start
18
25
 
19
- Or install it yourself as:
26
+ 1. Add the GEM to your project
20
27
 
21
- $ gem install model_probe
28
+ ```sh
29
+ bundle add model_probe
30
+ ```
22
31
 
23
- ## Usage
32
+ _ModelProbe auto initializes in the Rails `development` environment._
24
33
 
25
- ```ruby
26
- MyModel.extend ModelProbe
27
- MyModel.probe
28
- MyModel.print_fixture
29
- MyModel.print_model
30
- ```
34
+ 1. Use in a Rails console
35
+
36
+ ```ruby
37
+ # examples for a User model
38
+ User.probe
39
+ User.print_model
40
+ User.print_fixture
41
+ ```
42
+ 1. Use with Rails (Rake) tasks
43
+
44
+ ```sh
45
+ # examples for a User model
46
+ bin/rails model_probe:probe[User]
47
+ bin/rails model_probe:print_model[User]
48
+ bin/rails model_probe:print_fixture[User]
49
+ ```
50
+
51
+ ## Supported Databases
52
+
53
+ - MySQL
54
+ - PostgreSQL
55
+ - SQLite
56
+ - _...more? contributions welcome ;)_
57
+
58
+ ## Videos
59
+
60
+ [![image](https://ik.imagekit.io/hopsoft/model_probe_intro_Zf04NFJ1-.webp?updatedAt=1683471619001)](https://youtu.be/Q3IdyKateQE)
61
+
62
+ ## Screenshots
63
+
64
+ Introspect your ActiveRecord models to build a deep understanding of the underlying database structure.
65
+
66
+ ![ModelProbe probe](https://ik.imagekit.io/hopsoft/mode_probe_probe_3ouJjft48.webp?updatedAt=1683465723169)
67
+
68
+ Generate a well organized template for your ActiveRecord model's class definition.
69
+
70
+ ![ModelProbe print_model](https://ik.imagekit.io/hopsoft/model_probe_print_model_sGOZWw-D5.webp?updatedAt=1683465723049)
71
+
72
+ Create fixture stubs to use in the test suite.
73
+
74
+ ![ModelProbe print_fixture](https://ik.imagekit.io/hopsoft/model_probe_print_fixture_ZZ2TavUO7.webp?updatedAt=1683465722977)
data/Rakefile CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
@@ -1,21 +1,28 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModelProbe
2
4
  module Color
3
5
  extend self
4
6
 
5
- colors = {
6
- :gray => "1;30",
7
- :red => 31,
8
- :green => 32,
9
- :yellow => 33,
10
- :blue => 34,
11
- :magenta => 35,
12
- :cyan => 36,
13
- :white => 37
7
+ COLORS = {
8
+ blue: 34,
9
+ cyan: 36,
10
+ gray: "1;30",
11
+ green: 32,
12
+ green_light: 92,
13
+ magenta: 35,
14
+ magenta_light: 95,
15
+ pink: "1;91",
16
+ red: 31,
17
+ red_light: 91,
18
+ white: 37,
19
+ yellow: 33,
20
+ yellow_light: 93
14
21
  }
15
22
 
16
- colors.each do |name, code|
23
+ COLORS.each do |name, code|
17
24
  define_method name do |text|
18
- "\e[#{code}m#{text}\e[0m"
25
+ "\e[#{code}m#{text}\e[0m"
19
26
  end
20
27
  end
21
28
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.env.development?
4
+ ActiveRecord::Base.extend ModelProbe
5
+
6
+ module ModelProbe
7
+ class Railtie < Rails::Railtie
8
+ rake_tasks do
9
+ load "tasks/model_probe.rake"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,4 @@
1
+ <%= name.underscore %>_fixture:
2
+ <% fixture_columns.each do |column| -%>
3
+ <%= column.name.underscore %>: <%= column&.default || column.type %>
4
+ <% end -%>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class <%= name -%> < <%= superclass_name %>
4
+ # extends ..................................................................................................
5
+
6
+ # includes .................................................................................................
7
+
8
+ # constants ................................................................................................
9
+
10
+ # class methods ............................................................................................
11
+ class << self
12
+ end
13
+
14
+ # relationships ............................................................................................
15
+ <% foreign_key_columns.each do |column| -%>
16
+ <%= "belongs_to :#{column.name.sub(/_id\z/, "")}" %>
17
+ <% end -%>
18
+
19
+ # validations ..............................................................................................
20
+ <% validation_columns.each do |column| -%>
21
+ <%= "validates :#{column.name}, presence: true" unless column.null if required_columns.include?(column) %>
22
+ <%= "validates :#{column.name}, length: {maximum: #{column.limit}}" if limit_columns.include?(column) %>
23
+ <% end -%>
24
+
25
+ # callbacks (caution: side effects) ........................................................................
26
+
27
+ # scopes (composable queries) ..............................................................................
28
+
29
+ # additional config (accepts_nested_attribute_for, etc.) ...................................................
30
+
31
+ # public instance methods ..................................................................................
32
+
33
+ # protected instance methods ...............................................................................
34
+
35
+ # private instance methods .................................................................................
36
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ModelProbe
2
- VERSION = "1.0.6"
4
+ VERSION = "1.1.0"
3
5
  end
data/lib/model_probe.rb CHANGED
@@ -1,113 +1,216 @@
1
- require "model_probe/version"
2
- require "model_probe/color"
1
+ # frozen_string_literal: true
2
+
3
+ require "erb"
4
+ require_relative "model_probe/version"
5
+ require_relative "model_probe/color"
6
+ require_relative "model_probe/railtie" if defined?(Rails)
3
7
 
4
8
  module ModelProbe
5
9
  include ModelProbe::Color
6
10
 
7
11
  # Pretty prints column meta data for an ActiveModel
8
12
  def probe
9
- name_pad = columns.map{ |c| c.name.length }.max + 1
10
- type_pad = columns.map{ |c| c.type.length }.max + 2
11
- sql_type_pad = columns.map{ |c| c.sql_type.length }.max + 1
12
-
13
- columns.sort{ |a, b| a.name <=> b.name }.map do |column|
14
- name = column.name
15
- name = "* #{name}" if primary_key_column?(column)
16
- print yellow(name.to_s.rjust(name_pad))
17
- print " "
18
- print blue(column.type.to_s.ljust(type_pad, "."))
19
- print magenta(column.sql_type.to_s.ljust(sql_type_pad))
20
- column.null ? print(red("NULL")) : print(" ")
21
- print " [#{column.default}]" if column.default
22
- print " #{gray column.comment}" if column.comment
23
- puts
24
- end
13
+ probe_header
14
+ probe_ddl
15
+ probe_columns
16
+ probe_indexes
17
+ probe_footer
25
18
  nil
26
19
  end
27
20
 
28
21
  # Prints a stub that can be used for a test fixture
29
22
  def print_fixture
30
- values = columns.sort_by(&:name).each_with_object({}) do |column, memo|
31
- next if primary_key_column?(column)
32
- next if timestamp_column?(column)
33
- memo[column.name] = column.default || "value"
34
- end
35
-
36
- hash = { self.name.underscore => values }
37
- puts hash.to_yaml
23
+ template = erb_template("model_probe/templates/fixture.yml.erb")
24
+ puts template.result_with_hash(name: name, fixture_columns: fixture_columns)
38
25
  nil
39
26
  end
40
27
 
41
28
  # Prints a new model definition based on the database schema
42
29
  def print_model
43
- puts "class #{name} < #{superclass.name}"
44
- puts " # extends ..................................................................."
45
- puts " # includes .................................................................."
46
- puts if relation_columns.size > 0
47
- puts " # relationships ............................................................."
48
- relation_columns.sort_by(&:name).each do |column|
49
- next if primary_key_column?(column)
50
- puts " belongs_to :#{column.name.sub(/_id\z/, "")}" if column.name =~ /_id\z/
51
- end
52
- puts if relation_columns.size > 0 || validation_columns.size > 0
53
- puts " # validations ..............................................................."
54
- validation_columns.sort_by(&:name).each do |column|
55
- next if primary_key_column?(column)
56
- puts " validates :#{column.name}, presence: true" unless column.null
57
- if %i(text string).include?(column.type) && column.limit.to_i > 0
58
- puts " validates :#{column.name}, length: { maximum: #{column.limit} }"
59
- end
60
- end
61
- puts if validation_columns.size > 0
62
- puts " # callbacks ................................................................."
63
- puts " # scopes ...................................................................."
64
- puts " # additional config (i.e. accepts_nested_attribute_for etc...) .............."
65
- puts
66
- puts " # class methods ............................................................."
67
- puts " class << self"
68
- puts " end"
69
- puts
70
- puts " # public instance methods ..................................................."
71
- puts
72
- puts " # protected instance methods ................................................"
73
- puts " protected"
74
- puts
75
- puts " # private instance methods .................................................."
76
- puts " private"
77
- puts "end"
30
+ template = erb_template("model_probe/templates/model.rb.erb")
31
+ puts template.result_with_hash(
32
+ name: name,
33
+ superclass_name: superclass.name,
34
+ primary_key_columns: primary_key_columns,
35
+ foreign_key_columns: foreign_key_columns,
36
+ relation_columns: relation_columns,
37
+ required_columns: required_columns,
38
+ limit_columns: limit_columns,
39
+ validation_columns: validation_columns
40
+ )
78
41
  nil
79
42
  end
80
43
 
81
44
  private
82
45
 
83
- def relation_columns
84
- @relation_columns ||= begin
85
- columns.select { |column| relation_column? column }
86
- end
87
- end
88
-
89
- def validation_columns
90
- @validation_columns ||= begin
91
- columns.select { |column| validation_column? column }
92
- end
46
+ def erb_template(relative_path)
47
+ template_path = File.expand_path(relative_path, __dir__)
48
+ template_text = File.read(template_path)
49
+ # trim_mode doesn't seem to work regardless of how it's passed with Ruby 2.7.5
50
+ ERB.new template_text, trim_mode: "-"
93
51
  end
94
52
 
95
53
  def primary_key_column?(column)
96
54
  column.name == primary_key
97
55
  end
98
56
 
57
+ def foreign_key_column?(column)
58
+ return false if primary_key_column?(column)
59
+ column.name.end_with? "_id"
60
+ end
61
+
99
62
  def timestamp_column?(column)
100
63
  column.type == :datetime && column.name =~ /(created|updated|modified)/
101
64
  end
102
65
 
66
+ def required_column?(column)
67
+ return false if primary_key_column?(column)
68
+ return false if foreign_key_column?(column)
69
+ return false if timestamp_column?(column)
70
+ !column.null
71
+ end
72
+
73
+ def limit_column?(column)
74
+ return false if primary_key_column?(column)
75
+ return false if foreign_key_column?(column)
76
+ return false if timestamp_column?(column)
77
+ %i[text string].include?(column.type) && column.limit.to_i > 0
78
+ end
79
+
80
+ def primary_key_columns
81
+ columns.select { |column| primary_key_column? column }.sort_by(&:name)
82
+ end
83
+
84
+ def foreign_key_columns
85
+ columns.select { |column| foreign_key_column? column }.sort_by(&:name)
86
+ end
87
+
88
+ def relation_columns
89
+ columns.select { |column| relation_column? column }.sort_by(&:name)
90
+ end
91
+
92
+ def required_columns
93
+ columns.select { |column| required_column? column }.sort_by(&:name)
94
+ end
95
+
96
+ def limit_columns
97
+ columns.select { |column| limit_column? column }.sort_by(&:name)
98
+ end
99
+
100
+ def validation_columns
101
+ (required_columns + limit_columns).uniq.sort_by(&:name)
102
+ end
103
+
103
104
  def relation_column?(column)
104
105
  return false if column.name == primary_key
105
106
  column.name.end_with?("_id")
106
107
  end
107
108
 
108
- def validation_column?(column)
109
- return false if column.name == primary_key
110
- return true unless column.null
111
- %i(text string).include?(column.type) && column.limit.to_i > 0
109
+ def fixture_columns
110
+ columns.sort_by(&:name).select do |column|
111
+ !primary_key_column?(column) && !timestamp_column?(column)
112
+ end
113
+ end
114
+
115
+ def ddl
116
+ config = connection_db_config.configuration_hash
117
+ @ddl ||= begin
118
+ case connection.adapter_name
119
+ when /sqlite/i
120
+ `sqlite3 #{config[:database]} '.schema #{table_name}'`
121
+ when /postgresql/i
122
+ `PGPASSWORD=#{config[:password]} pg_dump --host=#{config[:host]} --username=#{config[:username]} --schema-only --table=#{table_name} #{config[:database]}`
123
+ when /mysql/i
124
+ `mysqldump --host=#{config[:host]} --user=#{config[:username]} --password=#{config[:password]} --no-data --compact #{config[:database]} #{table_name}`
125
+ else
126
+ "DDL output is not yet supported for #{connection.adapter_name}!"
127
+ end
128
+ rescue => e
129
+ Color.red "Failed to generate DDL string! #{e.message}"
130
+ end
131
+ end
132
+
133
+ def probe_header
134
+ puts Color.gray "".ljust(110, "=")
135
+ print connection.adapter_name
136
+ print Color.gray(" (#{connection.database_version}) - ")
137
+ puts Color.green(table_name)
138
+ puts Color.gray "".ljust(110, "=")
139
+ puts
140
+ end
141
+
142
+ def probe_ddl(pad: 2)
143
+ return unless ddl
144
+ lines = ddl.split("\n")
145
+ lines.each do |line|
146
+ next if line.strip.blank?
147
+ next if line.strip.start_with?("--")
148
+ next if line.strip.start_with?("/*")
149
+ print " ".ljust(pad)
150
+ puts Color.gray(line)
151
+ end
152
+ puts
153
+ end
154
+
155
+ def probe_column(column, name_pad:, type_pad:, sql_type_pad:)
156
+ name = column.name
157
+ if primary_key_column?(column)
158
+ print Color.pink("*#{name}".rjust(name_pad))
159
+ else
160
+ print Color.magenta(name.to_s.rjust(name_pad))
161
+ end
162
+ print " "
163
+ print column.type.to_s.ljust(type_pad, ".")
164
+ print Color.gray(column.sql_type.to_s.ljust(sql_type_pad))
165
+ print Color.gray("NULLABLE ") if column.null
166
+ print Color.pink("REQUIRED ") unless column.null
167
+ print Color.gray("default=#{column.default} ") if column.default
168
+ print "- #{Color.gray column.comment}" if column.comment
169
+ puts
170
+ end
171
+
172
+ def probe_columns
173
+ name_pad = columns.map { |c| c.name.length }.max + 2
174
+ type_pad = columns.map { |c| c.type.length }.max + 2
175
+ sql_type_pad = columns.map { |c| c.sql_type.length }.max + 1
176
+
177
+ columns.sort_by(&:name).each do |column|
178
+ probe_column column, name_pad: name_pad, type_pad: type_pad, sql_type_pad: sql_type_pad
179
+ end
180
+ puts
181
+ end
182
+
183
+ def probe_index(index, name_pad:)
184
+ print Color.yellow_light(index.name.to_s.rjust(name_pad))
185
+ print Color.gray(" [")
186
+ index.columns.each_with_index do |column, index|
187
+ print Color.gray(", ") if index > 0
188
+ print Color.magenta(column)
189
+ end
190
+ print Color.gray("]")
191
+ print Color.green_light(" UNIQUE") if index.unique
192
+
193
+ if index.where
194
+ print Color.gray(" where(#{index.where})")
195
+ end
196
+
197
+ if index.using
198
+ print Color.gray(" using(#{index.using})")
199
+ end
200
+ puts
201
+ end
202
+
203
+ def probe_indexes
204
+ indexes = connection.indexes(table_name)
205
+ name_pad = indexes.map { |c| c.name.length }.max + 1
206
+
207
+ indexes.sort_by(&:name).each do |index|
208
+ probe_index index, name_pad: name_pad
209
+ end
210
+ puts
211
+ end
212
+
213
+ def probe_footer
214
+ puts Color.gray "".ljust(110, "=")
112
215
  end
113
216
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :model_probe do
4
+ desc <<~DESC
5
+ Probe. Usage: `rails model:probe[User]`
6
+ DESC
7
+ task :probe, [:klass] => :environment do |task, args|
8
+ puts args.klass.constantize.probe
9
+ end
10
+
11
+ desc <<~DESC
12
+ Print fixture. Usage: `rails model:print_fixture[User]`
13
+ DESC
14
+ task :print_fixture, [:klass] => :environment do |task, args|
15
+ puts args.klass.constantize.print_fixture
16
+ end
17
+
18
+ desc <<~DESC
19
+ Print model. Usage: `rails model:print_model[User]`
20
+ DESC
21
+ task :print_model, [:klass] => :environment do |task, args|
22
+ puts args.klass.constantize.print_model
23
+ end
24
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/model_probe/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "model_probe"
7
+ s.version = ModelProbe::VERSION
8
+ s.authors = ["Nathan Hopkins"]
9
+ s.email = ["natehop@gmail.com"]
10
+ s.summary = "ActiveRecord schema visualization and model organization made easy"
11
+ s.homepage = "http://hopsoft.github.com/model_probe/"
12
+
13
+ s.files = Dir["lib/**/*rb", "lib/tasks/*rake", "[A-Z]*"]
14
+
15
+ s.add_development_dependency "magic_frozen_string_literal"
16
+ s.add_development_dependency "standardrb"
17
+ end
data/tags ADDED
@@ -0,0 +1,106 @@
1
+ !_TAG_EXTRA_DESCRIPTION anonymous /Include tags for non-named objects like lambda/
2
+ !_TAG_EXTRA_DESCRIPTION fileScope /Include tags of file scope/
3
+ !_TAG_EXTRA_DESCRIPTION pseudo /Include pseudo tags/
4
+ !_TAG_EXTRA_DESCRIPTION subparser /Include tags generated by subparsers/
5
+ !_TAG_FIELD_DESCRIPTION epoch /the last modified time of the input file (only for F\/file kind tag)/
6
+ !_TAG_FIELD_DESCRIPTION file /File-restricted scoping/
7
+ !_TAG_FIELD_DESCRIPTION input /input file/
8
+ !_TAG_FIELD_DESCRIPTION name /tag name/
9
+ !_TAG_FIELD_DESCRIPTION pattern /pattern/
10
+ !_TAG_FIELD_DESCRIPTION typeref /Type and name of a variable or typedef/
11
+ !_TAG_FIELD_DESCRIPTION!Ruby mixin /how the class or module is mixed in (mixin:HOW:MODULE)/
12
+ !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
13
+ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
14
+ !_TAG_KIND_DESCRIPTION!GemSpec g,gem /gems/
15
+ !_TAG_KIND_DESCRIPTION!Markdown S,subsection /level 2 sections/
16
+ !_TAG_KIND_DESCRIPTION!Markdown T,l4subsection /level 4 sections/
17
+ !_TAG_KIND_DESCRIPTION!Markdown c,chapter /chapters/
18
+ !_TAG_KIND_DESCRIPTION!Markdown n,footnote /footnotes/
19
+ !_TAG_KIND_DESCRIPTION!Markdown s,section /sections/
20
+ !_TAG_KIND_DESCRIPTION!Markdown t,subsubsection /level 3 sections/
21
+ !_TAG_KIND_DESCRIPTION!Markdown u,l5subsection /level 5 sections/
22
+ !_TAG_KIND_DESCRIPTION!Rake d,directory /directory tasks/
23
+ !_TAG_KIND_DESCRIPTION!Rake f,File /file tasks/
24
+ !_TAG_KIND_DESCRIPTION!Rake m,multitask /multi tasks/
25
+ !_TAG_KIND_DESCRIPTION!Rake n,namespace /namespaces/
26
+ !_TAG_KIND_DESCRIPTION!Rake t,task /tasks/
27
+ !_TAG_KIND_DESCRIPTION!Rake x,xtask /tasks defined with special constructor/
28
+ !_TAG_KIND_DESCRIPTION!Ruby A,accessor /accessors/
29
+ !_TAG_KIND_DESCRIPTION!Ruby C,constant /constants/
30
+ !_TAG_KIND_DESCRIPTION!Ruby L,library /libraries/
31
+ !_TAG_KIND_DESCRIPTION!Ruby S,singletonMethod /singleton methods/
32
+ !_TAG_KIND_DESCRIPTION!Ruby a,alias /aliases/
33
+ !_TAG_KIND_DESCRIPTION!Ruby c,class /classes/
34
+ !_TAG_KIND_DESCRIPTION!Ruby f,method /methods/
35
+ !_TAG_KIND_DESCRIPTION!Ruby m,module /modules/
36
+ !_TAG_KIND_DESCRIPTION!Sh a,alias /aliases/
37
+ !_TAG_KIND_DESCRIPTION!Sh f,function /functions/
38
+ !_TAG_KIND_DESCRIPTION!Sh h,heredoc /label for here document/
39
+ !_TAG_KIND_DESCRIPTION!Sh s,script /script files/
40
+ !_TAG_OUTPUT_EXCMD mixed /number, pattern, mixed, or combineV2/
41
+ !_TAG_OUTPUT_FILESEP slash /slash or backslash/
42
+ !_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
43
+ !_TAG_OUTPUT_VERSION 0.0 /current.age/
44
+ !_TAG_PARSER_VERSION!GemSpec 0.0 /current.age/
45
+ !_TAG_PARSER_VERSION!Markdown 0.0 /current.age/
46
+ !_TAG_PARSER_VERSION!Rake 0.0 /current.age/
47
+ !_TAG_PARSER_VERSION!Ruby 0.0 /current.age/
48
+ !_TAG_PARSER_VERSION!Sh 0.0 /current.age/
49
+ !_TAG_PATTERN_LENGTH_LIMIT 96 /0 for no limit/
50
+ !_TAG_PROC_CWD /Users/nathan/work/hopsoft/model_probe/ //
51
+ !_TAG_PROGRAM_AUTHOR Universal Ctags Team //
52
+ !_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
53
+ !_TAG_PROGRAM_URL https://ctags.io/ /official site/
54
+ !_TAG_PROGRAM_VERSION 6.0.0 //
55
+ !_TAG_ROLE_DESCRIPTION!GemSpec!gem develDep /specifying development dependency/
56
+ !_TAG_ROLE_DESCRIPTION!GemSpec!gem runtimeDep /specifying runtime dependency/
57
+ !_TAG_ROLE_DESCRIPTION!Ruby!library loaded /loaded by "load" method/
58
+ !_TAG_ROLE_DESCRIPTION!Ruby!library required /loaded by "require" method/
59
+ !_TAG_ROLE_DESCRIPTION!Ruby!library requiredRel /loaded by "require_relative" method/
60
+ !_TAG_ROLE_DESCRIPTION!Sh!heredoc endmarker /end marker/
61
+ !_TAG_ROLE_DESCRIPTION!Sh!script loaded /loaded/
62
+ ActiveRecord schema visualization and model organization made easy 🙌 README.md /^## ActiveRecord schema visualization and model organization made easy 🙌$/;" s chapter:ModelProbe
63
+ COLORS lib/model_probe/color.rb /^ COLORS = {$/;" C module:ModelProbe.Color
64
+ Color lib/model_probe/color.rb /^ module Color$/;" m module:ModelProbe mixin:extend:self
65
+ ModelProbe README.md /^# ModelProbe$/;" c
66
+ ModelProbe lib/model_probe.rb /^module ModelProbe$/;" m mixin:include:ModelProbe.Color
67
+ ModelProbe lib/model_probe/color.rb /^module ModelProbe$/;" m
68
+ ModelProbe lib/model_probe/railtie.rb /^ module ModelProbe$/;" m
69
+ ModelProbe lib/model_probe/version.rb /^module ModelProbe$/;" m
70
+ Quick Start README.md /^## Quick Start$/;" s chapter:ModelProbe
71
+ Railtie lib/model_probe/railtie.rb /^ class Railtie < Rails::Railtie$/;" c module:ModelProbe
72
+ Screenshots README.md /^## Screenshots$/;" s chapter:ModelProbe
73
+ Supported Databases README.md /^## Supported Databases$/;" s chapter:ModelProbe
74
+ Table of Contents README.md /^## Table of Contents$/;" s chapter:ModelProbe
75
+ VERSION lib/model_probe/version.rb /^ VERSION = "1.1.0"$/;" C module:ModelProbe
76
+ Videos README.md /^## Videos$/;" s chapter:ModelProbe
77
+ ddl lib/model_probe.rb /^ def ddl$/;" f module:ModelProbe
78
+ erb_template lib/model_probe.rb /^ def erb_template(relative_path)$/;" f module:ModelProbe
79
+ fixture_columns lib/model_probe.rb /^ def fixture_columns$/;" f module:ModelProbe
80
+ foreign_key_column? lib/model_probe.rb /^ def foreign_key_column?(column)$/;" f module:ModelProbe
81
+ foreign_key_columns lib/model_probe.rb /^ def foreign_key_columns$/;" f module:ModelProbe
82
+ limit_column? lib/model_probe.rb /^ def limit_column?(column)$/;" f module:ModelProbe
83
+ limit_columns lib/model_probe.rb /^ def limit_columns$/;" f module:ModelProbe
84
+ model_probe lib/tasks/model_probe.rake /^namespace :model_probe do$/;" n
85
+ model_probe model_probe.gemspec /^ s.name = "model_probe"$/;" g
86
+ primary_key_column? lib/model_probe.rb /^ def primary_key_column?(column)$/;" f module:ModelProbe
87
+ primary_key_columns lib/model_probe.rb /^ def primary_key_columns$/;" f module:ModelProbe
88
+ print_fixture lib/model_probe.rb /^ def print_fixture$/;" f module:ModelProbe
89
+ print_fixture lib/tasks/model_probe.rake /^ task :print_fixture, [:klass] => :environment do |task, args|$/;" t namespace:model_probe
90
+ print_model lib/model_probe.rb /^ def print_model$/;" f module:ModelProbe
91
+ print_model lib/tasks/model_probe.rake /^ task :print_model, [:klass] => :environment do |task, args|$/;" t namespace:model_probe
92
+ probe lib/model_probe.rb /^ def probe$/;" f module:ModelProbe
93
+ probe lib/tasks/model_probe.rake /^ task :probe, [:klass] => :environment do |task, args|$/;" t namespace:model_probe
94
+ probe_column lib/model_probe.rb /^ def probe_column(column, name_pad:, type_pad:, sql_type_pad:)$/;" f module:ModelProbe
95
+ probe_columns lib/model_probe.rb /^ def probe_columns$/;" f module:ModelProbe
96
+ probe_ddl lib/model_probe.rb /^ def probe_ddl(pad: 2)$/;" f module:ModelProbe
97
+ probe_footer lib/model_probe.rb /^ def probe_footer$/;" f module:ModelProbe
98
+ probe_header lib/model_probe.rb /^ def probe_header$/;" f module:ModelProbe
99
+ probe_index lib/model_probe.rb /^ def probe_index(index, name_pad:)$/;" f module:ModelProbe
100
+ probe_indexes lib/model_probe.rb /^ def probe_indexes$/;" f module:ModelProbe
101
+ relation_column? lib/model_probe.rb /^ def relation_column?(column)$/;" f module:ModelProbe
102
+ relation_columns lib/model_probe.rb /^ def relation_columns$/;" f module:ModelProbe
103
+ required_column? lib/model_probe.rb /^ def required_column?(column)$/;" f module:ModelProbe
104
+ required_columns lib/model_probe.rb /^ def required_columns$/;" f module:ModelProbe
105
+ timestamp_column? lib/model_probe.rb /^ def timestamp_column?(column)$/;" f module:ModelProbe
106
+ validation_columns lib/model_probe.rb /^ def validation_columns$/;" f module:ModelProbe
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: model_probe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-30 00:00:00.000000000 Z
11
+ date: 2023-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: magic_frozen_string_literal
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -24,7 +24,21 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description:
27
+ - !ruby/object:Gem::Dependency
28
+ name: standardrb
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
28
42
  email:
29
43
  - natehop@gmail.com
30
44
  executables: []
@@ -38,11 +52,17 @@ files:
38
52
  - Rakefile
39
53
  - lib/model_probe.rb
40
54
  - lib/model_probe/color.rb
55
+ - lib/model_probe/railtie.rb
56
+ - lib/model_probe/templates/fixture.yml.erb
57
+ - lib/model_probe/templates/model.rb.erb
41
58
  - lib/model_probe/version.rb
59
+ - lib/tasks/model_probe.rake
60
+ - model_probe.gemspec
61
+ - tags
42
62
  homepage: http://hopsoft.github.com/model_probe/
43
63
  licenses: []
44
64
  metadata: {}
45
- post_install_message:
65
+ post_install_message:
46
66
  rdoc_options: []
47
67
  require_paths:
48
68
  - lib
@@ -57,9 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
77
  - !ruby/object:Gem::Version
58
78
  version: '0'
59
79
  requirements: []
60
- rubyforge_project:
61
- rubygems_version: 2.6.7
62
- signing_key:
80
+ rubygems_version: 3.4.10
81
+ signing_key:
63
82
  specification_version: 4
64
- summary: Schema introspection for ActiveModel
83
+ summary: ActiveRecord schema visualization and model organization made easy
65
84
  test_files: []