Ruby environments: Difference between revisions
From wikinotes
No edit summary |
|||
Line 31: | Line 31: | ||
= module paths = | = module paths = | ||
<blockquote> | <blockquote> | ||
<source lang="ruby"> | |||
env RUBYLIB=/some/dir ruby # set $LOAD_PATH from outside ruby | |||
</source> | |||
<syntaxhighlight lang="ruby"> | <syntaxhighlight lang="ruby"> | ||
p $LOAD_PATH # all directories ruby modules will be loaded from | p $LOAD_PATH # all directories ruby modules will be loaded from |
Latest revision as of 16:25, 9 January 2023
Describe and build environments to run ruby code.
ruby version
ruby chruby ruby rbenv mkdir myproject && cd myproject echo 2.6.5 > .ruby-version # set 'chruby' ruby version bundle init # create Gemfile bundle install --path .gems # install gems to '.gems' (and remember for future)
environments
ruby bundler nix ruby
module paths
env RUBYLIB=/some/dir ruby # set $LOAD_PATH from outside rubyp $LOAD_PATH # all directories ruby modules will be loaded from # list all files by $LOAD_PATH directory $LOAD_PATH.each do |dir| children = []; children = Dir.children(dir) if Dir.exist?(dir); p "=" * dir.length p dir p "=" * dir.length children.each { |child| p child } end