Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created November 23, 2011 19:48
Show Gist options
  • Save Nitrodist/1389702 to your computer and use it in GitHub Desktop.
Save Nitrodist/1389702 to your computer and use it in GitHub Desktop.
mark@linux-qmbm ~/rubyapps/rails (master)$ grep -r -i 'rbconfig' * | grep -v 'host_os' | grep -v 'require' | sort
actionmailer/Rakefile: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
actionpack/test/ts_isolated.rb: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activemodel/Rakefile: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activerecord/Rakefile: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activeresource/Rakefile: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
activesupport/test/isolation_test.rb: OUTPUT = `#{RbConfig::CONFIG["bindir"]}/#{RbConfig::CONFIG["ruby_install_name"]} -I#{File.dirname(__FILE__)} "#{File.expand_path(__FILE__)}" -v`
activesupport/test/ts_isolated.rb: ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
railties/guides/source/initialization.textile: RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
railties/guides/source/initialization.textile:The next two files after this are Ruby standard library files: +pathname+ and +rbconfig+. The file after these is +rails/engine/railties+.
railties/guides/source/initialization.textile:The +rails/script_rails_loader+ file uses +RbConfig::Config+ to gather up the +bin_dir+ and +ruby_install_name+ values for the configuration which will result in a path such as +/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby+, which is the default path on Mac OS X. If you're running Windows the path may be something such as +C:/Ruby192/bin/ruby+. Anyway, the path on your system may be different, but the point of this is that it will point at the known ruby executable location for your install. The +RbConfig::CONFIG["EXEEXT"]+ will suffix this path with ".exe" if the script is running on Windows. This constant is used later on in +exec_script_rails!+. As for the +SCRIPT_RAILS+ constant, we'll see that when we get to the +in_rails_application?+ method.
railties/guides/source/initialization.textile:The +rbconfig+ file here is out of Ruby's standard library and provides us with the +RbConfig+ class which contains useful information dependent on how Ruby was compiled. We'll see this in use in +railties/lib/rails/script_rails_loader+.
railties/lib/rails/script_rails_loader.rb: RUBY = File.join(*RbConfig::CONFIG.values_at("bindir", "ruby_install_name")) + RbConfig::CONFIG["EXEEXT"]
mark@linux-qmbm ~/rubyapps/rails (master)$ grep -r -i 'rbconfig' * | grep 'host_os' | sort
actionpack/test/controller/layout_test.rb:unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
activesupport/lib/active_support/core_ext/kernel/reporting.rb: stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
activesupport/lib/active_support/testing/isolation.rb: !ENV["NO_FORK"] && ((RbConfig::CONFIG['host_os'] !~ /mswin|mingw/) && (RUBY_PLATFORM !~ /java/))
railties/lib/rails/commands/dbconsole.rb: commands += commands.map{|cmd| "#{cmd}.exe"} if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
railties/lib/rails/commands/runner.rb: if RbConfig::CONFIG['host_os'] !~ /mswin|mingw/
railties/lib/rails/engine.rb: RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ?
railties/lib/rails/generators/actions.rb: if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
railties/lib/rails/generators/actions.rb: sudo = options[:sudo] && RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : ''
railties/lib/rails/generators/rails/app/app_generator.rb: ].find { |f| File.exist?(f) } unless RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
railties/lib/rails/test_unit/testing.rake: STDERR.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
mark@linux-qmbm ~/rubyapps/rails (master)$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment