rails_sql_prettifier 5.0.1 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- 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 +7 -5
- metadata +40 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8842037718631f257e8e3c15d07abcb6f745887704bc075e09848c6aeb549b
|
4
|
+
data.tar.gz: d84ac4beb2eee2af5f0f2def3c6d2634c9b1da0250333772070f1ca98683c549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e88b6463876d5faabd76b84436815dc8266860c2176d18878c2d1b17dec4f096937ca686225be75373fd6d975ade38a60059dce7825c9ddd0f072bb8ce876a4
|
7
|
+
data.tar.gz: 5efaae946cd2e6859640cbf400400b2ba209085decaa82b60634eb3be622e99dadff2c4b4fbe0a914caf5b90f259158cde0102df9a92f082c84d0368caf1b602
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# 5.0.1
|
2
|
+
* Fixed issue with Niceql.configure not configuring anything + test covered
|
3
|
+
|
1
4
|
# 5.0.0
|
2
5
|
|
3
|
-
* This a
|
6
|
+
* This a active record prior to 6.0 version compatible niceql integration
|
4
7
|
( main difference is StatementInvalid initialization, starting version 6 it has named param sql: for original query )
|
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
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.require_paths = ["lib"]
|
32
32
|
|
33
33
|
spec.required_ruby_version = '>= 2.4'
|
34
|
-
spec.add_dependency "niceql", '
|
34
|
+
spec.add_dependency "niceql", '~> 0.5'
|
35
35
|
|
36
36
|
spec.add_development_dependency "activerecord", "< 6.0"
|
37
37
|
|
@@ -39,8 +39,10 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
40
40
|
spec.add_development_dependency "minitest", "~> 5.0"
|
41
41
|
|
42
|
-
spec.add_development_dependency "differ"
|
43
|
-
spec.add_development_dependency "pry-byebug"
|
44
|
-
spec.add_development_dependency
|
45
|
-
spec.add_development_dependency '
|
42
|
+
spec.add_development_dependency "differ", '~> 0.1'
|
43
|
+
spec.add_development_dependency "pry-byebug", '~> 3.9'
|
44
|
+
spec.add_development_dependency 'sqlite3', '~> 1'
|
45
|
+
spec.add_development_dependency 'pg', '~> 1'
|
46
|
+
|
47
|
+
spec.add_development_dependency 'stubberry', '~> 0.1'
|
46
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: 5.0.
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alekseyl
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: niceql
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.5
|
19
|
+
version: '0.5'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.5
|
26
|
+
version: '0.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,58 +84,72 @@ dependencies:
|
|
84
84
|
name: differ
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
89
|
+
version: '0.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry-byebug
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.9'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.9'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: sqlite3
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '1'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '1'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: pg
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '1'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: stubberry
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.1'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
152
|
+
version: '0.1'
|
139
153
|
description: 'This is an ActiveRecord integration for the SQL prettifier gem niceql. '
|
140
154
|
email:
|
141
155
|
- leshchuk@gmail.com
|
@@ -149,12 +163,14 @@ files:
|
|
149
163
|
- ".ruby-version"
|
150
164
|
- ".travis.yml"
|
151
165
|
- CHANGELOG.md
|
166
|
+
- Dockerfile
|
152
167
|
- Gemfile
|
153
168
|
- LICENSE.txt
|
154
169
|
- README.md
|
155
170
|
- Rakefile
|
156
171
|
- bin/console
|
157
172
|
- bin/setup
|
173
|
+
- docker-compose.yml
|
158
174
|
- err_now.png
|
159
175
|
- err_was.png
|
160
176
|
- lib/benchmark/cat.rb
|
@@ -186,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
202
|
- !ruby/object:Gem::Version
|
187
203
|
version: '0'
|
188
204
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.2.15
|
190
206
|
signing_key:
|
191
207
|
specification_version: 4
|
192
208
|
summary: This is an ActiveRecord integration for the SQL prettifier gem niceql.
|