I have a script with the first line as follows: $:.unshift(File.dirname(__FILE__) + ''/../lib'') This must mean something nasty to Google, because I can''t seem to get anything useful if I include it in a search string, even quoted. Ditto stackoverflow and rubytips. Having this line at the beginning of this script seems to treat the require <gem name> statements that follow it differently than a normal require would, or at least I am not getting the same errors as I do when I require the gems without this line. What does it do? Thanks, Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 10 February 2011 15:21, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> I have a script with the first line as follows: > > $:.unshift(File.dirname(__FILE__) + ''/../lib'') >My Google-fu is strong today: http://blog.purifyapp.com/2010/01/04/cryptic-ruby-global-variables-and-their-meanings/ -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yeah, Google doesn''t care for punctuation of any kind really. $. is used to denote the load path for Ruby libraries, so the line that you have there is to prepend the lib/ directory, which is a peer to the directory your script is in, to the front of the load path. FYI, it''s aliased as $LOAD_PATH in case you want to change it for better clarity. On Thu, Feb 10, 2011 at 4:21 PM, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org>wrote:> I have a script with the first line as follows: > > $:.unshift(File.dirname(__FILE__) + ''/../lib'') > > This must mean something nasty to Google, because I can''t seem to get > anything useful if I include it in a search string, even quoted. Ditto > stackoverflow and rubytips. > > Having this line at the beginning of this script seems to treat the require > <gem name> statements that follow it differently than a normal require > would, or at least I am not getting the same errors as I do when I require > the gems without this line. > > What does it do? > > Thanks, > > Walter > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Lee Davis
2011-Feb-10 15:51 UTC
Re: What does $: point to in a ruby (shell) script?
Thanks very much to you and Chris! Walter On Feb 10, 2011, at 10:31 AM, Michael Pavling wrote:> On 10 February 2011 15:21, Walter Lee Davis <waltd-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> > wrote: >> I have a script with the first line as follows: >> >> $:.unshift(File.dirname(__FILE__) + ''/../lib'') >> > > My Google-fu is strong today: > http://blog.purifyapp.com/2010/01/04/cryptic-ruby-global-variables-and-their-meanings/ > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.