Skip to content

Instantly share code, notes, and snippets.

@tonini
Created October 1, 2011 17:59
Show Gist options
  • Save tonini/1256417 to your computer and use it in GitHub Desktop.
Save tonini/1256417 to your computer and use it in GitHub Desktop.
(defun tonini-ruby-execute-file ()
"Executes the current Ruby file."
(interactive)
(if rspec-use-rvm
(rvm-activate-corresponding-ruby))
(setq current-file (buffer-file-name))
(if (and current-file (file-exists-p current-file))
(if (string-match "\\.rb$" current-file)
(compile (concat "ruby -w " current-file))
(message "%s is not a valid ruby file." current-file))
(message "There is not valid file to execute.")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment