rails_sql_prettifier 6.1.1 → 6.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 459c1f20e82eb14b0130418cb1161272383ae9f9f902164100b2a4d81bbabb9c
4
- data.tar.gz: db5ee936e31bd470ac74940b2fa086e4a1aec84004cb05971c6434e8f5cb2ea1
3
+ metadata.gz: 1f24b775719e8b291b04f98e5250f142cf2eea713bd52bb70a61e507482973ff
4
+ data.tar.gz: d00ab131a78b10c28cdcd5c9a569f04825076b9c2073f0388e2b27a21016332a
5
5
  SHA512:
6
- metadata.gz: a159e5b627abaa4ac80c70092668aad54f11f871c13a57e83585e38851d2f522273653d79871b2b087d1bce83de00c9119b6b2d7c28b60d7b75c8b13b1e3dde1
7
- data.tar.gz: 4feabc414ccf282a7462c44527514449735b8bcdf9b2b84afe3b873735176cecbe1dcc40dfa6745b67af114391a1a38808cc3658bae4e45e8b242267932e32ce
6
+ metadata.gz: 43aae20d26a1a826b1811eb48a665e6c7e2031e694dd7a15172d4f422264a4ea668d17e9406fbce2cd2935e291010ff4894ce7e1f92d67461a6c0be106aa3df7
7
+ data.tar.gz: 3866f5f935657553421215fe5a1bfde3f70c2b96ed40041850245d0124aa469bdb613aa13b856923667e55963aff5579d795ebe3b07b55f5b3ceeadd30e9e621
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,8 +1,8 @@
1
1
  # 6.1.0
2
2
 
3
3
  * This a active record prior to 7.0 version and >= 6.1 compatible niceql integration
4
- ar < 6.0:
5
- * StatementInvalid initialization, starting version 6 it has named param sql: for original query )
4
+ ar < 6.0 breaking change:
5
+ * StatementInvalid initialization ahs a breaking change: starting version 6 it has named param sql: for original query )
6
6
 
7
7
  ar <= 6.1:
8
- * Starting from 6.1 connection_db_config used as standalone object instead of connection_config
8
+ * Starting from 6.1 connection_db_config method replaced connection_config which was a hash
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 = '6.1.1'
2
+ VERSION = '6.1.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
@@ -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.1.1
4
+ version: 6.1.2
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
@@ -141,12 +169,14 @@ files:
141
169
  - ".ruby-version"
142
170
  - ".travis.yml"
143
171
  - CHANGELOG.md
172
+ - Dockerfile
144
173
  - Gemfile
145
174
  - LICENSE.txt
146
175
  - README.md
147
176
  - Rakefile
148
177
  - bin/console
149
178
  - bin/setup
179
+ - docker-compose.yml
150
180
  - err_now.png
151
181
  - err_was.png
152
182
  - lib/benchmark/cat.rb