&tag(IntelliJ/Ruby); *目次 [#z77291b8] #contents *関連ページ [#p7f1723e] *参考情報 [#h71b155b] *Tips [#kb526b1d] **既存プロジェクトをIntelliJで使えるようにする [#y4607760] -新規プロジェクトを作成し、場所を既存Rubyプロジェクトのフォルダとするだけ。 **bundle exec ruby demo.rbをデバッグする [#bba6f9a9] -Edit Configurationで設定。 --Ruby scriptにdemo.rbのフルパス指定。 --Bundlerの「Run the script...」にチェック。 -[[ruby - Why does "bundle exec" eat the parameters I pass in? - Stack Overflow:http://stackoverflow.com/questions/17460418/why-does-bundle-exec-eat-the-parameters-i-pass-in]]によると、bundle execに渡される引数はそのままシェルに渡される。「bundle exec ruby demo.rb」は「ruby demo.rb」が実行され、「bundle exec demo.rb」は「demo.rb」が実行されることになる(shebangにしたがってrubyが呼び出される)。 **引数や戻り値の指定 [#y1f03d3f] -YARDで指定できる。[[ruby - Can I tell or hint to RubyMine what type a local or instance variable is? - Stack Overflow:http://stackoverflow.com/questions/10769307/can-i-tell-or-hint-to-rubymine-what-type-a-local-or-instance-variable-is]]。ローカル変数を指定する方法はない? **RAILS_ENVを切り替える [#xdd4f90e] -[[Run/Debug Configuration: Cucumber:https://www.jetbrains.com/ruby/webhelp/run-debug-configuration-cucumber.html]] Debug設定でEnvironment VariableにRAILS_ENVを設定する。デフォルトはcucumber。 *トラブルシューティング [#vd0ef7d7] **Rspecが実行できない [#i18c2037] 「Cannot find RSpec runner script for ruby-1.8.7-p352 SDK」といわれる。[[Can't start rspec :: JetBrains Developer Community:http://devnet.jetbrains.com/message/5472178#5472178]]にあるような症状。しかし解決方法は示されていない(インストールしなおしたら動いたとか役に立たない)。 [#q0ba6206] -エラーメッセージからするに、rspecスクリプトがIDEから見つからないのだと思うが、コマンドラインから見つかるにもかかわらずエラーが出て困った。 -試行錯誤したところ,rspecのgemを入れなおしたらうまくいったかも(rspec-coreではない)。 gem install rspec -Project Settingsの、ModulesのGmesタブでrspecがリストアップさているか確認