Skip to content

Instantly share code, notes, and snippets.

@HarlemSquirrel
Created October 25, 2024 02:32
Show Gist options
  • Save HarlemSquirrel/a6ed19c698ef70e3ecd87d57c36edb85 to your computer and use it in GitHub Desktop.
Save HarlemSquirrel/a6ed19c698ef70e3ecd87d57c36edb85 to your computer and use it in GitHub Desktop.
Single file code example with watcher
##
# Single file starter with broken test using only the Ruby standard library.
#
def mymeth(a,b)
a + b
end
require "minitest/autorun"
class TheTest < Minitest::Test
def test_mymeth
assert_equal 3, mymeth(1,2)
end
end
##
# Watch for saves and run the code through the Ruby interpreter.
# Uses https://github.com/inotify-tools/inotify-tools/wiki
#
while inotifywait -e close_write something.rb; do clear; ruby something.rb; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment