rails_sql_prettifier 7.0.2 → 7.0.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/CHANGELOG.md +4 -1
- data/Dockerfile_30 +20 -0
- data/README.md +5 -4
- data/docker-compose.yml +9 -1
- data/lib/rails_sql_prettifier/version.rb +1 -1
- data/lib/rails_sql_prettifier.rb +4 -3
- data/rails_sql_prettifier.gemspec +2 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e25116da08165fe68232d88629379f8e8cb48c503ad73926119d1906ee0a45d6
|
4
|
+
data.tar.gz: 3efe5e251b908df04d3e551c2a7318405cbd9392d818652db85cd73165fa4a9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78ea21d51cd7cad7b59599979a9529f7ca4173709b758b3ab4eecf2aea49e53644d7399ee303ef42d0789454a88abec6a422b9ec6b6108bc1251e15fb6216d18
|
7
|
+
data.tar.gz: 1958bdd7757d0d51d4b54e3d8eef556c4b42f7a18ac914677c7f8130c76c86a40627c8c251bbdbe9a6394c1f224b4aa53401d9968410fec49c89098354887153
|
data/CHANGELOG.md
CHANGED
data/Dockerfile_30
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
FROM ruby:3.0.3-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
@@ -6,7 +6,7 @@ This gem started as a code extraction from niceql version 0.4.x.
|
|
6
6
|
|
7
7
|
It has versioning aligned to the ActiveRecord versions, niceql prior to 0.5 version had hardcoded logic branches based on ActiveRecord versioning.
|
8
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
|
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 implementations in the error prettifying methods. It will be completely decoupled in the future )
|
10
10
|
|
11
11
|
Any reasonable suggestions are welcome.
|
12
12
|
|
@@ -94,8 +94,6 @@ end
|
|
94
94
|
|
95
95
|
## Usage
|
96
96
|
|
97
|
-
### With ActiveRecord
|
98
|
-
|
99
97
|
```ruby
|
100
98
|
# puts colorized and formatted corresponding SQL query
|
101
99
|
Model.scope.niceql
|
@@ -157,7 +155,10 @@ end
|
|
157
155
|
If your console support more colors or different schemes, or if you prefer different colorization, then you can override ColorizeString methods.
|
158
156
|
Current colors were selected with dark and white console themes in mind, so a niceql colorization works good for dark, and good enough for white.
|
159
157
|
|
160
|
-
##
|
158
|
+
## Testing
|
159
|
+
```bash
|
160
|
+
docker-compose up
|
161
|
+
```
|
161
162
|
|
162
163
|
## Contributing
|
163
164
|
|
data/docker-compose.yml
CHANGED
@@ -4,7 +4,15 @@ services:
|
|
4
4
|
test:
|
5
5
|
build: .
|
6
6
|
image: niceql
|
7
|
-
command: service postgresql start && rake test
|
7
|
+
command: /bin/bash -c 'service postgresql start && rake test'
|
8
8
|
volumes:
|
9
9
|
- '.:/app'
|
10
10
|
|
11
|
+
test_3_0:
|
12
|
+
build:
|
13
|
+
context: .
|
14
|
+
dockerfile: Dockerfile_30
|
15
|
+
image: niceql_3_0
|
16
|
+
command: /bin/bash -c 'service postgresql start && rake test'
|
17
|
+
volumes:
|
18
|
+
- '.:/app'
|
data/lib/rails_sql_prettifier.rb
CHANGED
@@ -28,11 +28,13 @@ module RailsSQLPrettifier
|
|
28
28
|
end
|
29
29
|
|
30
30
|
module AbstractAdapterLogPrettifier
|
31
|
-
|
31
|
+
private
|
32
|
+
def log( sql, *args, **kwargs, &block )
|
32
33
|
# \n need to be placed because AR log will start with action description + time info.
|
33
34
|
# rescue sql - just to be sure Prettifier wouldn't break production
|
34
35
|
formatted_sql = "\n" + Niceql::Prettifier.prettify_sql(sql) rescue sql
|
35
|
-
|
36
|
+
|
37
|
+
super( formatted_sql, *args, **kwargs, &block )
|
36
38
|
end
|
37
39
|
end
|
38
40
|
|
@@ -53,7 +55,6 @@ module RailsSQLPrettifier
|
|
53
55
|
:prettify_pg_errors
|
54
56
|
end
|
55
57
|
|
56
|
-
|
57
58
|
def ar_using_pg_adapter?
|
58
59
|
ActiveRecord::Base.connection_db_config.adapter == 'postgresql'
|
59
60
|
end
|
@@ -38,10 +38,11 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
39
39
|
spec.add_development_dependency "minitest", "~> 5.0"
|
40
40
|
|
41
|
+
spec.add_development_dependency "awesome_print"
|
41
42
|
spec.add_development_dependency "differ", '~> 0.1'
|
42
43
|
spec.add_development_dependency "pry-byebug", '~> 3.9'
|
43
44
|
spec.add_development_dependency 'sqlite3', '~> 1'
|
44
45
|
spec.add_development_dependency 'pg', '~> 1'
|
45
46
|
|
46
|
-
spec.add_development_dependency 'stubberry', '~> 0.
|
47
|
+
spec.add_development_dependency 'stubberry', '~> 0.2'
|
47
48
|
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: 7.0.
|
4
|
+
version: 7.0.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: niceql
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: awesome_print
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: differ
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +156,14 @@ dependencies:
|
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0.
|
159
|
+
version: '0.2'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
166
|
+
version: '0.2'
|
153
167
|
description: 'This is an ActiveRecord integration for the SQL prettifier gem niceql. '
|
154
168
|
email:
|
155
169
|
- leshchuk@gmail.com
|
@@ -163,6 +177,7 @@ files:
|
|
163
177
|
- ".travis.yml"
|
164
178
|
- CHANGELOG.md
|
165
179
|
- Dockerfile
|
180
|
+
- Dockerfile_30
|
166
181
|
- Gemfile
|
167
182
|
- LICENSE.txt
|
168
183
|
- README.md
|