Created
April 14, 2010 19:32
-
-
Save netzpirat/366219 to your computer and use it in GitHub Desktop.
Minimal Rails 3 support for RubyMine: Creates the old Rails 2 scripts that simply executes Rails 3 'rails' command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Forget this gist! EAP with Rails 3 support is available: http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+EAP
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works for me. Thanks!