2

Mac OS 10.7.5 で rvm と ruby​​ 1.9.3 を使用しています。

Sublime Text 2 RubyTest パッケージを使用して Ruby 構文を検証できるようにしたいと考えています。

ただし、Tools -> RubyTest -> Verify Ruby Syntax任意の Ruby ファイル (test.rb以下) で実行しようとすると、RubyTest コンソールに次のエラーが表示されます。

/Users/jladieu/.rvm/rubies/ruby-1.9.3-p194/bin/ruby:1: 無効なマルチバイト文字 (US-ASCII)

私のtest.rbファイルの内容は非常に単純です:

class Test
  def hello
    puts "Hello world"
  end
end

私のRubyTest.sublime_settingsファイルは次のとおりです。

{
  "erb_verify_command": "erb -xT - {file_name} | ruby -c",
  "ruby_verify_command": "ruby -c {file_name}",

  "run_ruby_unit_command": "bundle exec ruby -Itest {relative_path}",
  "run_single_ruby_unit_command": "bundle exec ruby -Itest {relative_path} -n '{test_name}'",

  "run_cucumber_command": "zeus cucumber {relative_path} --no-color",
  "run_single_cucumber_command": "zeus cucumber {relative_path}:{line_number} --no-color",

  "run_rspec_command": "zeus rspec {relative_path}",
  "run_single_rspec_command": "zeus rspec {relative_path}:{line_number}",

  "ruby_unit_folder": "test",
  "ruby_cucumber_folder": "features",
  "ruby_rspec_folder": "spec",

  "check_for_rbenv": false,
  "check_for_rvm": true,

  "ruby_use_scratch" : false,
  "save_on_run": true,
  "ignored_directories": [".git", "vendor", "tmp"],

  "hide_panel": false,

  "before_callback": "",
  "after_callback": ""
}

コマンドラインで次のコマンドを実行すると、構文が検証されます。

$ ruby -c test.rb 
  Syntax OK

最後に、US-ASCII の問題を修正するためにいくつかの方法を試しましたが、役に立ちませんでした。

  • -kuRubyTest 設定の verify コマンドにフラグを追加する
  • export RUBYOPT=-Ku.bash_profile崇高なオープニングの前に
  • export LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8Sublimeを開く前に私のbashプロファイルで

同様の設定を使用してこれを機能させることができる人はいますか?

注:答えが見つかりました(以下を参照)が、誰かがより良い解決策を見つけたら興味があります、ありがとう!

4

1 に答える 1