A gem/plugin that I’m using to support my test suite calls some GNU commands that cause the Windows shell to roll over and die. I can rewrite these functions with a bypass in this fashion:
def get_rake_output(task)
if RUBY_PLATFORM.include? 'mingw'
puts 'Skipped since OS is Windows. Run the test suite on a UNIX-like shell.'
''
else
`./rake --silent #{task}`
end
end
Of course, this prints the message every time the function is called. How do I best make sure that it displays only once?
It’s method in ruby.
</rant>.Use a class variable like
@@warning_saidand check for that one. AkaI’m not exaclty sure what scope you are operating in, but that should do it.