bard 2.0.0 → 2.0.1

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: 24a9ee78c591a6446ac1bb749225497c75470e12e4fe822d96e975870ac88152
4
- data.tar.gz: 2b8ae0acbf1237b3312957128130f399a516a3a19d52d45f63c7b0677952e4f2
3
+ metadata.gz: fd306cc52987e130ccf09def062d02e65314d6dced067f6a873958b25cdfaaa9
4
+ data.tar.gz: f6987cb35fb896b64b629d5d50b6c46488d3ea8adaf69728bc563a4234a33f2f
5
5
  SHA512:
6
- metadata.gz: 55a1a4f6fcf3bf12201105974a619be5178c3c9c6367d8dccf2eef1e7e504880a869a6291dfb5024930e025f63d8cf2f22c8925cf5fc24f9e83d2aa85ed047ed
7
- data.tar.gz: 5da5d707ceed5ca663e4a68cd4a2ba2afbb232052e4a0542a4e41a1badc0161ba4eda410195b717d21f8fdaea299af771afa6a19310d93b66915996e8579b5fa
6
+ metadata.gz: 123f561fb91f68d2ea6ed5e56ca63516695686e2e326be319d95bfdc2d523366e2987c4fff97bc105e904b30f9e670316f4dc5f721b07088c3cd1e1607992f65
7
+ data.tar.gz: 50681310b93eb9ab59b50498e6685858c6a6cf161d6adb1d5742b1d06d37989ec30ea2e1e366cfad70829db1699bb598f672db6b8d3ea7de0504dd8697f7b881
@@ -1,6 +1,7 @@
1
1
  require "bard/plugins/deploy/strategy"
2
2
  require "bard/plugins/git"
3
3
  require "fileutils"
4
+ require "socket"
4
5
  require "uri"
5
6
 
6
7
  module Bard
@@ -19,6 +20,7 @@ module Bard
19
20
  @build_dir = "tmp/github-build-#{@sha}"
20
21
  @branch = "gh-pages"
21
22
  @domain = extract_domain
23
+ @port = pick_free_port
22
24
 
23
25
  puts "Starting deployment to GitHub Pages..."
24
26
 
@@ -37,27 +39,46 @@ module Bard
37
39
  domain
38
40
  end
39
41
 
42
+ def pick_free_port
43
+ server = TCPServer.new("127.0.0.1", 0)
44
+ port = server.addr[1]
45
+ server.close
46
+ port
47
+ end
48
+
40
49
  def build_site
41
50
  system "rm -rf #{@build_dir.sub(@sha, "*")}"
42
51
  run! <<~SH
43
52
  set -e
44
- RAILS_ENV=production bundle exec rails s -p 3000 -d --pid tmp/pids/server.pid
53
+ PORT=#{@port}
54
+
45
55
  OUTPUT=$(bundle exec rake assets:clean assets:precompile 2>&1) || echo "$OUTPUT"
46
56
 
47
- # Create the output directory and enter it
48
57
  BUILD=#{@build_dir}
49
58
  rm -rf $BUILD
50
59
  mkdir -p $BUILD
51
60
  cp -R public/assets $BUILD/
52
- cd $BUILD
53
61
 
54
- # wait until server responds
62
+ # Start rails in the foreground, backgrounded — NOT as a daemon —
63
+ # so a port-bind failure surfaces instead of being swallowed by fork.
64
+ rm -f tmp/pids/server.pid
65
+ RAILS_ENV=production bundle exec rails s -p $PORT -P tmp/pids/server.pid >tmp/pids/server.log 2>&1 &
66
+ RAILS_PID=$!
67
+
55
68
  echo waiting...
56
- curl -s --retry 5 --retry-delay 2 http://localhost:3000 >/dev/null 2>&1
69
+ for i in $(seq 1 30); do
70
+ if ! kill -0 $RAILS_PID 2>/dev/null; then
71
+ echo "Rails server failed to start on port $PORT:"
72
+ cat tmp/pids/server.log
73
+ exit 1
74
+ fi
75
+ curl -sf http://localhost:$PORT >/dev/null 2>&1 && break
76
+ sleep 1
77
+ done
57
78
 
79
+ cd $BUILD
58
80
  echo copying...
59
- # Mirror the site to the build folder, ignoring links with query params
60
- wget -nv -r -l inf --no-remove-listing -FEnH --reject-regex "(\\.*)\\?(.*)" http://localhost:3000/ 2>&1
81
+ wget -nv -r -l inf --no-remove-listing -FEnH --reject-regex "(\\.*)\\?(.*)" http://localhost:$PORT/ 2>&1
61
82
 
62
83
  echo #{@domain} > CNAME
63
84
  SH
data/lib/bard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Bard
2
- VERSION = "2.0.0"
2
+ VERSION = "2.0.1"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-05-17 00:00:00.000000000 Z
10
+ date: 2026-05-19 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor