better_batch 1.0.1 → 1.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/.ruby-version +1 -0
- data/CHANGELOG.md +11 -5
- data/Rakefile +79 -0
- data/lib/better_batch/inputs.rb +25 -13
- data/lib/better_batch/query.rb +1 -0
- data/lib/better_batch/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b208e3117c167c67e291224859745f7fa44d7f777b81b07e4f0f4e4537295b57
|
4
|
+
data.tar.gz: e8e6690424e9e9d9db8d613a201bd1551938e5f7502fb304c7dcfbe3ea2de482
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7787219a815f6e26796f0563b1a36b7877e08f866d72f423823bbf0f08a96ebb6d32c071547dccc4523988473f46661019d7c9171e475f5e37e19089396a4eb2
|
7
|
+
data.tar.gz: 1ae506ba8b32252090a802af2fd6e463e0753f3f8e5c34f0a8f77cd7d3744e0a0cf4f68785c9f92408c9ba109d8a8f9b2882ba55be25cfa60a21dd62c3285d9a
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.4.2
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
-
## [
|
1
|
+
## [1.0.3] - 2025-04-15
|
2
2
|
|
3
|
-
|
3
|
+
- Improve handling of inputs
|
4
4
|
|
5
|
-
-
|
5
|
+
## [1.0.2] - 2025-04-15
|
6
|
+
|
7
|
+
- Test version to excercise deployment updates
|
8
|
+
|
9
|
+
## [1.0.1] - 2025-04-15
|
10
|
+
|
11
|
+
- Fix dependency definition
|
6
12
|
|
7
13
|
## [1.0.0] - 2025-04-15
|
8
14
|
|
9
15
|
- Initial feature set
|
10
16
|
|
11
|
-
## [1.0
|
17
|
+
## [0.1.0] - 2025-04-04
|
12
18
|
|
13
|
-
-
|
19
|
+
- Initial release
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'English'
|
3
4
|
require 'bundler/gem_tasks'
|
4
5
|
require 'rspec/core/rake_task'
|
5
6
|
|
@@ -10,3 +11,81 @@ require 'rubocop/rake_task'
|
|
10
11
|
RuboCop::RakeTask.new
|
11
12
|
|
12
13
|
task default: %i[spec rubocop]
|
14
|
+
|
15
|
+
module Tasks
|
16
|
+
BUILD_FILENAME = 'better_batch.gem'
|
17
|
+
|
18
|
+
class << self
|
19
|
+
include Rake::DSL
|
20
|
+
|
21
|
+
def install
|
22
|
+
install_release_if
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def install_release_if # rubocop:disable Metrics/MethodLength
|
28
|
+
namespace :release do
|
29
|
+
desc 'release if current version is later than last published version'
|
30
|
+
task if: :default do
|
31
|
+
assert_correct_branch!
|
32
|
+
if current_version > published_version
|
33
|
+
assert_ci!
|
34
|
+
# from bundler, asserts working directory is clean
|
35
|
+
Rake::Task['release'].invoke
|
36
|
+
end
|
37
|
+
assert_version_sane!
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def published_version
|
43
|
+
@published_version ||= build_published_version
|
44
|
+
end
|
45
|
+
|
46
|
+
def build_published_version
|
47
|
+
raw = shr('gem search --remote --exact better_batch')
|
48
|
+
Gem::Version.new(raw.split('(').last.sub(')', ''))
|
49
|
+
end
|
50
|
+
|
51
|
+
def current_version
|
52
|
+
@current_version ||= Gem::Version.new(BetterBatch::VERSION)
|
53
|
+
end
|
54
|
+
|
55
|
+
def assert_version_sane!
|
56
|
+
return unless current_version < published_version
|
57
|
+
|
58
|
+
raise "BetterBatch::VERSION (#{current_version}) " \
|
59
|
+
"is less than the current published (#{published_version}). " \
|
60
|
+
'Was it edited incorrectly?'
|
61
|
+
end
|
62
|
+
|
63
|
+
def current_branch
|
64
|
+
@current_branch ||= shr('git rev-parse --abbrev-ref HEAD').chomp
|
65
|
+
end
|
66
|
+
|
67
|
+
def default_branch
|
68
|
+
@default_branch ||= shr('git remote show origin').match(/HEAD branch: (\S+)$/)[1]
|
69
|
+
end
|
70
|
+
|
71
|
+
def assert_correct_branch!
|
72
|
+
return unless current_branch != default_branch
|
73
|
+
|
74
|
+
raise "On branch (#{current_branch}) instead of default #{default_branch}."
|
75
|
+
end
|
76
|
+
|
77
|
+
def assert_ci!
|
78
|
+
raise 'Not in CI.' unless ENV['CI'] == 'true'
|
79
|
+
end
|
80
|
+
|
81
|
+
def shr(cmd)
|
82
|
+
puts cmd
|
83
|
+
result = `#{cmd}`
|
84
|
+
raise cmd unless $CHILD_STATUS == 0
|
85
|
+
|
86
|
+
result
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
Tasks.install
|
data/lib/better_batch/inputs.rb
CHANGED
@@ -15,27 +15,39 @@ module BetterBatch
|
|
15
15
|
|
16
16
|
# this strange (to me) setup avoids method redefinition warnings
|
17
17
|
module InstanceOverrides
|
18
|
-
def
|
18
|
+
def preprocess!
|
19
|
+
self[:column_types].transform_keys!(&:to_sym)
|
20
|
+
preprocess_returning
|
21
|
+
ensure_lists!
|
22
|
+
symbolize_lists!
|
23
|
+
symbolize!
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def preprocess_returning
|
19
29
|
case self[:returning]
|
20
|
-
when nil
|
21
|
-
[]
|
22
30
|
when '*', ['*']
|
23
|
-
column_types.keys
|
24
|
-
else
|
25
|
-
self[:returning]
|
31
|
+
self[:returning] = column_types.keys
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
def ensure_lists!
|
36
|
+
%i[input_columns unique_columns now_on_insert now_on_update returning].each do |field|
|
37
|
+
self[field] = Array(self[field])
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
|
-
def
|
36
|
-
|
41
|
+
def symbolize_lists!
|
42
|
+
%i[input_columns unique_columns now_on_insert now_on_update returning].each do |field|
|
43
|
+
self[field].map!(&:to_sym)
|
44
|
+
end
|
45
|
+
end
|
37
46
|
|
38
|
-
|
47
|
+
def symbolize!
|
48
|
+
%i[table_name primary_key].each do |field|
|
49
|
+
self[field] = self[field].to_sym
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|
41
53
|
|
data/lib/better_batch/query.rb
CHANGED
data/lib/better_batch/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Hartland
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: anbt-sql-formatter
|
@@ -31,6 +31,7 @@ extra_rdoc_files: []
|
|
31
31
|
files:
|
32
32
|
- ".rspec"
|
33
33
|
- ".rubocop.yml"
|
34
|
+
- ".ruby-version"
|
34
35
|
- CHANGELOG.md
|
35
36
|
- CODE_OF_CONDUCT.md
|
36
37
|
- LICENSE.txt
|