Basic ruby filename.rb command doesn't run code (rbenv wtf)

I setup the environment and finished the prepwork last month. I wanted to work on some of my own projects for more study but I am having an issue: when I type ruby filename.rb into the terminal the code does not run. RSPEC works as usual. I didn’t notice before because I was running everything with RSPEC.

I deleted the .dotfiles folder and everything in it then followed the environment setup instructions again. Same problem.

The filename.rb I am running is just a simple puts "hello world" for testing purposes.

I know this has something to do with rbenv which was installed when I ran the dotfiles. Can someone please tell me how to get the ruby command to work with the dotfiles setup?

It sounds like you need to add an:
if FILE == $PROGAM_NAME

end 

You add that in your file at the very bottom. Inside the if and the end you put what you want to happen/ call when that file is ran directly. I hope that helps.

1 Like

It works when I add this, I am unsure why my old game files that included this part didn’t work yesterday. But they work again today! Maybe it just needed to be rebooted after I reinstalled the setup. Thank you for responding.