8

我尝试了不同的设置,例如:

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

我也尝试过设置路径等:

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

对于两者,我都会收到一条错误消息:

[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]

和:

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

分别。我遵循了一些我在网上找到的教程以及 StackOverflow 上的一些答案,但没有运气。关于为什么会发生这种情况的任何想法?在当前打开的文件上运行 Ruby Gem 的正确且有效的方法是什么?Gem Rubocop肯定已安装。

4

1 回答 1

3

我在 SublimeText2 上进行了自定义构建

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

请注意,-nrubocop 选项是5 天前在 repo 中引入的(在 0.6.1 版本之后),因此如果您不使用git repo中的 rubocop ,它可能不起作用。在 0.6.2 发布之前,它会在输出中显示奇怪的字符,但至少它会起作用。

于 2013-05-02T22:34:57.500 回答