rails_sql_prettifier 5.0.3 → 6.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf8c24bd9ffa08aa300b4c6540027a1e6a2c288dc4661c93834748d445711e42
4
- data.tar.gz: ef7945e5d80df9daff0603f3b87f8ed7c209d35b971d0b1817bf94fa409cde21
3
+ metadata.gz: dc8698d2cb6da1287057ee6d57f4fa1d494efa19bcc013157012d0a055176243
4
+ data.tar.gz: 6e41b147fd207cc2ad6afcd48508b1ebb0e6cf183d5d3829b61fffff71e1ed30
5
5
  SHA512:
6
- metadata.gz: 3f2790f713dd38d823a78f947a4fa4234a8c4a8e7ad5e799804d7eb9b43d5ecfbd7b82bcefcbb5fc69fd12512d1a686b50056be9a226413d7e90590005f0bf80
7
- data.tar.gz: 817035ebee03c657e04a83b5817ec87a6cb36c19d91d9498b30d31236342a10a88af6d9b760673eed4d2655b36ef20a419e0c00c78c32880423d74b09208546d
6
+ metadata.gz: 4b2da81bae482d9269ae444ceb7c58b73c0d769755b45d2455656169c117bfe22a18ec0288989689479c385afa5c86f00ae826f3c477d5b987e04e3da97acdcf
7
+ data.tar.gz: 6030b09100f99471a4874b4f30ccea42184a76eda6f6a7d8a1cb89233498f2b403766ef14981fdfaef15cca1413cdbeb9e5f17fb31e91e07729d779dd609a470
data/.ruby-gemset CHANGED
@@ -1 +1 @@
1
- rails_sql_prettifier_ar_5
1
+ rails_sql_prettifier_ar_6_0
data/CHANGELOG.md CHANGED
@@ -1,10 +1,6 @@
1
- # 5.0.3
2
- * active record versioning is properly aligned now
1
+ # 6.0.2
3
2
 
4
- # 5.0.2
5
- * Fixed issue with Niceql.configure not configuring anything + test covered
6
-
7
- # 5.0.0
8
-
9
- * This a active record prior to 6.0 version compatible niceql integration
10
- ( main difference is StatementInvalid initialization, starting version 6 it has named param sql: for original query )
3
+ * This a active record prior to 7.0 version and >= 6.1 compatible niceql integration
4
+ ar < 6.0 breaking change:
5
+ * StatementInvalid initialization has a breaking change: starting version 6 it has named param sql: for original query )
6
+
data/README.md CHANGED
@@ -1,12 +1,7 @@
1
1
  # RailsSQLPrettifier
2
2
 
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 )
3
+ This is an ActiveRecord integration for a niceql gem.
4
+ Niceql is a small, nice, simple and zero dependency solution for SQL prettifying for Ruby.
10
5
 
11
6
  Any reasonable suggestions are welcome.
12
7
 
@@ -28,13 +23,10 @@ after:
28
23
 
29
24
  ## Installation
30
25
 
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
-
34
26
  Add this line to your application's Gemfile:
35
27
 
36
28
  ```ruby
37
- gem 'rails_sql_prettifier', '~> X.X.X'
29
+ gem 'rails_sql_prettifier'
38
30
  ```
39
31
 
40
32
  And then execute:
@@ -1,3 +1,3 @@
1
1
  module RailsSQLPrettifier
2
- VERSION = '5.0.3'
2
+ VERSION = '6.0.2'
3
3
  end
@@ -2,8 +2,8 @@ require "rails_sql_prettifier/version"
2
2
  require 'active_record'
3
3
  require "niceql"
4
4
 
5
-
6
5
  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 NiceQLConfigExt
47
+ module ARNiceQLConfig
48
48
  extend ActiveSupport::Concern
49
49
 
50
50
  included do
@@ -64,19 +64,17 @@ 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
68
67
 
69
- module NiceqlExt
70
- def configure
71
- super
68
+ module ClassMethods
69
+ def configure
70
+ super
72
71
 
73
- if config.pg_adapter_with_nicesql && defined?( ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter )
74
- ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include( PostgresAdapterNiceQL)
75
- end
72
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(PostgresAdapterNiceQL) if config.pg_adapter_with_nicesql
76
73
 
77
- ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend( AbstractAdapterLogPrettifier ) if config.prettify_active_record_log_output
74
+ ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend( AbstractAdapterLogPrettifier ) if config.prettify_active_record_log_output
78
75
 
79
- ::ActiveRecord::StatementInvalid.include( RailsSQLPrettifier::ErrorExt ) if config.prettify_pg_errors && config.ar_using_pg_adapter?
76
+ ::ActiveRecord::StatementInvalid.include( Niceql::ErrorExt ) if config.prettify_pg_errors && config.ar_using_pg_adapter?
77
+ end
80
78
  end
81
79
  end
82
80
 
@@ -84,8 +82,5 @@ module RailsSQLPrettifier
84
82
  ::Arel::TreeManager,
85
83
  ::Arel::Nodes::Node].each { |klass| klass.send(:include, ArExtentions) }
86
84
 
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 )
85
+ NiceQLConfig.include( ARNiceQLConfig )
91
86
  end
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.required_ruby_version = '>= 2.4'
34
34
  spec.add_dependency "niceql", '~> 0.5'
35
35
 
36
- spec.add_dependency "activerecord", "< 6.0"
36
+ spec.add_development_dependency "activerecord", '>= 6.0', '< 6.1'
37
37
 
38
38
  spec.add_development_dependency "bundler", ">= 1"
39
39
  spec.add_development_dependency "rake", ">= 12.3.3"
@@ -42,7 +42,4 @@ 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'
48
45
  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: 5.0.3
4
+ version: 6.0.2
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-09 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: niceql
@@ -28,16 +28,22 @@ dependencies:
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "<"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '6.0'
34
- type: :runtime
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '6.1'
37
+ type: :development
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "<"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: '6.0'
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '6.1'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: bundler
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -122,34 +128,6 @@ dependencies:
122
128
  - - "~>"
123
129
  - !ruby/object:Gem::Version
124
130
  version: '1'
125
- - !ruby/object:Gem::Dependency
126
- name: pg
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '1'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
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
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '0.1'
153
131
  description: 'This is an ActiveRecord integration for the SQL prettifier gem niceql. '
154
132
  email:
155
133
  - leshchuk@gmail.com
@@ -157,20 +135,17 @@ executables: []
157
135
  extensions: []
158
136
  extra_rdoc_files: []
159
137
  files:
160
- - ".byebug_history"
161
138
  - ".gitignore"
162
139
  - ".ruby-gemset"
163
140
  - ".ruby-version"
164
141
  - ".travis.yml"
165
142
  - CHANGELOG.md
166
- - Dockerfile
167
143
  - Gemfile
168
144
  - LICENSE.txt
169
145
  - README.md
170
146
  - Rakefile
171
147
  - bin/console
172
148
  - bin/setup
173
- - docker-compose.yml
174
149
  - err_now.png
175
150
  - err_was.png
176
151
  - lib/benchmark/cat.rb
data/.byebug_history DELETED
@@ -1,40 +0,0 @@
1
- exit
2
- ActiveRecord::Base.connection_config[:adapter]
3
- ActiveRecord::Base.connection_config.adapter
4
- ActiveRecord::Base.connection_config
5
- c
6
- ActiveRecord.version <= Gem::Version.new(5)
7
- c
8
- ActiveRecord.version
9
- exit
10
- ActiveRecord.version
11
- c
12
- exit
13
- si.sql
14
- si
15
- c
16
- sql_body
17
- n
18
- s
19
- original_sql_query
20
- err
21
- s
22
- up
23
- s
24
- up
25
- s
26
- up
27
- s
28
- super
29
- try(:sql)
30
- Niceql.config.prettify_pg_errors
31
- c
32
- exit
33
- err_template
34
- si.to_s
35
- exit
36
- err_caret_line
37
- err_quote_caret_offset
38
- c
39
- err.lines[1].index( '...' ).to_i
40
- err_caret_line
data/Dockerfile DELETED
@@ -1,20 +0,0 @@
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/docker-compose.yml DELETED
@@ -1,10 +0,0 @@
1
- version: "3.7"
2
-
3
- services:
4
- test:
5
- build: .
6
- image: niceql
7
- command: service postgresql start && rake test
8
- volumes:
9
- - '.:/app'
10
-