niceql 0.6.1 → 0.6.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 +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +1 -5
- data/lib/niceql/version.rb +1 -1
- data/lib/niceql.rb +8 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f62d4429294ec7ef47e564052b2f5707db818fbb38509bcfc77fdcdc4bb0351f
|
4
|
+
data.tar.gz: bfd07f10dc1b7bd99ce81e727eb3afb23bf34dc00fdf2ccf2fcfa9257cb26727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4985d9e128475c93ac6dced329409fc2c6c544de35e6216e723f7d3fbc5baf94584e375d5991fb707f219b57e6129f78d410be24866b1f8e91b79ba5d5f65df7
|
7
|
+
data.tar.gz: 7bd016c10244cb5cbb6197e6add3973c47471c7b59f539d0285ca6c5bff04e351df1fbf2c8f77ea2aff4854adca5ec47d6dd1c0666eaec15caf38a854b411a17
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 0.6.2
|
2
|
+
* github CI added 3.2, 3.3, 3.4 to matrix
|
3
|
+
* fixed: https://github.com/alekseyl/niceql/issues/25
|
4
|
+
|
1
5
|
# 0.6.1
|
2
6
|
* github CI added ( PR: https://github.com/alekseyl/niceql/pull/22 many thnx to @petergoldstein )
|
3
7
|
* issue fixed https://github.com/alekseyl/niceql/issues/23
|
data/README.md
CHANGED
@@ -5,11 +5,7 @@
|
|
5
5
|
This is a small, nice, simple and zero dependency solution for SQL prettifying for Ruby.
|
6
6
|
It can be used in an irb console without any dependencies ( run bin/console and look for examples ).
|
7
7
|
|
8
|
-
Any reasonable suggestions are welcome.
|
9
|
-
|
10
|
-
**Please pay attention: even though issue https://github.com/alekseyl/niceql/issues/16 is resolved
|
11
|
-
still potentially UPDATE or INSERT request might corrupt your data, please don't patch pg_adapter on production!**
|
12
|
-
|
8
|
+
Any reasonable suggestions are welcome.
|
13
9
|
|
14
10
|
## Before/After
|
15
11
|
### SQL prettifier:
|
data/lib/niceql/version.rb
CHANGED
data/lib/niceql.rb
CHANGED
@@ -218,7 +218,7 @@ module Niceql
|
|
218
218
|
# but right now there is no difference between the
|
219
219
|
# newline_wrapped_comment, newline_start_comment, newline_end_comment, they all will be wrapped in newlines
|
220
220
|
COMMENT_AND_LITERAL_TYPES = [:immutable_string, :indentable_string, :inline_comment, :newline_wrapped_comment,
|
221
|
-
:newline_start_comment, :newline_end_comment
|
221
|
+
:newline_start_comment, :newline_end_comment]
|
222
222
|
|
223
223
|
attr_reader :parametrized_sql, :initial_sql, :string_regex, :literals_and_comments_types, :colorize
|
224
224
|
|
@@ -236,7 +236,11 @@ module Niceql
|
|
236
236
|
end
|
237
237
|
|
238
238
|
def prettified_sql
|
239
|
-
|
239
|
+
# sprintf or % interpolation will throw an error with standalone '%', but
|
240
|
+
# % is a legit operand: https://github.com/alekseyl/niceql/issues/25
|
241
|
+
# so it should be escaped via doubling, the easiest way is to do it twice,
|
242
|
+
# doubling every %, and then restoring single % for the combination of %%{
|
243
|
+
@parametrized_sql.gsub("%", "%%").gsub("%%{", "%{") % @guids_to_content.transform_keys(&:to_sym)
|
240
244
|
end
|
241
245
|
|
242
246
|
private
|
@@ -343,7 +347,8 @@ module Niceql
|
|
343
347
|
# when comment ending with newline followed by a keyword we should remove double newlines
|
344
348
|
def clear_extra_newline_after_comments
|
345
349
|
newlined_comments = @literals_and_comments_types.select { |k,| new_line_ending_comment?(k) }
|
346
|
-
return if newlined_comments.
|
350
|
+
return if newlined_comments.empty?
|
351
|
+
|
347
352
|
parametrized_sql.gsub!(/(#{newlined_comments.keys.join("}\n|")}}\n)/, &:chop)
|
348
353
|
end
|
349
354
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: niceql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alekseyl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
189
|
+
rubygems_version: 3.3.26
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: This is a simple and nice gem for SQL prettifying and formatting. Niceql
|