Skip to content

Instantly share code, notes, and snippets.

@scott-ad-riley
Last active February 25, 2016 21:33
Show Gist options
  • Save scott-ad-riley/edba62dca8fb525b9558 to your computer and use it in GitHub Desktop.
Save scott-ad-riley/edba62dca8fb525b9558 to your computer and use it in GitHub Desktop.
Create Ruby specs
#!/bin/bash
if [ ! -d "specs" ]; then
mkdir "specs"
fi
for file in *.rb
do
echo "require('minitest/autorun')" >> "specs/${file/.rb/}"_spec.rb
while getopts "c" opt; do
case $opt in
c)
echo "require('minitest/rg')" >> "specs/${file/.rb/}"_spec.rb
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
echo "require_relative('../${file/.rb/}')" >> "specs/${file/.rb/}"_spec.rb
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment