teak_util 0.1.2 → 0.3.0
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/.circleci/config.yml +131 -5
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +17 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +71 -54
- data/lib/teak_util/storage/make_externally_available_file.rb +2 -2
- data/lib/teak_util/storage/s3.rb +5 -0
- data/lib/teak_util/test_database_name.rb +96 -0
- data/lib/teak_util/version.rb +1 -1
- data/teak_util.gemspec +2 -2
- metadata +15 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5ed306a1c0d8b1bd16fad11431b1d0ed8506ff01fbb536c5db9e1562ec12c096
|
|
4
|
+
data.tar.gz: 83ee0167f13ab63f51588a63f2f60246bde93032ad6798f8a78b29c0c7872470
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b6d30e4e71b5a4b386ea1a6327df0ae877b4c1975d3976e912d37e05b5a4a23c0222a0c5a892c9feb6e6d189a049e6d12da228fe4a23cd9bc634a8c6e576d3e
|
|
7
|
+
data.tar.gz: 558b5223f4600b4e9405f545c8aea2de3c373c6cb4266546f8cd72beb6c44d238e4419df21b171c0caaae468e1b57758aaa2934db967a95c20d3b368deaf03a6
|
data/.circleci/config.yml
CHANGED
|
@@ -1,13 +1,139 @@
|
|
|
1
1
|
version: 2.1
|
|
2
|
+
|
|
3
|
+
references:
|
|
4
|
+
RUBY_IMAGE: &RUBY_IMAGE
|
|
5
|
+
cimg/ruby:3.3.9
|
|
6
|
+
CACHE_KEY: &BUNDLE_CACHE_KEY
|
|
7
|
+
v2-teak_util-bundle-{{ checksum "Gemfile.lock" }}
|
|
8
|
+
|
|
2
9
|
jobs:
|
|
10
|
+
refresh_ruby_deps:
|
|
11
|
+
docker:
|
|
12
|
+
- image: *RUBY_IMAGE
|
|
13
|
+
environment:
|
|
14
|
+
RACK_ENV: test
|
|
15
|
+
working_directory: ~/teak_util-build
|
|
16
|
+
steps:
|
|
17
|
+
- checkout
|
|
18
|
+
- restore_cache:
|
|
19
|
+
key: *BUNDLE_CACHE_KEY
|
|
20
|
+
- run: bundle config set --local path 'vendor/bundle'
|
|
21
|
+
- run: bundle install --jobs 3 --retry 3
|
|
22
|
+
- save_cache:
|
|
23
|
+
key: *BUNDLE_CACHE_KEY
|
|
24
|
+
paths:
|
|
25
|
+
- ~/teak_util-build/vendor/bundle
|
|
26
|
+
- ~/teak_util-build/.bundle
|
|
27
|
+
|
|
3
28
|
build:
|
|
4
29
|
docker:
|
|
5
|
-
- image:
|
|
30
|
+
- image: *RUBY_IMAGE
|
|
31
|
+
working_directory: ~/teak_util-build
|
|
32
|
+
steps:
|
|
33
|
+
- checkout
|
|
34
|
+
- restore_cache:
|
|
35
|
+
key: *BUNDLE_CACHE_KEY
|
|
36
|
+
|
|
37
|
+
- run:
|
|
38
|
+
name: Run the build task
|
|
39
|
+
command: |
|
|
40
|
+
bundle exec rake build
|
|
41
|
+
|
|
42
|
+
rspec:
|
|
43
|
+
docker:
|
|
44
|
+
- image: *RUBY_IMAGE
|
|
45
|
+
environment:
|
|
46
|
+
RACK_ENV: test
|
|
47
|
+
working_directory: ~/teak_util-build
|
|
6
48
|
steps:
|
|
7
49
|
- checkout
|
|
50
|
+
- restore_cache:
|
|
51
|
+
key: *BUNDLE_CACHE_KEY
|
|
52
|
+
|
|
53
|
+
- run: mkdir ~/rspec
|
|
8
54
|
- run:
|
|
9
|
-
name: Run the default task
|
|
10
55
|
command: |
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
56
|
+
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command="xargs bundle exec rspec --format progress --format RspecJunitFormatter -o ~/rspec/rspec.xml" --verbose --split-by=timings
|
|
57
|
+
- store_test_results:
|
|
58
|
+
path: ~/rspec
|
|
59
|
+
- store_artifacts:
|
|
60
|
+
path: ~/rspec/rspec.xml
|
|
61
|
+
- run: mv ./coverage /tmp/coverage_${CIRCLE_NODE_INDEX}
|
|
62
|
+
- persist_to_workspace:
|
|
63
|
+
root: /tmp
|
|
64
|
+
paths:
|
|
65
|
+
- "coverage_*"
|
|
66
|
+
|
|
67
|
+
# report_coverage:
|
|
68
|
+
# docker:
|
|
69
|
+
# - image: *RUBY_IMAGE
|
|
70
|
+
# environment:
|
|
71
|
+
# RAILS_ENV: development
|
|
72
|
+
# working_directory: ~/teak_util-build
|
|
73
|
+
# steps:
|
|
74
|
+
# - checkout
|
|
75
|
+
# - restore_cache:
|
|
76
|
+
# key: *BUNDLE_CACHE_KEY
|
|
77
|
+
# - attach_workspace:
|
|
78
|
+
# at: /tmp/coverage
|
|
79
|
+
# - run: bundle exec rake report:coverage
|
|
80
|
+
|
|
81
|
+
# lint_bundler_audit:
|
|
82
|
+
# docker:
|
|
83
|
+
# - image: *RUBY_IMAGE
|
|
84
|
+
# working_directory: ~/teak_util-build
|
|
85
|
+
# steps:
|
|
86
|
+
# - checkout
|
|
87
|
+
# - restore_cache:
|
|
88
|
+
# key: *BUNDLE_CACHE_KEY
|
|
89
|
+
# - run: bundle exec rake lint:bundler_audit
|
|
90
|
+
|
|
91
|
+
# lint_rubocop:
|
|
92
|
+
# docker:
|
|
93
|
+
# - image: *RUBY_IMAGE
|
|
94
|
+
# working_directory: ~/teak_util-build
|
|
95
|
+
# steps:
|
|
96
|
+
# - checkout
|
|
97
|
+
# - restore_cache:
|
|
98
|
+
# key: *BUNDLE_CACHE_KEY
|
|
99
|
+
# - run: bundle exec rake lint:rubocop
|
|
100
|
+
|
|
101
|
+
# report_rubocop:
|
|
102
|
+
# docker:
|
|
103
|
+
# - image: *RUBY_IMAGE
|
|
104
|
+
# environment:
|
|
105
|
+
# RAILS_ENV: development
|
|
106
|
+
# working_directory: ~/teak_util-build
|
|
107
|
+
# steps:
|
|
108
|
+
# - checkout
|
|
109
|
+
# - restore_cache:
|
|
110
|
+
# key: *BUNDLE_CACHE_KEY
|
|
111
|
+
# - run: bundle exec rake report:rubocop
|
|
112
|
+
|
|
113
|
+
workflows:
|
|
114
|
+
default:
|
|
115
|
+
jobs:
|
|
116
|
+
- refresh_ruby_deps
|
|
117
|
+
- rspec:
|
|
118
|
+
requires:
|
|
119
|
+
- refresh_ruby_deps
|
|
120
|
+
# - report_coverage:
|
|
121
|
+
# requires:
|
|
122
|
+
# - rspec
|
|
123
|
+
# context:
|
|
124
|
+
# - DataDog
|
|
125
|
+
# - lint_bundler_audit:
|
|
126
|
+
# requires:
|
|
127
|
+
# - refresh_ruby_deps
|
|
128
|
+
# - refresh_js_deps
|
|
129
|
+
# - lint_rubocop:
|
|
130
|
+
# requires:
|
|
131
|
+
# - refresh_ruby_deps
|
|
132
|
+
# - report_rubocop:
|
|
133
|
+
# requires:
|
|
134
|
+
# - refresh_ruby_deps
|
|
135
|
+
# context:
|
|
136
|
+
# - DataDog
|
|
137
|
+
- build:
|
|
138
|
+
requires:
|
|
139
|
+
- rspec
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
teak_util
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-3.3.9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## 0.3.0
|
|
2
|
+
|
|
3
|
+
ENHANCEMENTS:
|
|
4
|
+
|
|
5
|
+
* Added TestDatabaseName for deriving worktree-scoped test database names, and
|
|
6
|
+
purging databases left behind by worktrees that no longer exist.
|
|
7
|
+
|
|
8
|
+
## 0.2.0
|
|
9
|
+
|
|
10
|
+
* Jettison compatibility for Ruby 3.2 and below.
|
|
11
|
+
|
|
12
|
+
## 0.1.3
|
|
13
|
+
|
|
14
|
+
ENHANCEMENTS:
|
|
15
|
+
|
|
16
|
+
* Added Storage::S3#bucket_name to read back configured bucket name.
|
|
17
|
+
|
|
1
18
|
## 0.1.2
|
|
2
19
|
|
|
3
20
|
ENHANCEMENTS:
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,97 +1,114 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
teak_util (0.
|
|
4
|
+
teak_util (0.3.0)
|
|
5
5
|
aws-sdk-s3 (>= 1.102)
|
|
6
6
|
business_flow (>= 0.18.0)
|
|
7
7
|
mime-types (>= 3)
|
|
8
|
-
rubyzip (
|
|
8
|
+
rubyzip (>= 2.3, < 4.0)
|
|
9
9
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
activemodel (
|
|
14
|
-
activesupport (=
|
|
15
|
-
activesupport (
|
|
13
|
+
activemodel (8.0.3)
|
|
14
|
+
activesupport (= 8.0.3)
|
|
15
|
+
activesupport (8.0.3)
|
|
16
16
|
base64
|
|
17
|
+
benchmark (>= 0.3)
|
|
17
18
|
bigdecimal
|
|
18
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
19
20
|
connection_pool (>= 2.2.5)
|
|
20
21
|
drb
|
|
21
22
|
i18n (>= 1.6, < 2)
|
|
23
|
+
logger (>= 1.4.2)
|
|
22
24
|
minitest (>= 5.1)
|
|
23
|
-
|
|
24
|
-
tzinfo (~> 2.0)
|
|
25
|
-
|
|
26
|
-
aws-
|
|
27
|
-
aws-
|
|
25
|
+
securerandom (>= 0.3)
|
|
26
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
27
|
+
uri (>= 0.13.1)
|
|
28
|
+
aws-eventstream (1.4.0)
|
|
29
|
+
aws-partitions (1.1168.0)
|
|
30
|
+
aws-sdk-core (3.233.0)
|
|
28
31
|
aws-eventstream (~> 1, >= 1.3.0)
|
|
29
|
-
aws-partitions (~> 1, >= 1.
|
|
30
|
-
aws-sigv4 (~> 1.
|
|
32
|
+
aws-partitions (~> 1, >= 1.992.0)
|
|
33
|
+
aws-sigv4 (~> 1.9)
|
|
34
|
+
base64
|
|
35
|
+
bigdecimal
|
|
31
36
|
jmespath (~> 1, >= 1.6.1)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
aws-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
logger
|
|
38
|
+
aws-sdk-kms (1.113.0)
|
|
39
|
+
aws-sdk-core (~> 3, >= 3.231.0)
|
|
40
|
+
aws-sigv4 (~> 1.5)
|
|
41
|
+
aws-sdk-s3 (1.199.1)
|
|
42
|
+
aws-sdk-core (~> 3, >= 3.231.0)
|
|
37
43
|
aws-sdk-kms (~> 1)
|
|
38
|
-
aws-sigv4 (~> 1.
|
|
39
|
-
aws-sigv4 (1.
|
|
44
|
+
aws-sigv4 (~> 1.5)
|
|
45
|
+
aws-sigv4 (1.12.1)
|
|
40
46
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
41
|
-
base64 (0.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
i18n (1.14.
|
|
47
|
+
base64 (0.3.0)
|
|
48
|
+
benchmark (0.4.1)
|
|
49
|
+
bigdecimal (3.2.3)
|
|
50
|
+
business_flow (0.20.0)
|
|
51
|
+
activemodel (>= 4.2, < 8.1)
|
|
52
|
+
activesupport (>= 4.2, < 8.1)
|
|
53
|
+
concurrent-ruby (1.3.5)
|
|
54
|
+
connection_pool (2.5.4)
|
|
55
|
+
diff-lcs (1.6.2)
|
|
56
|
+
docile (1.4.1)
|
|
57
|
+
drb (2.2.3)
|
|
58
|
+
i18n (1.14.7)
|
|
53
59
|
concurrent-ruby (~> 1.0)
|
|
54
60
|
jmespath (1.6.2)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
rspec
|
|
61
|
+
logger (1.7.0)
|
|
62
|
+
mime-types (3.7.0)
|
|
63
|
+
logger
|
|
64
|
+
mime-types-data (~> 3.2025, >= 3.2025.0507)
|
|
65
|
+
mime-types-data (3.2025.0924)
|
|
66
|
+
mini_portile2 (2.8.9)
|
|
67
|
+
minitest (5.25.5)
|
|
68
|
+
nokogiri (1.18.10)
|
|
69
|
+
mini_portile2 (~> 2.8.2)
|
|
70
|
+
racc (~> 1.4)
|
|
71
|
+
racc (1.8.1)
|
|
72
|
+
rake (13.3.0)
|
|
73
|
+
rspec (3.13.1)
|
|
74
|
+
rspec-core (~> 3.13.0)
|
|
75
|
+
rspec-expectations (~> 3.13.0)
|
|
76
|
+
rspec-mocks (~> 3.13.0)
|
|
77
|
+
rspec-core (3.13.5)
|
|
78
|
+
rspec-support (~> 3.13.0)
|
|
79
|
+
rspec-expectations (3.13.5)
|
|
68
80
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
-
rspec-support (~> 3.
|
|
70
|
-
rspec-mocks (3.
|
|
81
|
+
rspec-support (~> 3.13.0)
|
|
82
|
+
rspec-mocks (3.13.5)
|
|
71
83
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
72
|
-
rspec-support (~> 3.
|
|
73
|
-
rspec-support (3.
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
rspec-support (~> 3.13.0)
|
|
85
|
+
rspec-support (3.13.6)
|
|
86
|
+
rspec_junit_formatter (0.6.0)
|
|
87
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
|
88
|
+
rubyzip (3.1.1)
|
|
89
|
+
securerandom (0.4.1)
|
|
76
90
|
simplecov (0.22.0)
|
|
77
91
|
docile (~> 1.1)
|
|
78
92
|
simplecov-html (~> 0.11)
|
|
79
93
|
simplecov_json_formatter (~> 0.1)
|
|
80
|
-
simplecov-html (0.
|
|
94
|
+
simplecov-html (0.13.2)
|
|
81
95
|
simplecov_json_formatter (0.1.4)
|
|
82
|
-
timecop (0.9.
|
|
96
|
+
timecop (0.9.10)
|
|
83
97
|
tzinfo (2.0.6)
|
|
84
98
|
concurrent-ruby (~> 1.0)
|
|
99
|
+
uri (1.0.3)
|
|
85
100
|
|
|
86
101
|
PLATFORMS
|
|
87
102
|
ruby
|
|
88
103
|
|
|
89
104
|
DEPENDENCIES
|
|
105
|
+
nokogiri (~> 1.18)
|
|
90
106
|
rake (~> 13.0)
|
|
91
107
|
rspec (~> 3.0)
|
|
108
|
+
rspec_junit_formatter
|
|
92
109
|
simplecov (~> 0.22.0)
|
|
93
110
|
teak_util!
|
|
94
111
|
timecop (~> 0.9.8)
|
|
95
112
|
|
|
96
113
|
BUNDLED WITH
|
|
97
|
-
2.
|
|
114
|
+
2.7.2
|
|
@@ -47,7 +47,7 @@ module TeakUtil
|
|
|
47
47
|
def convert_data
|
|
48
48
|
self.data =
|
|
49
49
|
if multiple_files?
|
|
50
|
-
Zip::File.open_buffer(StringIO.new(String.new)) do |zip_file|
|
|
50
|
+
Zip::File.open_buffer(StringIO.new(String.new), create: true) do |zip_file|
|
|
51
51
|
value.each do |(fname, contents)|
|
|
52
52
|
zip_file.file.open(fname, +'w') do |file|
|
|
53
53
|
file.write(contents)
|
|
@@ -55,7 +55,7 @@ module TeakUtil
|
|
|
55
55
|
end
|
|
56
56
|
end.string
|
|
57
57
|
elsif compress
|
|
58
|
-
Zip::File.open_buffer(StringIO.new(String.new)) do |zip_file|
|
|
58
|
+
Zip::File.open_buffer(StringIO.new(String.new), create: true) do |zip_file|
|
|
59
59
|
zip_file.file.open(key, +'w') do |file|
|
|
60
60
|
file.write(value)
|
|
61
61
|
end
|
data/lib/teak_util/storage/s3.rb
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'digest'
|
|
4
|
+
require 'English'
|
|
5
|
+
require 'set'
|
|
6
|
+
|
|
7
|
+
module TeakUtil
|
|
8
|
+
# Derives a worktree-scoped test database name from a checkout's directory basename,
|
|
9
|
+
# and purges databases left behind by worktrees that no longer exist. Deliberately
|
|
10
|
+
# standalone-requirable (no dependency on the rest of teak_util) since it's typically
|
|
11
|
+
# evaluated from an ERB database config at app boot.
|
|
12
|
+
module TestDatabaseName
|
|
13
|
+
MAX_IDENTIFIER_LENGTH = 64 # MySQL's identifier limit
|
|
14
|
+
HASH_LENGTH = 8
|
|
15
|
+
|
|
16
|
+
DEFAULT_WORKTREE_LISTER = lambda do
|
|
17
|
+
output = `git worktree list --porcelain 2>/dev/null`
|
|
18
|
+
raise '`git worktree list --porcelain` failed. Are you in a git repository?' unless $CHILD_STATUS.success?
|
|
19
|
+
|
|
20
|
+
output
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
module_function
|
|
24
|
+
|
|
25
|
+
# @param basename [String] the checkout's directory basename
|
|
26
|
+
# @param base [String] the database name used by the main (non-worktree) checkout,
|
|
27
|
+
# e.g. 'taro_posts_test'
|
|
28
|
+
# @param main_worktree [String] the directory name of the main checkout, e.g. 'taro' —
|
|
29
|
+
# compared case-insensitively so `main_worktree` gets `base` back unmodified
|
|
30
|
+
def for_worktree(basename, base:, main_worktree:)
|
|
31
|
+
downcased = basename.downcase
|
|
32
|
+
return base if downcased == main_worktree.downcase
|
|
33
|
+
|
|
34
|
+
# core_app's `CREATE DATABASE #{db}` is unquoted, so a non-identifier character
|
|
35
|
+
# is a syntax error, not a style choice.
|
|
36
|
+
sanitized = downcased.gsub(/[^a-z0-9]+/, '_')
|
|
37
|
+
budget = MAX_IDENTIFIER_LENGTH - base.length - 1 # 1 for the joining underscore
|
|
38
|
+
raise ArgumentError, "base #{base.inspect} leaves no room for a worktree suffix" if budget <= 0
|
|
39
|
+
|
|
40
|
+
if sanitized.length > budget
|
|
41
|
+
hash = Digest::SHA256.hexdigest(sanitized)[0, HASH_LENGTH]
|
|
42
|
+
truncated_length = budget - hash.length - 1 # 1 for the underscore before the hash
|
|
43
|
+
raise ArgumentError, "base #{base.inspect} leaves no room for a worktree suffix" if truncated_length <= 0
|
|
44
|
+
|
|
45
|
+
sanitized = "#{sanitized[0, truncated_length]}_#{hash}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
"#{base}_#{sanitized}"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Lists and drops test databases for worktrees that no longer exist.
|
|
52
|
+
#
|
|
53
|
+
# @param connection [#fetch, #run] a Sequel-connection-shaped object
|
|
54
|
+
# @param base [String] as for #for_worktree
|
|
55
|
+
# @param main_worktree [String] as for #for_worktree
|
|
56
|
+
# @param input [#gets] prompt source
|
|
57
|
+
# @param output [#puts, #print] prompt/progress sink
|
|
58
|
+
# @param worktree_lister [#call] returns `git worktree list --porcelain` output;
|
|
59
|
+
# must raise on failure — the default does. A custom lister inherits that
|
|
60
|
+
# contract; a lister that swallows a failed listing will read as "no active
|
|
61
|
+
# worktrees" and offer to drop every database this basename owns.
|
|
62
|
+
def purge(connection:, base:, main_worktree:, input: $stdin, output: $stdout,
|
|
63
|
+
worktree_lister: DEFAULT_WORKTREE_LISTER)
|
|
64
|
+
escaped_base = base.gsub(/[\\_%]/) { |match| "\\#{match}" }
|
|
65
|
+
rows = connection.fetch("SHOW DATABASES LIKE '#{escaped_base}\\_%'").map { |row| row.values.first }
|
|
66
|
+
|
|
67
|
+
active = worktree_lister.call.lines
|
|
68
|
+
.select { |line| line.start_with?('worktree ') }
|
|
69
|
+
.map { |line| File.basename(line.sub('worktree ', '').strip) }
|
|
70
|
+
.to_set { |basename| for_worktree(basename, base: base, main_worktree: main_worktree) }
|
|
71
|
+
|
|
72
|
+
defunct = rows - active.to_a
|
|
73
|
+
|
|
74
|
+
if defunct.empty?
|
|
75
|
+
output.puts 'No defunct worktree test databases found.'
|
|
76
|
+
return
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
output.puts "Found #{defunct.size} defunct worktree test database(s):"
|
|
80
|
+
defunct.each { |db| output.puts " - #{db}" }
|
|
81
|
+
|
|
82
|
+
output.print "\nDrop all of them? [y/N] "
|
|
83
|
+
answer = input.gets&.strip
|
|
84
|
+
unless answer&.match?(/\Ay(es)?\z/i)
|
|
85
|
+
output.puts 'Aborted.'
|
|
86
|
+
return
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
defunct.each do |db|
|
|
90
|
+
output.puts "Dropping #{db}..."
|
|
91
|
+
connection.run("DROP DATABASE `#{db}`")
|
|
92
|
+
end
|
|
93
|
+
output.puts 'Done.'
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
data/lib/teak_util/version.rb
CHANGED
data/teak_util.gemspec
CHANGED
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
|
|
11
11
|
spec.summary = "A collection of utilities used by multiple projects at Teak"
|
|
12
12
|
spec.homepage = "https://github.com/GoCarrot/teak_util"
|
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">=
|
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
14
14
|
|
|
15
15
|
spec.license = "Apache-2.0"
|
|
16
16
|
|
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
|
32
32
|
spec.add_dependency "aws-sdk-s3", ">= 1.102"
|
|
33
33
|
spec.add_dependency "business_flow", ">= 0.18.0"
|
|
34
34
|
spec.add_dependency "mime-types", ">= 3"
|
|
35
|
-
spec.add_dependency "rubyzip", "
|
|
35
|
+
spec.add_dependency "rubyzip", ">= 2.3", "< 4.0"
|
|
36
36
|
|
|
37
37
|
# For more information and examples about making a new gem, checkout our
|
|
38
38
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: teak_util
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alex Scarborough
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: aws-sdk-s3
|
|
@@ -56,17 +55,22 @@ dependencies:
|
|
|
56
55
|
name: rubyzip
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
|
-
- - "
|
|
58
|
+
- - ">="
|
|
60
59
|
- !ruby/object:Gem::Version
|
|
61
60
|
version: '2.3'
|
|
61
|
+
- - "<"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '4.0'
|
|
62
64
|
type: :runtime
|
|
63
65
|
prerelease: false
|
|
64
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
67
|
requirements:
|
|
66
|
-
- - "
|
|
68
|
+
- - ">="
|
|
67
69
|
- !ruby/object:Gem::Version
|
|
68
70
|
version: '2.3'
|
|
69
|
-
|
|
71
|
+
- - "<"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: '4.0'
|
|
70
74
|
email:
|
|
71
75
|
- alex@teak.io
|
|
72
76
|
executables: []
|
|
@@ -76,6 +80,8 @@ files:
|
|
|
76
80
|
- ".circleci/config.yml"
|
|
77
81
|
- ".gitignore"
|
|
78
82
|
- ".rspec"
|
|
83
|
+
- ".ruby-gemset"
|
|
84
|
+
- ".ruby-version"
|
|
79
85
|
- CHANGELOG.md
|
|
80
86
|
- Gemfile
|
|
81
87
|
- Gemfile.lock
|
|
@@ -88,6 +94,7 @@ files:
|
|
|
88
94
|
- lib/teak_util.rb
|
|
89
95
|
- lib/teak_util/storage/make_externally_available_file.rb
|
|
90
96
|
- lib/teak_util/storage/s3.rb
|
|
97
|
+
- lib/teak_util/test_database_name.rb
|
|
91
98
|
- lib/teak_util/version.rb
|
|
92
99
|
- teak_util.gemspec
|
|
93
100
|
homepage: https://github.com/GoCarrot/teak_util
|
|
@@ -98,7 +105,6 @@ metadata:
|
|
|
98
105
|
homepage_uri: https://github.com/GoCarrot/teak_util
|
|
99
106
|
source_code_uri: https://github.com/GoCarrot/teak_util
|
|
100
107
|
changelog_uri: https://github.com/GoCarrot/teak_util/blob/main/CHANGELOG.md
|
|
101
|
-
post_install_message:
|
|
102
108
|
rdoc_options: []
|
|
103
109
|
require_paths:
|
|
104
110
|
- lib
|
|
@@ -106,15 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
106
112
|
requirements:
|
|
107
113
|
- - ">="
|
|
108
114
|
- !ruby/object:Gem::Version
|
|
109
|
-
version:
|
|
115
|
+
version: 3.3.0
|
|
110
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
117
|
requirements:
|
|
112
118
|
- - ">="
|
|
113
119
|
- !ruby/object:Gem::Version
|
|
114
120
|
version: '0'
|
|
115
121
|
requirements: []
|
|
116
|
-
rubygems_version: 3.
|
|
117
|
-
signing_key:
|
|
122
|
+
rubygems_version: 3.7.2
|
|
118
123
|
specification_version: 4
|
|
119
124
|
summary: A collection of utilities used by multiple projects at Teak
|
|
120
125
|
test_files: []
|