-
-
Save netzpirat/366219 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby | |
# | |
# Helper script to temporary fix some RubyMine 2.0.2 functionality by | |
# creating old-style Rails 2 scripts. This enables me actually to | |
# run & debug apps and use the Rails console. | |
# | |
# On my machine I have to increase the debugger timeout to connect to a | |
# Rails 3 app on Ruby 1.9.1. This is done for OS X by modify the Info.plist | |
# to increase the timeout. | |
# | |
# The defaults are '/Applications/RubyMine 2.0.2.app/Contents/Info.plist' | |
# for the plist and 30 for the timeout. You can pass these settings to | |
# the script as parameters: | |
# | |
# ./rubymine.rb /Users/John/Applications/RubyMine 2.0.2.app/Contents/Info.plist 45 | |
# | |
# To use the feature you have to install the 'plist' gem: | |
# | |
# gem install plist | |
# | |
# Optinally you may want also to tweak the memory and parallel garbage collector threads | |
# to increase the RubyMine performance. | |
# | |
require 'FileUtils' | |
# Create Rails 2 style scripts | |
[ 'script/console', | |
'script/dbconsole', | |
'script/destroy', | |
'script/generate', | |
'script/performance/benchmarker', | |
'script/performance/profiler', | |
'script/plugin', | |
'script/runner', | |
'script/server' | |
].each do |script| | |
FileUtils.mkdir_p 'script/performance' | |
File.open(script, 'w') do |file| | |
file.write <<SCRIPT | |
#!/usr/bin/env ruby | |
exec 'script/rails #{ script.split('/').last }' | |
SCRIPT | |
file.chmod(0755) | |
end | |
end | |
# RubyMine configuration tuning | |
if File.exist?('/Applications/RubyMine 2.0.2.app/Contents/Info.plist') | |
begin | |
require 'plist' | |
config = ARGV[0] || '/Applications/RubyMine 2.0.2.app/Contents/Info.plist' | |
info = Plist::parse_xml(config) | |
#info['Java']['VMOptions'] = '-Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseParallelGC -XX:ParallelGCThreads=4 -XX:+UseAdaptiveSizePolicy -Xbootclasspath/a:../lib/boot.jar -ea' | |
info['Java']['Properties']['ruby.debug.timeout'] = ARGV[1] || '30' | |
File.open(config, 'w') {|f| f.write(info.to_plist) } | |
rescue LoadError | |
puts 'Install the \'plist\' gem to increase debugger timeout automatically.' | |
end | |
end |
Seeing an error at the moment (on rev 5393f1): uninitialized constant Plist (NameError)
netzpirat: Thanks a ton for your help with this!
Sorry, I forgot to require plist. This is mainly needed to increase the debugger timeout... Optionally it tunes the garbage collector for RubyMine, but you may have to modify the memory and thread amount to match you dev machine specs.
Now getting: no such file to load -- plist (LoadError)
Is plist a macruby thing?
You have to install the plist gem
Just tried it in Ruby 1.9.1 and it also has the same error
/Users/jc/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/irb.rb:278:in `dup': can't dup NilClass (TypeError)
I cleared out my .irbrc, same error. No idea whats going on. Ah well, was worth a shot. But it looks like RubyMine is still a no-go for me. 2.5 should fix it though
Yep. I also hope we're getting an early EAP to test Rails 3 integration as soon as possible. We're now at Rails Beta 3 and still no support in RubyMine!
Works for me. Thanks!
Forget this gist! EAP with Rails 3 support is available: http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+EAP
Works fine here on Ruby 1.9.1. Is there something special in your ~/.irbrc?