discharger 0.2.27 → 0.2.28
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed420bb45532ec33805ef43ce1ac52c56b349c7600d5019b4f811eeb4275b8e8
|
|
4
|
+
data.tar.gz: e37cf9e839380574732bef86f9d087e7117f3ae8472417a363da1948e1cff972
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f241dc449944f05eeaf4eccf0fb9e5b8d77e4f087cc6e4eef2a79287fa9d28b6088a7b7acd868f0d4a5b295efb08890fa381811665ce3f757dfbb0b1e89924ca
|
|
7
|
+
data.tar.gz: 0ffd1f6bad8d1fc3ab7a7f6f5ccf55f0f8a33371a1fb16d07aebcae2bb6c2a2d8b476720a16533221a79bfdbb2cb6953fb96112596e5f212bd8c24b469659184
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,6 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
7
7
|
|
|
8
|
-
## [0.2.
|
|
8
|
+
## [0.2.28] - 2026-02-17
|
|
9
9
|
|
|
10
|
-
## [0.2.
|
|
10
|
+
## [0.2.27] - 2026-02-06
|
|
@@ -163,19 +163,19 @@ module Discharger
|
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
def ask_to_install(description)
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if gets
|
|
166
|
+
return yield unless $stdin.tty?
|
|
167
|
+
|
|
168
|
+
puts "You do not currently use #{description}.\n ===> If you want to, type Y\nOtherwise hit any key to ignore."
|
|
169
|
+
if gets&.chomp == "Y"
|
|
170
170
|
yield
|
|
171
171
|
end
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
def proceed_with(task)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if gets
|
|
175
|
+
return yield unless $stdin.tty?
|
|
176
|
+
|
|
177
|
+
puts "Proceed with #{task}?\n ===> Type Y to proceed\nOtherwise hit any key to ignore."
|
|
178
|
+
if gets&.chomp == "Y"
|
|
179
179
|
yield
|
|
180
180
|
end
|
|
181
181
|
end
|
|
@@ -98,7 +98,7 @@ module Discharger
|
|
|
98
98
|
def create_container(name:, port:, image:, internal_port:, env: {}, volume: nil)
|
|
99
99
|
log "Creating new #{name} container"
|
|
100
100
|
|
|
101
|
-
cmd = ["docker", "run", "-d", "--name", name, "-p", "#{port}:#{internal_port}"]
|
|
101
|
+
cmd = ["docker", "run", "-d", "--name", name, "--user", "postgres", "-p", "#{port}:#{internal_port}"]
|
|
102
102
|
env.each { |k, v| cmd.push("-e", "#{k}=#{v}") }
|
|
103
103
|
cmd.push("-v", volume) if volume
|
|
104
104
|
cmd.push(image)
|
|
@@ -152,12 +152,11 @@ module Discharger
|
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
def native_postgresql_available?
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
end
|
|
155
|
+
configured_port = (config.database&.port || 5432).to_i
|
|
156
|
+
|
|
157
|
+
if postgresql_running_on_port?(configured_port)
|
|
158
|
+
@native_pg_port = configured_port
|
|
159
|
+
return true
|
|
161
160
|
end
|
|
162
161
|
false
|
|
163
162
|
end
|
|
@@ -119,7 +119,39 @@ module Discharger
|
|
|
119
119
|
# Docker first: use container's #{tool} if running
|
|
120
120
|
if docker ps --format '{{.Names}}' 2>/dev/null | grep -q "^${CONTAINER}$"; then
|
|
121
121
|
echo "Using #{tool} from Docker container: $CONTAINER" >&2
|
|
122
|
-
|
|
122
|
+
|
|
123
|
+
# Parse arguments to handle --file option specially
|
|
124
|
+
# When running in Docker, host paths don't exist in the container
|
|
125
|
+
# so we pipe file content via stdin instead
|
|
126
|
+
INPUT_FILE=""
|
|
127
|
+
ARGS=()
|
|
128
|
+
while [[ $# -gt 0 ]]; do
|
|
129
|
+
case $1 in
|
|
130
|
+
--file)
|
|
131
|
+
INPUT_FILE="$2"
|
|
132
|
+
shift 2
|
|
133
|
+
;;
|
|
134
|
+
--file=*)
|
|
135
|
+
INPUT_FILE="${1#*=}"
|
|
136
|
+
shift
|
|
137
|
+
;;
|
|
138
|
+
-f)
|
|
139
|
+
INPUT_FILE="$2"
|
|
140
|
+
shift 2
|
|
141
|
+
;;
|
|
142
|
+
*)
|
|
143
|
+
ARGS+=("$1")
|
|
144
|
+
shift
|
|
145
|
+
;;
|
|
146
|
+
esac
|
|
147
|
+
done
|
|
148
|
+
|
|
149
|
+
if [[ -n "$INPUT_FILE" ]]; then
|
|
150
|
+
docker exec -i "$CONTAINER" #{tool} "${ARGS[@]}" < "$INPUT_FILE"
|
|
151
|
+
else
|
|
152
|
+
exec docker exec -i "$CONTAINER" #{tool} "${ARGS[@]}"
|
|
153
|
+
fi
|
|
154
|
+
exit 0
|
|
123
155
|
fi
|
|
124
156
|
|
|
125
157
|
# Fallback to system #{tool}
|
data/lib/discharger/version.rb
CHANGED