#author("2019-10-07T07:15:23+00:00","default:wikiwriter","wikiwriter")
&tag(IntelliJ/Ruby);
*目次 [#z77291b8]
#contents
*関連ページ [#p7f1723e]
*参考情報 [#h71b155b]


*Tips [#kb526b1d]

**既存プロジェクトをIntelliJで使えるようにする [#y4607760]
-新規プロジェクトを作成し、場所を既存Rubyプロジェクトのフォルダとするだけ。


-gemプロジェクトも同様。ただしデバッグ・実行時、プロジェクト配下にbundle installしたgemファイルは認識されず、Rubyインタプリタ配下にgemファイルをインストールしないとだめかも。
**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が呼び出される)。

**railsのrunnerで実行するスクリプトのデバッグ [#b393c84a]
-Edit Configurationで設定
--Ruby scriptに、プロジェクト/bin/railsをフルパスで指定
--script argumentsに「runner Tasks::CheckTask.execute」のように指定。
--Bundlerの「Run the script...」にチェック。
**引数や戻り値の指定 [#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がリストアップさているか確認

**デバッグしようとするとdebaseがインストールできない(2014/09/26) [#t7527726]
-ruby 2.1.3で発生。コマンドラインでdebaseをインストールしようとするとエラー([[ruby - RubyMine debugger error - Stack Overflow:http://stackoverflow.com/questions/23442463/rubymine-debugger-error]]に従う)。
#pre{{
$ gem install debase
Fetching: debase-0.0.9.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing debase:
	ERROR: Failed to build gem native extension.

}}
-とりあえずruby 2.1.2で凌ぐことにした。

**プロジェクトを開いた際「Ruby Plugin Gem Manager: Ruby plugin has detected that some of the gems required for 'rack-cache-1.2' are not installed.」のようなエラーが表示される [#r491fb78]
-Project Settingsで余計なモジュールが追加されているのが原因かも
-Project Settingsの「Modules」でそのモジュールを削除する。
-「Module groups are used to logically organize project modules」と表示される青いモジュールはノードを開いていき末端を削除する(再起動すると消える)。


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS