rails_sql_prettifier 6.0.2 → 6.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Dockerfile +20 -0
- data/README.md +7 -2
- data/docker-compose.yml +10 -0
- data/lib/rails_sql_prettifier/version.rb +1 -1
- data/lib/rails_sql_prettifier.rb +15 -10
- data/rails_sql_prettifier.gemspec +3 -0
- metadata +31 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1ee709955e95f1203d8f1e64feb5e51309123c92f7eeeee50fa44d9688511c3
|
4
|
+
data.tar.gz: b44477d11671c84097e66e2b69393a458f9a57cd2ab0c6aa4507e23105af3f80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84862ea11984c33d2c198a6c7a0ec340a4f90d35463abe971280580e1f3f4d97db47486c838c13e854898c8c01c4d511fd2f74f5ab57068667159f2218d1cda8
|
7
|
+
data.tar.gz: 9e72db1724def7dc7fec82a5198281badc9b81fba4bcc01f3a51dfae23fd4ef1700f2369db7312fb97497c1c1caa2dbee0cb4b526466feb5a8887802b33f0f8f
|
data/CHANGELOG.md
CHANGED
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,9 @@
|
|
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 is an extraction from niceql version 0.4.x. Its separated by different ActiveRecord versions, previous it had some version logic branching e.t.c.
|
6
|
+
but that is hard to maintain and test, and also breaking the idea of niceql to be dependentless solution, so now niceql is a completely railsfree solution yeay!
|
5
7
|
|
6
8
|
Any reasonable suggestions are welcome.
|
7
9
|
|
@@ -23,6 +25,9 @@ after:
|
|
23
25
|
|
24
26
|
## Installation
|
25
27
|
|
28
|
+
rails_sql_prettifier, has several version compatible with different active_record versions, so pay attention to the right versioning
|
29
|
+
if whenever you specify versions manually.
|
30
|
+
|
26
31
|
Add this line to your application's Gemfile:
|
27
32
|
|
28
33
|
```ruby
|
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
|
@@ -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
|
@@ -42,4 +42,7 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency "differ", '~> 0.1'
|
43
43
|
spec.add_development_dependency "pry-byebug", '~> 3.9'
|
44
44
|
spec.add_development_dependency 'sqlite3', '~> 1'
|
45
|
+
spec.add_development_dependency 'pg', '~> 1'
|
46
|
+
|
47
|
+
spec.add_development_dependency 'stubberry', '~> 0.1'
|
45
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_sql_prettifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.
|
4
|
+
version: 6.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alekseyl
|
@@ -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
|
@@ -140,12 +168,14 @@ files:
|
|
140
168
|
- ".ruby-version"
|
141
169
|
- ".travis.yml"
|
142
170
|
- CHANGELOG.md
|
171
|
+
- Dockerfile
|
143
172
|
- Gemfile
|
144
173
|
- LICENSE.txt
|
145
174
|
- README.md
|
146
175
|
- Rakefile
|
147
176
|
- bin/console
|
148
177
|
- bin/setup
|
178
|
+
- docker-compose.yml
|
149
179
|
- err_now.png
|
150
180
|
- err_was.png
|
151
181
|
- lib/benchmark/cat.rb
|