rails_console_pro 0.1.0
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 +7 -0
- data/.editorconfig +12 -0
- data/.rspec +4 -0
- data/.rspec_status +240 -0
- data/.rubocop.yml +26 -0
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +76 -0
- data/LICENSE.txt +22 -0
- data/QUICK_START.md +112 -0
- data/README.md +124 -0
- data/Rakefile +13 -0
- data/config/database.yml +3 -0
- data/docs/ASSOCIATION_NAVIGATION.md +85 -0
- data/docs/EXPORT.md +95 -0
- data/docs/FORMATTING.md +86 -0
- data/docs/MODEL_STATISTICS.md +72 -0
- data/docs/OBJECT_DIFFING.md +87 -0
- data/docs/SCHEMA_INSPECTION.md +60 -0
- data/docs/SQL_EXPLAIN.md +70 -0
- data/lib/generators/rails_console_pro/install_generator.rb +16 -0
- data/lib/generators/rails_console_pro/templates/rails_console_pro.rb +44 -0
- data/lib/rails_console_pro/active_record_extensions.rb +113 -0
- data/lib/rails_console_pro/association_navigator.rb +273 -0
- data/lib/rails_console_pro/base_printer.rb +74 -0
- data/lib/rails_console_pro/color_helper.rb +36 -0
- data/lib/rails_console_pro/commands/base_command.rb +17 -0
- data/lib/rails_console_pro/commands/diff_command.rb +135 -0
- data/lib/rails_console_pro/commands/explain_command.rb +118 -0
- data/lib/rails_console_pro/commands/export_command.rb +16 -0
- data/lib/rails_console_pro/commands/schema_command.rb +20 -0
- data/lib/rails_console_pro/commands/stats_command.rb +93 -0
- data/lib/rails_console_pro/commands.rb +34 -0
- data/lib/rails_console_pro/configuration.rb +219 -0
- data/lib/rails_console_pro/diff_result.rb +56 -0
- data/lib/rails_console_pro/error_handler.rb +60 -0
- data/lib/rails_console_pro/explain_result.rb +47 -0
- data/lib/rails_console_pro/format_exporter.rb +403 -0
- data/lib/rails_console_pro/global_methods.rb +42 -0
- data/lib/rails_console_pro/initializer.rb +176 -0
- data/lib/rails_console_pro/model_validator.rb +219 -0
- data/lib/rails_console_pro/paginator.rb +204 -0
- data/lib/rails_console_pro/printers/active_record_printer.rb +30 -0
- data/lib/rails_console_pro/printers/collection_printer.rb +34 -0
- data/lib/rails_console_pro/printers/diff_printer.rb +97 -0
- data/lib/rails_console_pro/printers/explain_printer.rb +151 -0
- data/lib/rails_console_pro/printers/relation_printer.rb +25 -0
- data/lib/rails_console_pro/printers/schema_printer.rb +188 -0
- data/lib/rails_console_pro/printers/stats_printer.rb +129 -0
- data/lib/rails_console_pro/pry_commands.rb +241 -0
- data/lib/rails_console_pro/pry_integration.rb +9 -0
- data/lib/rails_console_pro/railtie.rb +29 -0
- data/lib/rails_console_pro/schema_inspector_result.rb +43 -0
- data/lib/rails_console_pro/serializers/active_record_serializer.rb +18 -0
- data/lib/rails_console_pro/serializers/array_serializer.rb +31 -0
- data/lib/rails_console_pro/serializers/base_serializer.rb +25 -0
- data/lib/rails_console_pro/serializers/diff_serializer.rb +24 -0
- data/lib/rails_console_pro/serializers/explain_serializer.rb +35 -0
- data/lib/rails_console_pro/serializers/relation_serializer.rb +25 -0
- data/lib/rails_console_pro/serializers/schema_serializer.rb +121 -0
- data/lib/rails_console_pro/serializers/stats_serializer.rb +24 -0
- data/lib/rails_console_pro/services/column_stats_calculator.rb +64 -0
- data/lib/rails_console_pro/services/index_analyzer.rb +110 -0
- data/lib/rails_console_pro/services/stats_calculator.rb +40 -0
- data/lib/rails_console_pro/services/table_size_calculator.rb +43 -0
- data/lib/rails_console_pro/stats_result.rb +66 -0
- data/lib/rails_console_pro/version.rb +6 -0
- data/lib/rails_console_pro.rb +14 -0
- data/lib/tasks/rails_console_pro.rake +10 -0
- data/rails_console_pro.gemspec +60 -0
- metadata +240 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsConsolePro
|
|
4
|
+
module Services
|
|
5
|
+
# Service for calculating column statistics
|
|
6
|
+
class ColumnStatsCalculator
|
|
7
|
+
def self.calculate(model_class, connection, table_name, safe_count_proc, config)
|
|
8
|
+
new(model_class, connection, table_name, safe_count_proc, config).calculate
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(model_class, connection, table_name, safe_count_proc, config)
|
|
12
|
+
@model_class = model_class
|
|
13
|
+
@connection = connection
|
|
14
|
+
@table_name = table_name
|
|
15
|
+
@safe_count = safe_count_proc
|
|
16
|
+
@config = config
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def calculate
|
|
20
|
+
# Skip for large tables (already checked in execute_stats, but defensive)
|
|
21
|
+
return {} if ModelValidator.large_table?(@model_class)
|
|
22
|
+
|
|
23
|
+
column_names = ModelValidator.safe_column_names(@model_class)
|
|
24
|
+
return {} unless column_names.any?
|
|
25
|
+
|
|
26
|
+
column_stats = {}
|
|
27
|
+
total_count = @safe_count.call
|
|
28
|
+
|
|
29
|
+
# Skip distinct count for very large tables (performance)
|
|
30
|
+
skip_distinct_threshold = @config.stats_skip_distinct_threshold
|
|
31
|
+
skip_distinct = total_count >= skip_distinct_threshold
|
|
32
|
+
|
|
33
|
+
column_names.each do |column_name|
|
|
34
|
+
stats = {}
|
|
35
|
+
|
|
36
|
+
# Count nulls (safe with error handling)
|
|
37
|
+
begin
|
|
38
|
+
null_count = @model_class.where("#{@connection.quote_column_name(column_name)} IS NULL").count
|
|
39
|
+
stats[:null_count] = null_count if null_count > 0
|
|
40
|
+
rescue => e
|
|
41
|
+
# Skip if column doesn't support null checks or query fails
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Count distinct values (only for smaller tables)
|
|
45
|
+
unless skip_distinct
|
|
46
|
+
begin
|
|
47
|
+
distinct_count = @model_class.distinct.count(column_name)
|
|
48
|
+
stats[:distinct_count] = distinct_count if distinct_count > 0
|
|
49
|
+
rescue => e
|
|
50
|
+
# Skip if calculation fails
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
column_stats[column_name] = stats if stats.any?
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
column_stats
|
|
58
|
+
rescue => e
|
|
59
|
+
{} # Return empty hash on any error
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsConsolePro
|
|
4
|
+
module Services
|
|
5
|
+
# Service for analyzing database index usage
|
|
6
|
+
class IndexAnalyzer
|
|
7
|
+
def self.analyze(connection, table_name)
|
|
8
|
+
new(connection, table_name).analyze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(connection, table_name)
|
|
12
|
+
@connection = connection
|
|
13
|
+
@table_name = table_name
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def analyze
|
|
17
|
+
return {} unless @table_name
|
|
18
|
+
|
|
19
|
+
adapter_name = @connection.adapter_name.downcase
|
|
20
|
+
index_usage = {}
|
|
21
|
+
|
|
22
|
+
case adapter_name
|
|
23
|
+
when /postgresql/
|
|
24
|
+
analyze_postgresql(index_usage)
|
|
25
|
+
when /mysql/
|
|
26
|
+
analyze_mysql(index_usage)
|
|
27
|
+
else
|
|
28
|
+
analyze_fallback(index_usage)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
index_usage
|
|
32
|
+
rescue => e
|
|
33
|
+
{} # Return empty hash on any error
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def analyze_postgresql(index_usage)
|
|
39
|
+
# Get index usage statistics from pg_stat_user_indexes
|
|
40
|
+
begin
|
|
41
|
+
quoted_table = @connection.quote(@table_name)
|
|
42
|
+
result = @connection.execute(
|
|
43
|
+
"SELECT schemaname, indexrelname, idx_scan, idx_tup_read, idx_tup_fetch
|
|
44
|
+
FROM pg_stat_user_indexes
|
|
45
|
+
WHERE relname = #{quoted_table}"
|
|
46
|
+
)
|
|
47
|
+
result.each do |row|
|
|
48
|
+
index_name = row['indexrelname'] || row[:indexrelname]
|
|
49
|
+
scans = row['idx_scan'] || row[:idx_scan] || 0
|
|
50
|
+
rows_read = row['idx_tup_read'] || row[:idx_tup_read] || 0
|
|
51
|
+
index_usage[index_name] = {
|
|
52
|
+
used: scans > 0,
|
|
53
|
+
scans: scans.to_i,
|
|
54
|
+
rows: rows_read.to_i
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
rescue => e
|
|
58
|
+
# Fallback to just listing indexes
|
|
59
|
+
fallback_to_listing(index_usage)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def analyze_mysql(index_usage)
|
|
64
|
+
# MySQL index usage from information_schema
|
|
65
|
+
begin
|
|
66
|
+
quoted_table = @connection.quote(@table_name)
|
|
67
|
+
result = @connection.execute(
|
|
68
|
+
"SELECT INDEX_NAME, SEQ_IN_INDEX, CARDINALITY
|
|
69
|
+
FROM information_schema.STATISTICS
|
|
70
|
+
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = #{quoted_table}
|
|
71
|
+
GROUP BY INDEX_NAME"
|
|
72
|
+
)
|
|
73
|
+
result.each do |row|
|
|
74
|
+
index_name = row['INDEX_NAME'] || row[:index_name]
|
|
75
|
+
cardinality = row['CARDINALITY'] || row[:cardinality] || 0
|
|
76
|
+
index_usage[index_name] = {
|
|
77
|
+
used: cardinality.to_i > 0,
|
|
78
|
+
cardinality: cardinality.to_i
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
rescue => e
|
|
82
|
+
# Fallback
|
|
83
|
+
fallback_to_listing(index_usage)
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def analyze_fallback(index_usage)
|
|
88
|
+
# Fallback: just list indexes
|
|
89
|
+
begin
|
|
90
|
+
indexes = @connection.indexes(@table_name)
|
|
91
|
+
indexes.each { |idx| index_usage[idx.name] = "available" }
|
|
92
|
+
rescue => e
|
|
93
|
+
# If indexes fail, return empty
|
|
94
|
+
{}
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def fallback_to_listing(index_usage)
|
|
99
|
+
begin
|
|
100
|
+
indexes = @connection.indexes(@table_name)
|
|
101
|
+
indexes.each { |idx| index_usage[idx.name] = { used: false } }
|
|
102
|
+
rescue => e
|
|
103
|
+
# If indexes fail, return empty
|
|
104
|
+
{}
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsConsolePro
|
|
4
|
+
module Services
|
|
5
|
+
# Service for calculating model growth rate statistics
|
|
6
|
+
class StatsCalculator
|
|
7
|
+
def self.calculate_growth_rate(model_class, safe_count_proc)
|
|
8
|
+
new(model_class, safe_count_proc).calculate_growth_rate
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(model_class, safe_count_proc)
|
|
12
|
+
@model_class = model_class
|
|
13
|
+
@safe_count = safe_count_proc
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def calculate_growth_rate
|
|
17
|
+
# Double-check created_at exists (defensive programming)
|
|
18
|
+
return nil unless ModelValidator.has_timestamp_column?(@model_class)
|
|
19
|
+
return nil unless ModelValidator.has_table?(@model_class)
|
|
20
|
+
|
|
21
|
+
begin
|
|
22
|
+
# Get count from 1 hour ago
|
|
23
|
+
one_hour_ago = 1.hour.ago
|
|
24
|
+
old_count = @model_class.where('created_at < ?', one_hour_ago).count
|
|
25
|
+
return nil if old_count == 0
|
|
26
|
+
|
|
27
|
+
current_count = @safe_count.call
|
|
28
|
+
return nil if current_count == old_count || current_count == 0
|
|
29
|
+
|
|
30
|
+
# Calculate percentage change
|
|
31
|
+
((current_count - old_count).to_f / old_count * 100).round(2)
|
|
32
|
+
rescue => e
|
|
33
|
+
# Silently fail - growth rate is optional
|
|
34
|
+
nil
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsConsolePro
|
|
4
|
+
module Services
|
|
5
|
+
# Service for calculating database table sizes
|
|
6
|
+
class TableSizeCalculator
|
|
7
|
+
def self.calculate(connection, table_name)
|
|
8
|
+
new(connection, table_name).calculate
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(connection, table_name)
|
|
12
|
+
@connection = connection
|
|
13
|
+
@table_name = table_name
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def calculate
|
|
17
|
+
adapter_name = @connection.adapter_name.downcase
|
|
18
|
+
quoted_table = @connection.quote(@table_name)
|
|
19
|
+
|
|
20
|
+
size_value = case adapter_name
|
|
21
|
+
when /postgresql/
|
|
22
|
+
result = @connection.execute("SELECT pg_total_relation_size(#{quoted_table}) as size")
|
|
23
|
+
row = result.first
|
|
24
|
+
row['size'] || row[:size]
|
|
25
|
+
when /mysql/
|
|
26
|
+
result = @connection.execute(
|
|
27
|
+
"SELECT data_length + index_length as size FROM information_schema.tables WHERE table_schema = DATABASE() AND table_name = #{quoted_table}"
|
|
28
|
+
)
|
|
29
|
+
row = result.first
|
|
30
|
+
row['size'] || row[:size]
|
|
31
|
+
else
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
return nil unless size_value
|
|
36
|
+
size_value.is_a?(Numeric) ? size_value : size_value.to_i
|
|
37
|
+
rescue => e
|
|
38
|
+
nil
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsConsolePro
|
|
4
|
+
# Value object for model statistics
|
|
5
|
+
class StatsResult
|
|
6
|
+
attr_reader :model, :record_count, :growth_rate, :table_size,
|
|
7
|
+
:index_usage, :column_stats, :timestamp
|
|
8
|
+
|
|
9
|
+
def initialize(model:, record_count:, growth_rate: nil, table_size: nil,
|
|
10
|
+
index_usage: {}, column_stats: {}, timestamp: Time.current)
|
|
11
|
+
@model = model
|
|
12
|
+
@record_count = record_count
|
|
13
|
+
@growth_rate = growth_rate
|
|
14
|
+
@table_size = table_size
|
|
15
|
+
@index_usage = index_usage
|
|
16
|
+
@column_stats = column_stats
|
|
17
|
+
@timestamp = timestamp
|
|
18
|
+
validate_model!
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def ==(other)
|
|
22
|
+
other.is_a?(self.class) && other.model == model && other.timestamp == timestamp
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def has_growth_data?
|
|
26
|
+
!growth_rate.nil?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def has_table_size?
|
|
30
|
+
!table_size.nil?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def has_index_data?
|
|
34
|
+
index_usage.any?
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Export to JSON
|
|
38
|
+
def to_json(pretty: true)
|
|
39
|
+
FormatExporter.to_json(self, pretty: pretty)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Export to YAML
|
|
43
|
+
def to_yaml
|
|
44
|
+
FormatExporter.to_yaml(self)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Export to HTML
|
|
48
|
+
def to_html(style: :default)
|
|
49
|
+
FormatExporter.to_html(self, title: "Statistics: #{model.name}", style: style)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Export to file
|
|
53
|
+
def export_to_file(file_path, format: nil)
|
|
54
|
+
FormatExporter.export_to_file(self, file_path, format: format)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def validate_model!
|
|
60
|
+
ModelValidator.validate_model!(model)
|
|
61
|
+
if ModelValidator.abstract_class?(model)
|
|
62
|
+
raise ArgumentError, "#{model} is an abstract class and has no database table"
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "rails_console_pro/version"
|
|
4
|
+
require_relative "rails_console_pro/initializer"
|
|
5
|
+
|
|
6
|
+
# Auto-load Railtie for Rails integration
|
|
7
|
+
if defined?(Rails)
|
|
8
|
+
require_relative "rails_console_pro/railtie"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Main entry point for Rails Console Pro
|
|
12
|
+
module RailsConsolePro
|
|
13
|
+
class Error < StandardError; end
|
|
14
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/rails_console_pro/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "rails_console_pro"
|
|
7
|
+
spec.version = RailsConsolePro::VERSION
|
|
8
|
+
spec.authors = ["Harsh"]
|
|
9
|
+
spec.email = ["harsh.patel.hp846@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Enhanced Rails console with schema inspection, SQL explain, association navigation, and beautiful formatting"
|
|
12
|
+
spec.description = <<~DESC
|
|
13
|
+
Rails Console Pro enhances your Rails console with powerful debugging tools:
|
|
14
|
+
- Beautiful colored formatting for ActiveRecord objects
|
|
15
|
+
- Schema inspection with columns, indexes, associations, validations
|
|
16
|
+
- SQL explain analysis with performance recommendations
|
|
17
|
+
- Interactive association navigation
|
|
18
|
+
- Model statistics (record counts, growth rates, table sizes)
|
|
19
|
+
- Object diffing and comparison
|
|
20
|
+
- Export to JSON, YAML, and HTML
|
|
21
|
+
- Smart pagination for large collections
|
|
22
|
+
DESC
|
|
23
|
+
spec.homepage = "https://github.com/yourusername/rails_console_pro"
|
|
24
|
+
spec.license = "MIT"
|
|
25
|
+
spec.required_ruby_version = ">= 3.0.0"
|
|
26
|
+
|
|
27
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
28
|
+
spec.metadata["source_code_uri"] = "https://github.com/yourusername/rails_console_pro"
|
|
29
|
+
spec.metadata["changelog_uri"] = "https://github.com/yourusername/rails_console_pro/blob/main/CHANGELOG.md"
|
|
30
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
|
31
|
+
|
|
32
|
+
# Specify which files should be added to the gem when it is released.
|
|
33
|
+
spec.files = Dir.chdir(__dir__) do
|
|
34
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
35
|
+
(File.expand_path(f) == __FILE__) ||
|
|
36
|
+
f.start_with?(*%w[bin/ test/ spec/ features/ .git .github appveyor Gemfile])
|
|
37
|
+
end
|
|
38
|
+
rescue
|
|
39
|
+
# Fallback if git is not available
|
|
40
|
+
Dir.glob("{lib,exe}/**/*", File::FNM_DOTMATCH).select { |f| File.file?(f) }
|
|
41
|
+
end
|
|
42
|
+
spec.bindir = "exe"
|
|
43
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
44
|
+
spec.require_paths = ["lib"]
|
|
45
|
+
|
|
46
|
+
# Dependencies
|
|
47
|
+
spec.add_dependency "pastel", "~> 0.8.0"
|
|
48
|
+
spec.add_dependency "tty-color", "~> 0.6.0"
|
|
49
|
+
# Pry is optional - gem works with or without it
|
|
50
|
+
# Users can install pry-rails separately if they want Pry as default console
|
|
51
|
+
spec.add_dependency "pry", ">= 0.14.0", "< 0.16.0"
|
|
52
|
+
|
|
53
|
+
# Development dependencies
|
|
54
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
55
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
56
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
|
57
|
+
spec.add_development_dependency "rails", ">= 6.0"
|
|
58
|
+
spec.add_development_dependency "sqlite3", "~> 2.1"
|
|
59
|
+
end
|
|
60
|
+
|
metadata
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rails_console_pro
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Harsh
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: pastel
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.8.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.8.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: tty-color
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 0.6.0
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 0.6.0
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: pry
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 0.14.0
|
|
47
|
+
- - "<"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: 0.16.0
|
|
50
|
+
type: :runtime
|
|
51
|
+
prerelease: false
|
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
53
|
+
requirements:
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 0.14.0
|
|
57
|
+
- - "<"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 0.16.0
|
|
60
|
+
- !ruby/object:Gem::Dependency
|
|
61
|
+
name: bundler
|
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
|
63
|
+
requirements:
|
|
64
|
+
- - "~>"
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: '2.0'
|
|
67
|
+
type: :development
|
|
68
|
+
prerelease: false
|
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
70
|
+
requirements:
|
|
71
|
+
- - "~>"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '2.0'
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: rake
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - "~>"
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: '13.0'
|
|
81
|
+
type: :development
|
|
82
|
+
prerelease: false
|
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
84
|
+
requirements:
|
|
85
|
+
- - "~>"
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: '13.0'
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: rspec
|
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '3.12'
|
|
95
|
+
type: :development
|
|
96
|
+
prerelease: false
|
|
97
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
98
|
+
requirements:
|
|
99
|
+
- - "~>"
|
|
100
|
+
- !ruby/object:Gem::Version
|
|
101
|
+
version: '3.12'
|
|
102
|
+
- !ruby/object:Gem::Dependency
|
|
103
|
+
name: rails
|
|
104
|
+
requirement: !ruby/object:Gem::Requirement
|
|
105
|
+
requirements:
|
|
106
|
+
- - ">="
|
|
107
|
+
- !ruby/object:Gem::Version
|
|
108
|
+
version: '6.0'
|
|
109
|
+
type: :development
|
|
110
|
+
prerelease: false
|
|
111
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
112
|
+
requirements:
|
|
113
|
+
- - ">="
|
|
114
|
+
- !ruby/object:Gem::Version
|
|
115
|
+
version: '6.0'
|
|
116
|
+
- !ruby/object:Gem::Dependency
|
|
117
|
+
name: sqlite3
|
|
118
|
+
requirement: !ruby/object:Gem::Requirement
|
|
119
|
+
requirements:
|
|
120
|
+
- - "~>"
|
|
121
|
+
- !ruby/object:Gem::Version
|
|
122
|
+
version: '2.1'
|
|
123
|
+
type: :development
|
|
124
|
+
prerelease: false
|
|
125
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
126
|
+
requirements:
|
|
127
|
+
- - "~>"
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: '2.1'
|
|
130
|
+
description: |
|
|
131
|
+
Rails Console Pro enhances your Rails console with powerful debugging tools:
|
|
132
|
+
- Beautiful colored formatting for ActiveRecord objects
|
|
133
|
+
- Schema inspection with columns, indexes, associations, validations
|
|
134
|
+
- SQL explain analysis with performance recommendations
|
|
135
|
+
- Interactive association navigation
|
|
136
|
+
- Model statistics (record counts, growth rates, table sizes)
|
|
137
|
+
- Object diffing and comparison
|
|
138
|
+
- Export to JSON, YAML, and HTML
|
|
139
|
+
- Smart pagination for large collections
|
|
140
|
+
email:
|
|
141
|
+
- harsh.patel.hp846@gmail.com
|
|
142
|
+
executables: []
|
|
143
|
+
extensions: []
|
|
144
|
+
extra_rdoc_files: []
|
|
145
|
+
files:
|
|
146
|
+
- ".editorconfig"
|
|
147
|
+
- ".rspec"
|
|
148
|
+
- ".rspec_status"
|
|
149
|
+
- ".rubocop.yml"
|
|
150
|
+
- CHANGELOG.md
|
|
151
|
+
- CONTRIBUTING.md
|
|
152
|
+
- LICENSE.txt
|
|
153
|
+
- QUICK_START.md
|
|
154
|
+
- README.md
|
|
155
|
+
- Rakefile
|
|
156
|
+
- config/database.yml
|
|
157
|
+
- docs/ASSOCIATION_NAVIGATION.md
|
|
158
|
+
- docs/EXPORT.md
|
|
159
|
+
- docs/FORMATTING.md
|
|
160
|
+
- docs/MODEL_STATISTICS.md
|
|
161
|
+
- docs/OBJECT_DIFFING.md
|
|
162
|
+
- docs/SCHEMA_INSPECTION.md
|
|
163
|
+
- docs/SQL_EXPLAIN.md
|
|
164
|
+
- lib/generators/rails_console_pro/install_generator.rb
|
|
165
|
+
- lib/generators/rails_console_pro/templates/rails_console_pro.rb
|
|
166
|
+
- lib/rails_console_pro.rb
|
|
167
|
+
- lib/rails_console_pro/active_record_extensions.rb
|
|
168
|
+
- lib/rails_console_pro/association_navigator.rb
|
|
169
|
+
- lib/rails_console_pro/base_printer.rb
|
|
170
|
+
- lib/rails_console_pro/color_helper.rb
|
|
171
|
+
- lib/rails_console_pro/commands.rb
|
|
172
|
+
- lib/rails_console_pro/commands/base_command.rb
|
|
173
|
+
- lib/rails_console_pro/commands/diff_command.rb
|
|
174
|
+
- lib/rails_console_pro/commands/explain_command.rb
|
|
175
|
+
- lib/rails_console_pro/commands/export_command.rb
|
|
176
|
+
- lib/rails_console_pro/commands/schema_command.rb
|
|
177
|
+
- lib/rails_console_pro/commands/stats_command.rb
|
|
178
|
+
- lib/rails_console_pro/configuration.rb
|
|
179
|
+
- lib/rails_console_pro/diff_result.rb
|
|
180
|
+
- lib/rails_console_pro/error_handler.rb
|
|
181
|
+
- lib/rails_console_pro/explain_result.rb
|
|
182
|
+
- lib/rails_console_pro/format_exporter.rb
|
|
183
|
+
- lib/rails_console_pro/global_methods.rb
|
|
184
|
+
- lib/rails_console_pro/initializer.rb
|
|
185
|
+
- lib/rails_console_pro/model_validator.rb
|
|
186
|
+
- lib/rails_console_pro/paginator.rb
|
|
187
|
+
- lib/rails_console_pro/printers/active_record_printer.rb
|
|
188
|
+
- lib/rails_console_pro/printers/collection_printer.rb
|
|
189
|
+
- lib/rails_console_pro/printers/diff_printer.rb
|
|
190
|
+
- lib/rails_console_pro/printers/explain_printer.rb
|
|
191
|
+
- lib/rails_console_pro/printers/relation_printer.rb
|
|
192
|
+
- lib/rails_console_pro/printers/schema_printer.rb
|
|
193
|
+
- lib/rails_console_pro/printers/stats_printer.rb
|
|
194
|
+
- lib/rails_console_pro/pry_commands.rb
|
|
195
|
+
- lib/rails_console_pro/pry_integration.rb
|
|
196
|
+
- lib/rails_console_pro/railtie.rb
|
|
197
|
+
- lib/rails_console_pro/schema_inspector_result.rb
|
|
198
|
+
- lib/rails_console_pro/serializers/active_record_serializer.rb
|
|
199
|
+
- lib/rails_console_pro/serializers/array_serializer.rb
|
|
200
|
+
- lib/rails_console_pro/serializers/base_serializer.rb
|
|
201
|
+
- lib/rails_console_pro/serializers/diff_serializer.rb
|
|
202
|
+
- lib/rails_console_pro/serializers/explain_serializer.rb
|
|
203
|
+
- lib/rails_console_pro/serializers/relation_serializer.rb
|
|
204
|
+
- lib/rails_console_pro/serializers/schema_serializer.rb
|
|
205
|
+
- lib/rails_console_pro/serializers/stats_serializer.rb
|
|
206
|
+
- lib/rails_console_pro/services/column_stats_calculator.rb
|
|
207
|
+
- lib/rails_console_pro/services/index_analyzer.rb
|
|
208
|
+
- lib/rails_console_pro/services/stats_calculator.rb
|
|
209
|
+
- lib/rails_console_pro/services/table_size_calculator.rb
|
|
210
|
+
- lib/rails_console_pro/stats_result.rb
|
|
211
|
+
- lib/rails_console_pro/version.rb
|
|
212
|
+
- lib/tasks/rails_console_pro.rake
|
|
213
|
+
- rails_console_pro.gemspec
|
|
214
|
+
homepage: https://github.com/yourusername/rails_console_pro
|
|
215
|
+
licenses:
|
|
216
|
+
- MIT
|
|
217
|
+
metadata:
|
|
218
|
+
homepage_uri: https://github.com/yourusername/rails_console_pro
|
|
219
|
+
source_code_uri: https://github.com/yourusername/rails_console_pro
|
|
220
|
+
changelog_uri: https://github.com/yourusername/rails_console_pro/blob/main/CHANGELOG.md
|
|
221
|
+
rubygems_mfa_required: 'true'
|
|
222
|
+
rdoc_options: []
|
|
223
|
+
require_paths:
|
|
224
|
+
- lib
|
|
225
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
226
|
+
requirements:
|
|
227
|
+
- - ">="
|
|
228
|
+
- !ruby/object:Gem::Version
|
|
229
|
+
version: 3.0.0
|
|
230
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
|
+
requirements:
|
|
232
|
+
- - ">="
|
|
233
|
+
- !ruby/object:Gem::Version
|
|
234
|
+
version: '0'
|
|
235
|
+
requirements: []
|
|
236
|
+
rubygems_version: 3.7.2
|
|
237
|
+
specification_version: 4
|
|
238
|
+
summary: Enhanced Rails console with schema inspection, SQL explain, association navigation,
|
|
239
|
+
and beautiful formatting
|
|
240
|
+
test_files: []
|