Ruby Bootstrap

Hi people

Where does Ruby get its initial $LOAD_PATH?

Where is its startup file? ie. what script loads these:

$LOADED_FEATURES
=> [“e2mmap.rb”, “irb/init.rb”, “irb/workspace.rb”, “irb/context.rb”,
“irb/extend-command.rb”, “irb/output-method.rb”, “irb/notifier.rb”,
“irb/slex.rb”, “irb/ruby-token.rb”, “irb/ruby-lex.rb”, “readline.so”,
“irb/input-method.rb”, “irb/locale.rb”, “irb.rb”, “irb/completion.rb”, "
rbconfig.rb", “rubygems/rubygems_version.rb”, “thread.rb”,
“rbconfig/datadir.rb”, “rubygems/user_interaction.rb”, “socket.so”, "
timeout.rb", “net/protocol.rb”, “uri/common.rb”, “uri/generic.rb”,
“uri/ftp.rb”, “uri/http.rb”, “uri/https.rb”, “uri/ldap.rb”,
“uri/mailto.rb”,
“uri.rb”, “net/http.rb”, “stringio.so”, “yaml/error.rb”, “syck.so”,
“yaml/ypath.rb”, “yaml/basenode.rb”, “yaml/syck.rb”, “yaml/tag.rb”,
“yaml/stream.rb”, “yaml/constants.rb”, “rational.rb”, “date/format.rb”,
"
date.rb", “yaml/rubytypes.rb”, “yaml/types.rb”, “yaml.rb”, “zlib.so”,
“rubygems/remote_fetcher.rb”, “digest.so”, “digest/sha2.so”,
“rubygems/digest/digest_adapter.rb”, “rubygems/digest/sha2.rb”, "
forwardable.rb", “parsedate.rb”, “time.rb”, “rubygems/source_index.rb”,
“rubygems/version.rb”, “rubygems/specification.rb”, “openssl.so”,
“openssl/bn.rb”, “openssl/cipher.rb”, “openssl/digest.rb”,
“openssl/buffering.rb”, “fcntl.so”, “openssl/ssl.rb”, “openssl/x509.rb”,
"
openssl.rb", “rubygems/gem_openssl.rb”, “rubygems/security.rb”,
“rubygems/custom_require.rb”, “rubygems.rb”, “ostruct.rb”, “wirble.rb”,
"
prettyprint.rb", “pp.rb”]

Thanks,
Les

Hi –

On Tue, 29 May 2007, Leslie V. wrote:

Hi people

Where does Ruby get its initial $LOAD_PATH?

I believe it’s compiled into the Ruby executable.

Where is its startup file? ie. what script loads these:

$LOADED_FEATURES
=> [“e2mmap.rb”, “irb/init.rb”, “irb/workspace.rb”, “irb/context.rb”,
“irb/extend-command.rb”, “irb/output-method.rb”, “irb/notifier.rb”,
“irb/slex.rb”, “irb/ruby-token.rb”, “irb/ruby-lex.rb”, “readline.so”,

$LOADED_FEATURES gets added to dynamically as you require/load things
at runtime.

David

On Tue, May 29, 2007 at 05:38:20PM +0900, Leslie V. wrote:

Where is its startup file? ie. what script loads these:

$LOADED_FEATURES

Whatever you typed to get the “>>” prompt.

“yaml/stream.rb”, “yaml/constants.rb”, “rational.rb”, “date/format.rb”, "
date.rb", “yaml/rubytypes.rb”, “yaml/types.rb”, “yaml.rb”, “zlib.so”,
“rubygems/remote_fetcher.rb”, “digest.so”, “digest/sha2.so”,
“rubygems/digest/digest_adapter.rb”, “rubygems/digest/sha2.rb”, "
forwardable.rb", “parsedate.rb”, “time.rb”, “rubygems/source_index.rb”,
“rubygems/version.rb”, “rubygems/specification.rb”, “openssl.so”,
“openssl/bn.rb”, “openssl/cipher.rb”, “openssl/digest.rb”,
“openssl/buffering.rb”, “fcntl.so”, “openssl/ssl.rb”, “openssl/x509.rb”, "
openssl.rb", “rubygems/gem_openssl.rb”, “rubygems/security.rb”,
“rubygems/custom_require.rb”, “rubygems.rb”, “ostruct.rb”, “wirble.rb”, "
prettyprint.rb", “pp.rb”]

Looking at this huge list of things, I’m not sure what you ran. It’s not
big
enough to be rails script/console, but is too big to be plain old irb:

$ irb1.8
irb(main):001:0> $LOADED_FEATURES
=> [“irb.rb”, “e2mmap.rb”, “irb/init.rb”, “irb/context.rb”,
“irb/workspace.rb”, “irb/extend-command.rb”, “irb/ruby-lex.rb”,
“irb/slex.rb”, “irb/notifier.rb”, “irb/output-method.rb”,
“irb/ruby-token.rb”, “irb/input-method.rb”, “readline.so”,
“irb/locale.rb”]
irb(main):002:0>

If you try just Ruby by itself, you’ll find nothing is loaded by
default.

$ ruby1.8 -e ‘p $LOADED_FEATURES’
[]

HTH,

Brian.

On 5/29/07, Brian C. [email protected] wrote:

“irb/slex.rb”, “irb/ruby-token.rb”, “irb/ruby-lex.rb”, “readline.so”,
date.rb", “yaml/rubytypes.rb”, “yaml/types.rb”, “yaml.rb”, “zlib.so”,
prettyprint.rb", “pp.rb”]
“irb/ruby-token.rb”, “irb/input-method.rb”, “readline.so”,
“irb/locale.rb”]
irb(main):002:0>

It WAS irb on my Linux system. I have syntax highlighting and tab
completion
turned on though.

If you try just Ruby by itself, you’ll find nothing is loaded by
default.