rails_sql_prettifier 5.0.1 → 5.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: e054a55678b35786fd255abe2842a3b4b795e5ffbb5e0ea570888c05c6abaea6
4
- data.tar.gz: ba6cba10e835b079e364347eba883c63106164f20ebf7dfb7406270f657b1edd
3
+ metadata.gz: 9f8842037718631f257e8e3c15d07abcb6f745887704bc075e09848c6aeb549b
4
+ data.tar.gz: d84ac4beb2eee2af5f0f2def3c6d2634c9b1da0250333772070f1ca98683c549
5
5
  SHA512:
6
- metadata.gz: d01423c703f5425635c41f3bed89622b17e9860eb8322ded8de75c1bf348fd305382f0d7ae98b8d201f7494f6cac92fab959fe6475367bd782e4248889875135
7
- data.tar.gz: 51695da6649ff7907d152f6a0a3105536def401640b4d2f076a0da8758a5bdccc6aa01fd1395c44777b1eef73a860eeae53d93bb32ffa54dd58e12f63e1443b3
6
+ metadata.gz: 1e88b6463876d5faabd76b84436815dc8266860c2176d18878c2d1b17dec4f096937ca686225be75373fd6d975ade38a60059dce7825c9ddd0f072bb8ce876a4
7
+ data.tar.gz: 5efaae946cd2e6859640cbf400400b2ba209085decaa82b60634eb3be622e99dadff2c4b4fbe0a914caf5b90f259158cde0102df9a92f082c84d0368caf1b602
data/.gitignore CHANGED
@@ -8,4 +8,5 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  /inspectionProfiles/
11
- .idea
11
+ .idea
12
+ .byebug_history
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 activer record prior to 6.0 version compatible niceql integration
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
- Niceql is a small, nice, simple and zero dependency solution for SQL prettifying for Ruby.
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
@@ -0,0 +1,10 @@
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
+
@@ -1,3 +1,3 @@
1
1
  module RailsSQLPrettifier
2
- VERSION = '5.0.1'
2
+ VERSION = '5.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
+
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 ARNiceQLConfig
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
- module ClassMethods
69
- def configure
70
- super
69
+ module NiceqlExt
70
+ def configure
71
+ super
71
72
 
72
- ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include(PostgresAdapterNiceQL) if config.pg_adapter_with_nicesql
73
+ if config.pg_adapter_with_nicesql && defined?( ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter )
74
+ ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.include( PostgresAdapterNiceQL)
75
+ end
73
76
 
74
- ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend( AbstractAdapterLogPrettifier ) if config.prettify_active_record_log_output
77
+ ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend( AbstractAdapterLogPrettifier ) if config.prettify_active_record_log_output
75
78
 
76
- ::ActiveRecord::StatementInvalid.include( Niceql::ErrorExt ) if config.prettify_pg_errors && config.ar_using_pg_adapter?
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( ARNiceQLConfig )
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", '>= 0.5.1'
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 "benchmark-ips"
45
- spec.add_development_dependency 'sqlite3'
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.1
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.1
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.1
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: '0'
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: '0'
110
+ version: '3.9'
111
111
  - !ruby/object:Gem::Dependency
112
- name: benchmark-ips
112
+ name: sqlite3
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
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: '0'
124
+ version: '1'
125
125
  - !ruby/object:Gem::Dependency
126
- name: sqlite3
126
+ name: pg
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
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.1.4
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.