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: 8802c8c1d6e3c05bcc491c9a4e0a462e38baae9bb522f060941772f78538d0df
4
- data.tar.gz: f7adc9f53894da6fd8d8228a4f349dbea3ad7663b0287dfbc74148613bf6fcfe
3
+ metadata.gz: ed420bb45532ec33805ef43ce1ac52c56b349c7600d5019b4f811eeb4275b8e8
4
+ data.tar.gz: e37cf9e839380574732bef86f9d087e7117f3ae8472417a363da1948e1cff972
5
5
  SHA512:
6
- metadata.gz: d83544f0d4e84a1e0f2abb3a10fe9a6477bec3edc52903100cdc1e313936872a19cbc92432225653604104ec832233036fb316590f90176352a9c4e522b60d8d
7
- data.tar.gz: 93b74f7425da1c7914807046703ccd00388c773beb4ead2205b0cf0ec0c2ef8b1a454d5dda23ad4e5dffed11f1189c0db4951c39d5a566e081e6a76b8daa9dad
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.27] - 2026-02-06
8
+ ## [0.2.28] - 2026-02-17
9
9
 
10
- ## [0.2.26] - 2026-01-31
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
- unless ENV["QUIET_SETUP"] || ENV["DISABLE_OUTPUT"]
167
- puts "You do not currently use #{description}.\n ===> If you want to, type Y\nOtherwise hit any key to ignore."
168
- end
169
- if gets.chomp == "Y"
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
- unless ENV["QUIET_SETUP"] || ENV["DISABLE_OUTPUT"]
176
- puts "Proceed with #{task}?\n ===> Type Y to proceed\nOtherwise hit any key to ignore."
177
- end
178
- if gets.chomp == "Y"
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
- # Check common PostgreSQL ports
156
- [5432, 5433].each do |port|
157
- if postgresql_running_on_port?(port)
158
- @native_pg_port = port
159
- return true
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
- exec docker exec -i "$CONTAINER" #{tool} "$@"
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}
@@ -1,3 +1,3 @@
1
1
  module Discharger
2
- VERSION = "0.2.27"
2
+ VERSION = "0.2.28"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discharger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.27
4
+ version: 0.2.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Gay