Extract shell environment logic into a single file

This commit is contained in:
James Coglan
2025-05-24 16:55:29 +01:00
parent 37f49e307e
commit f85cbea8b8
6 changed files with 28 additions and 23 deletions
+1
View File
@@ -1,2 +1,3 @@
.vagrant
code
reports
+5 -6
View File
@@ -1,13 +1,12 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail
source ~/.nvmrc
source ~/.rubyrc
source shellenv
ruby-client () {
local version="$1"
cd ~/repo/ruby/$version/websocket
cd "$CODE_DIR/ruby/$version/websocket"
chruby "$version"
compile-driver
ruby examples/autobahn_client.rb
@@ -19,7 +18,7 @@ compile-driver () {
cd -
}
# cd ~/repo/ruby/jruby-1.7/websocket
# cd "$CODE_DIR/ruby/jruby-1.7/websocket"
# chruby jruby-1.7
# compile-driver
# ruby -J-Xmx2048m --1.9 examples/autobahn_client.rb
@@ -37,7 +36,7 @@ done
node-client () {
local version="$1"
cd ~/repo/node/websocket
cd "$CODE_DIR/node/websocket"
nvm use "$version"
node examples/autobahn_client.js
}
+4 -4
View File
@@ -1,13 +1,13 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail
source ~/.nvmrc
source shellenv
websocket-driver-node-server () {
local version="$1"
local port="$2"
cd ~/repo/node/driver
cd "$CODE_DIR/node/driver"
nvm use "$version"
node examples/net_server.js "$port" &
}
@@ -29,7 +29,7 @@ faye-websocket-node-server () {
local version="$1"
local port="$2"
cd ~/repo/node/websocket
cd "$CODE_DIR/node/websocket"
nvm use "$version"
node examples/server.js "$port" &
}
+7 -7
View File
@@ -1,6 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail
source ~/.rubyrc
source shellenv
compile-driver () {
@@ -14,7 +14,7 @@ websocket-driver-ruby-server () {
local version="$1"
local port="$2"
cd ~/repo/ruby/$version/driver
cd "$CODE_DIR/ruby/$version/driver"
chruby "$version"
compile-driver
ruby examples/em_server.rb "$port" &
@@ -33,7 +33,7 @@ websocket-driver-ruby-server ruby-3.2 6110
websocket-driver-ruby-server ruby-3.3 6111
websocket-driver-ruby-server ruby-3.4 6112
# cd ~/repo/ruby/jruby-1.7/driver
# cd "$CODE_DIR/ruby/jruby-1.7/driver"
# chruby jruby-1.7
# ruby -S bundle exec rake compile
# ruby -J-Xmx2048m --1.9 examples/em_server.rb 6201 &
@@ -50,7 +50,7 @@ faye-websocket-ruby-server () {
local server="$2"
local port="$3"
cd ~/repo/ruby/$version/websocket
cd "$CODE_DIR/ruby/$version/websocket"
chruby "$version"
compile-driver
ruby examples/server.rb "$port" '' "$server" &
@@ -69,7 +69,7 @@ faye-websocket-ruby-server ruby-3.2 thin 7110
faye-websocket-ruby-server ruby-3.3 thin 7111
faye-websocket-ruby-server ruby-3.4 thin 7112
cd ~/repo/ruby/ruby-3.1/websocket
cd "$CODE_DIR/ruby/ruby-3.1/websocket"
chruby ruby-3.1
ruby examples/server.rb 7201 '' goliath -svp 7201 &
cd examples
@@ -78,7 +78,7 @@ ruby -S bundle exec passenger start -p 7202 &
faye-websocket-ruby-server ruby-3.2 puma 7203
faye-websocket-ruby-server ruby-3.2 rainbows 7204
# cd ~/repo/ruby/jruby-1.7/websocket
# cd "$CODE_DIR/ruby/jruby-1.7/websocket"
# chruby jruby-1.7
# ruby -J-Xmx2048m --1.9 examples/server.rb 7301 '' puma &
# ruby -J-Xmx2048m --2.0 examples/server.rb 7302 '' puma &
+5 -6
View File
@@ -1,11 +1,10 @@
#!/bin/bash
#!/usr/bin/env bash
set -eo pipefail
source ~/.nvmrc
source ~/.rubyrc
source shellenv
mkdir -p ~/repo/{node,ruby}
PATCH_DIR="$PWD/patches"
mkdir -p "$CODE_DIR"/{node,ruby}
checkout () {
@@ -30,7 +29,7 @@ checkout () {
}
cd ~/repo/node
cd "$CODE_DIR/node"
install-node-modules () {
local dir="$1"
@@ -74,7 +73,7 @@ link-repo websocket-extensions extensions
cd -
cd ~/repo/ruby
cd "$CODE_DIR/ruby"
RUBY_VERSIONS=(
# ruby-1.9
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
source ~/.nvmrc
source ~/.rubyrc
CODE_DIR="$PWD/code"