rails_sql_prettifier 6.0.2 → 6.1.3
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/.byebug_history +34 -0
- data/.ruby-gemset +1 -1
- data/CHANGELOG.md +7 -2
- data/Dockerfile +20 -0
- data/README.md +11 -3
- data/docker-compose.yml +10 -0
- data/lib/rails_sql_prettifier/version.rb +1 -1
- data/lib/rails_sql_prettifier.rb +16 -11
- data/rails_sql_prettifier.gemspec +4 -2
- metadata +38 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27c2c94ce703f039972dc6a71d7141875b70fbe8ee4c069ca6c0fd0e0a61c8b0
|
4
|
+
data.tar.gz: d4065bbe16258c466c12906f636a606477f35659a10c71ec504a0044d672b24b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfa6e69b57fdf10fbc5508031805423683947bbbd3c7f68cb4c749db131a6e45dc2e58f653fd59c92244cb6e93b42fd277fd63c7451a902814de16b57f1576b0
|
7
|
+
data.tar.gz: 1fc269b0db15097276a0c73dbe7e96f4e796983a4eded9025db72d08f97aeb06929b5ed61759144f598a2bc29682f25c65cffbef9d47c16e93318ab55b488b2a
|
data/.byebug_history
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
exit
|
2
|
+
ActiveRecord::Base.connection_db_config.adapter
|
3
|
+
ActiveRecord::Base.connection_db_config.adpter
|
4
|
+
ActiveRecord::Base.connection_db_config
|
5
|
+
c
|
6
|
+
exit
|
7
|
+
si.sql
|
8
|
+
si
|
9
|
+
c
|
10
|
+
sql_body
|
11
|
+
n
|
12
|
+
s
|
13
|
+
original_sql_query
|
14
|
+
err
|
15
|
+
s
|
16
|
+
up
|
17
|
+
s
|
18
|
+
up
|
19
|
+
s
|
20
|
+
up
|
21
|
+
s
|
22
|
+
super
|
23
|
+
try(:sql)
|
24
|
+
Niceql.config.prettify_pg_errors
|
25
|
+
c
|
26
|
+
exit
|
27
|
+
err_template
|
28
|
+
si.to_s
|
29
|
+
exit
|
30
|
+
err_caret_line
|
31
|
+
err_quote_caret_offset
|
32
|
+
c
|
33
|
+
err.lines[1].index( '...' ).to_i
|
34
|
+
err_caret_line
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
rails_sql_prettifier_ar_6
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
-
# 6.
|
1
|
+
# 6.1.3
|
2
|
+
* Now AR is a dependency not a development dependency
|
3
|
+
|
4
|
+
# 6.1.0
|
2
5
|
|
3
6
|
* This a active record prior to 7.0 version and >= 6.1 compatible niceql integration
|
4
7
|
ar < 6.0 breaking change:
|
5
|
-
* StatementInvalid initialization
|
8
|
+
* StatementInvalid initialization ahs a breaking change: starting version 6 it has named param sql: for original query )
|
6
9
|
|
10
|
+
ar <= 6.1:
|
11
|
+
* Starting from 6.1 connection_db_config method replaced connection_config which was a hash
|
data/Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM ruby:2.7.5-bullseye
|
2
|
+
|
3
|
+
WORKDIR /app
|
4
|
+
RUN apt-get update && apt-get -y install lsb-release
|
5
|
+
#
|
6
|
+
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
|
7
|
+
sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
|
8
|
+
apt-get update && apt-get -y install postgresql postgresql-client-12
|
9
|
+
|
10
|
+
RUN sh -c 'echo "local all all trust" > /etc/postgresql/14/main/pg_hba.conf' && \
|
11
|
+
service postgresql start && \
|
12
|
+
psql -U postgres -c 'CREATE DATABASE "niceql-test"'
|
13
|
+
|
14
|
+
RUN gem install bundler
|
15
|
+
|
16
|
+
COPY lib/rails_sql_prettifier/version.rb /app/lib/rails_sql_prettifier/version.rb
|
17
|
+
COPY rails_sql_prettifier.gemspec /app/
|
18
|
+
COPY Gemfil* /app/
|
19
|
+
#
|
20
|
+
RUN bundle install
|
data/README.md
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
# RailsSQLPrettifier
|
2
2
|
|
3
|
-
This is an ActiveRecord integration for a niceql gem.
|
4
|
-
|
3
|
+
This is an ActiveRecord integration for a niceql gem ( niceql is a small, nice, simple and zero dependency solution for the SQL prettifying in ruby ).
|
4
|
+
|
5
|
+
This gem started as a code extraction from niceql version 0.4.x.
|
6
|
+
|
7
|
+
It has versioning aligned to the ActiveRecord versions, niceql prior to 0.5 version had hardcoded logic branches based on ActiveRecord versioning.
|
8
|
+
|
9
|
+
That is hard to maintain and hard to test, and also coupling with AR is breaking the original idea of the niceql to be a dependentless solution, so now the niceql is a completely railsfree gem yeay! ( It still has some some checks related to AR implemetations in the error prettifying methods. It will be completely decoupled in the future )
|
5
10
|
|
6
11
|
Any reasonable suggestions are welcome.
|
7
12
|
|
@@ -23,10 +28,13 @@ after:
|
|
23
28
|
|
24
29
|
## Installation
|
25
30
|
|
31
|
+
rails_sql_prettifier, has several version compatible with different active_record versions, so pay attention to the right versioning
|
32
|
+
if whenever you specify versions manually.
|
33
|
+
|
26
34
|
Add this line to your application's Gemfile:
|
27
35
|
|
28
36
|
```ruby
|
29
|
-
gem 'rails_sql_prettifier'
|
37
|
+
gem 'rails_sql_prettifier', '~> X.X.X'
|
30
38
|
```
|
31
39
|
|
32
40
|
And then execute:
|
data/docker-compose.yml
ADDED
data/lib/rails_sql_prettifier.rb
CHANGED
@@ -2,8 +2,8 @@ require "rails_sql_prettifier/version"
|
|
2
2
|
require 'active_record'
|
3
3
|
require "niceql"
|
4
4
|
|
5
|
+
|
5
6
|
module RailsSQLPrettifier
|
6
|
-
include Niceql
|
7
7
|
|
8
8
|
module ArExtentions
|
9
9
|
def exec_niceql
|
@@ -44,7 +44,7 @@ module RailsSQLPrettifier
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
module
|
47
|
+
module NiceQLConfigExt
|
48
48
|
extend ActiveSupport::Concern
|
49
49
|
|
50
50
|
included do
|
@@ -55,7 +55,7 @@ module RailsSQLPrettifier
|
|
55
55
|
|
56
56
|
|
57
57
|
def ar_using_pg_adapter?
|
58
|
-
ActiveRecord::Base.
|
58
|
+
ActiveRecord::Base.connection_db_config.adapter == 'postgresql'
|
59
59
|
end
|
60
60
|
|
61
61
|
def initialize
|
@@ -64,17 +64,19 @@ module RailsSQLPrettifier
|
|
64
64
|
self.prettify_active_record_log_output = false
|
65
65
|
self.prettify_pg_errors = ar_using_pg_adapter?
|
66
66
|
end
|
67
|
+
end
|
67
68
|
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
module NiceqlExt
|
70
|
+
def configure
|
71
|
+
super
|
71
72
|
|
72
|
-
|
73
|
+
if config.pg_adapter_with_nicesql && defined?( ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter )
|
74
|
+
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include( PostgresAdapterNiceQL)
|
75
|
+
end
|
73
76
|
|
74
|
-
|
77
|
+
::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend( AbstractAdapterLogPrettifier ) if config.prettify_active_record_log_output
|
75
78
|
|
76
|
-
|
77
|
-
end
|
79
|
+
::ActiveRecord::StatementInvalid.include( RailsSQLPrettifier::ErrorExt ) if config.prettify_pg_errors && config.ar_using_pg_adapter?
|
78
80
|
end
|
79
81
|
end
|
80
82
|
|
@@ -82,5 +84,8 @@ module RailsSQLPrettifier
|
|
82
84
|
::Arel::TreeManager,
|
83
85
|
::Arel::Nodes::Node].each { |klass| klass.send(:include, ArExtentions) }
|
84
86
|
|
85
|
-
NiceQLConfig.include(
|
87
|
+
Niceql::NiceQLConfig.include( NiceQLConfigExt )
|
88
|
+
|
89
|
+
# we need to use a prepend otherwise it's not preceding Niceql.configure in a lookup chain
|
90
|
+
Niceql.singleton_class.prepend( NiceqlExt )
|
86
91
|
end
|
@@ -32,8 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
|
33
33
|
spec.required_ruby_version = '>= 2.4'
|
34
34
|
spec.add_dependency "niceql", '~> 0.5'
|
35
|
-
|
36
|
-
spec.add_development_dependency "activerecord", '>= 6.0', '< 6.1'
|
35
|
+
spec.add_dependency "activerecord", '>= 6.1', '< 7'
|
37
36
|
|
38
37
|
spec.add_development_dependency "bundler", ">= 1"
|
39
38
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
@@ -42,4 +41,7 @@ Gem::Specification.new do |spec|
|
|
42
41
|
spec.add_development_dependency "differ", '~> 0.1'
|
43
42
|
spec.add_development_dependency "pry-byebug", '~> 3.9'
|
44
43
|
spec.add_development_dependency 'sqlite3', '~> 1'
|
44
|
+
spec.add_development_dependency 'pg', '~> 1'
|
45
|
+
|
46
|
+
spec.add_development_dependency 'stubberry', '~> 0.1'
|
45
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_sql_prettifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alekseyl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: niceql
|
@@ -30,20 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '6.
|
33
|
+
version: '6.1'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
37
|
-
type: :
|
36
|
+
version: '7'
|
37
|
+
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '6.
|
43
|
+
version: '6.1'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '7'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,34 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '1'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: pg
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '1'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '1'
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: stubberry
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0.1'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0.1'
|
131
159
|
description: 'This is an ActiveRecord integration for the SQL prettifier gem niceql. '
|
132
160
|
email:
|
133
161
|
- leshchuk@gmail.com
|
@@ -135,17 +163,20 @@ executables: []
|
|
135
163
|
extensions: []
|
136
164
|
extra_rdoc_files: []
|
137
165
|
files:
|
166
|
+
- ".byebug_history"
|
138
167
|
- ".gitignore"
|
139
168
|
- ".ruby-gemset"
|
140
169
|
- ".ruby-version"
|
141
170
|
- ".travis.yml"
|
142
171
|
- CHANGELOG.md
|
172
|
+
- Dockerfile
|
143
173
|
- Gemfile
|
144
174
|
- LICENSE.txt
|
145
175
|
- README.md
|
146
176
|
- Rakefile
|
147
177
|
- bin/console
|
148
178
|
- bin/setup
|
179
|
+
- docker-compose.yml
|
149
180
|
- err_now.png
|
150
181
|
- err_was.png
|
151
182
|
- lib/benchmark/cat.rb
|