diff --git a/ruby/.ruby-version b/ruby/.ruby-version deleted file mode 100644 index 84d6c67..0000000 --- a/ruby/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -3.4.10 diff --git a/ruby/.tool-versions b/ruby/.tool-versions new file mode 100644 index 0000000..380cf51 --- /dev/null +++ b/ruby/.tool-versions @@ -0,0 +1 @@ +ruby 3.4 diff --git a/ruby/README.md b/ruby/README.md index 77e4577..5a3fcd7 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -1,17 +1,32 @@ # Ruby -Pairing test starter project for Ruby with rspec for testing. +Skeleton project for Ruby. + +## Prerequisites + +The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions): + +``` +ruby 3.4 +``` + +Install those however you prefer, as long as they end up on your `PATH`. The quickest route is +[mise](https://mise.jdx.dev/), which reads the file for you: + +```sh +mise install +``` ## Usage -- `./script/setup` to install dependencies +- `./script/setup` to fetch dependencies - `./script/test` to run the tests -- `./script/start` to run the code +- `./script/start` to run the app - `./script/console` for an interactive prompt ## Structure -- Code located in [pairing_test.rb](./lib/pairing_test.rb) -- Tests located in [pairing_test_spec.rb](./spec/pairing_test_spec.rb) +- Code located in [`pairing_test.rb`](./lib/pairing_test.rb) +- Tests located in [`pairing_test_spec.rb`](./spec/pairing_test_spec.rb) `lib` has been added to the `require` path so all imports inside the `lib` directory must be relative to this, e.g. `require "pairing_test/version"`. -However, you're free to organise your code as you like. +However, you're free to organise your code as you like. diff --git a/ruby/script/setup b/ruby/script/setup index 1ba28af..29df332 100755 --- a/ruby/script/setup +++ b/ruby/script/setup @@ -1,7 +1,7 @@ #!/usr/bin/env bash + set -euo pipefail -IFS=$'\n\t' -set -vx -gem install bundler +cd "$(dirname "${BASH_SOURCE[0]}")/.." + bundle install diff --git a/ruby/script/test b/ruby/script/test index 2d784f2..5cafbd0 100755 --- a/ruby/script/test +++ b/ruby/script/test @@ -1,5 +1,7 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -rake spec +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +bundle exec rake spec