Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The sublime plugin is trying to run the command <code>rspec</code> using shell <code>/bin/sh</code>. However, the command is not found because RVM is not loaded in the shell's environment.</p> <p>As such, the folder where your <code>rspec</code> executable is located is not in the shell's search path (<code>PATH</code> environment variable). RVM installs any executable commands that come with gems to someplace like: "<code>/home/your-user/.rvm/gems/ruby-1.9.3-p194@myproject/bin/</code>" (<em>actual path depending on your gemset, ruby version, and where your OS stores user home directories</em>)</p> <h1>Simple Solution</h1> <p>As mentioned <a href="https://stackoverflow.com/a/11695721/645491">here</a>... you might find that simply executing sublime from a shell environment containing RVM (ie: your project directory) may solve the <code>PATH</code> problem. However, this requires that you execute your text editor from the command line each time, and that the shell's environment is preserved.</p> <pre><code>cd ~/src/my-ruby-project subl . </code></pre> <p>After much experimentation, I found a way to force the RubyTest plugin to execute <code>rspec</code> with the correct RVM-controlled environment (<strong>with bundler support</strong>).</p> <h1>With Bundler Support</h1> <p>Here's the contents of my <code>~/.config/sublime-text-2/Packages/RubyTest/RubyTest.sublime-settings</code> file:</p> <pre><code>{ "erb_verify_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/bundle exec erb -xT - {file_name} | ~/.rvm/bin/rvm-auto-ruby -c", "ruby_verify_command": "~/.rvm/bin/rvm-auto-ruby -c {file_name}", "run_ruby_unit_command": "~/.rvm/bin/rvm-auto-ruby -Itest {relative_path}", "run_single_ruby_unit_command": "~/.rvm/bin/rvm-auto-ruby -Itest {relative_path} -n '{test_name}'", "run_cucumber_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/bundle exec cucumber {relative_path}", "run_single_cucumber_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/bundle exec cucumber {relative_path} -l{line_number}", "run_rspec_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/bundle exec rspec {relative_path}", "run_single_rspec_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/bundle exec rspec {relative_path} -l{line_number}", "ruby_unit_folder": "test", "ruby_cucumber_folder": "features", "ruby_rspec_folder": "spec", "ruby_use_scratch" : false, "save_on_run": false, "ignored_directories": [".git", "vendor", "tmp"], "hide_panel": false, "before_callback": "", "after_callback": "" } </code></pre> <p>This should work as long as you've got bundler in your global gemset, and RVM installed to your home dir (<em>adjust paths as needed if <code>~/.rvm</code> does not evaluate correctly, or if <code>bundler</code> or <code>rvm-auto-ruby</code> is located somewhere else</em>).</p> <p>If you are using gemsets you should also add a line like the following to your project's <code>.rvmrc</code> file:</p> <pre><code>rvm use ruby-1.9.3-p327@your_project_gemset_name </code></pre> <h1>Without Bundler Support</h1> <p>This assumes you have <code>cucumber</code> and <code>rspec</code> installed to the <strong>@global</strong> gemset of your <strong>current</strong> ruby:</p> <pre><code>{ "erb_verify_command": "~/.rvm/bin/rvm-exec $(~/.rvm/bin/rvm current) 1&gt;/dev/null erb -xT - {file_name} | ~/.rvm/bin/rvm-auto-ruby -c", "ruby_verify_command": "~/.rvm/bin/rvm-auto-ruby -c {file_name}", "run_ruby_unit_command": "~/.rvm/bin/rvm-auto-ruby -Itest {relative_path}", "run_single_ruby_unit_command": "~/.rvm/bin/rvm-auto-ruby -Itest {relative_path} -n '{test_name}'", "run_cucumber_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/cucumber {relative_path}", "run_single_cucumber_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/cucumber {relative_path} -l{line_number}", "run_rspec_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/rspec {relative_path}", "run_single_rspec_command": "~/.rvm/bin/rvm-auto-ruby $(~/.rvm/bin/rvm gemdir | sed -e 's/@.*//' -e 's/$/@global/' )/bin/rspec {relative_path} -l{line_number}", "ruby_unit_folder": "test", "ruby_cucumber_folder": "features", "ruby_rspec_folder": "spec", "ruby_use_scratch" : false, "save_on_run": false, "ignored_directories": [".git", "vendor", "tmp"], "hide_panel": false, "before_callback": "", "after_callback": "" } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload