How to run Ruby Gem through Sublime Text 2 Build System?

I tried different settings, just:

{ "cmd": "rubocop '$file_name'" } 

I also tried to set the path etc:

 { "cmd": "rubocop '$file_name'", "path": "~/.rvm/bin", "selector": "source.rb", "working_dir":"$project_path" } 

For both, I get an error message in the lines:

 [Errno 2] No such file or directory [cmd: rubocop 'configurer.rb'] [dir: /home/rafal/Documents/Projects/configurer] [path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games] [Finished] 

and

 [Errno 2] No such file or directory [cmd: rubocop 'configurer.rb'] [dir: /home/rafal/Documents/Projects/configurer] [path: ~/.rvm/bin] [Finished] 

respectively. I followed some tutorials I found on the Internet, as well as some answers here on StackOverflow, but no luck. Any ideas on why this is happening? What is the correct and efficient way to run Ruby Gem in an open file? Gem Rubocop is definitely installed.

+8
ruby sublimetext2 gem
source share
1 answer

I created a custom assembly on SublimeText2 using

 { "env": { "PATH":"${HOME}/.rvm/bin:${PATH}" }, "cmd": ["rvm-auto-ruby", "-S", "bundle", "exec", "rubocop -n ${file}" ], "selector": "source.ruby" } 

Note that the -n rubocop option was introduced 5 days ago in the repo (after release 0.6.1), so it probably won't work if you don't use rubocop from git repo . Until 0.6.2 is released, strange characters will be displayed on the output, but at least it will work.

+4
source share

All Articles