Loading ...
Sorry, an error occurred while loading the content.

rubypath empty, can't require gems

Expand Messages
  • Dave Burns
    Okay embarrassing question. I just downloaded a gem and installed it, but I am not able to load/require it. Anyone know how to set up the rubypath in fedora? I
    Message 1 of 5 , Apr 7 6:30 PM
    View Source
    • 0 Attachment
      Okay embarrassing question. I just downloaded a gem and installed it,
      but I am not able to load/require it. Anyone know how to set up the
      rubypath in fedora? I found the location of the gem itself, but
      there's a lot of structure to it and it doesn't seem obvious what
      directory goes into the rubypath, or at least none of my guesses have
      worked.

      Mahalo in advance.
      Dave

      [root@linoleum ~]# cat hello.rb
      #!/usr/bin/ruby
      # This code is demo/hello.rb
      require "pdf/writer"
      pdf = PDF::Writer.new
      pdf.select_font "Times-Roman"
      pdf.text "Hello, Ruby.", :font_size => 72, :justification => :center
      File.open("hello.pdf", "wb") { |f| f.write pdf.render }

      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
      [root@linoleum ~]# echo "$RUBYPATH"
      /usr/lib/ruby/gems/1.8/gems
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/
      actionmailer-1.2.5/ activerecord-1.14.4/ daemons-1.0.3/
      mongrel-0.2.0/ mysql-2.6/
      pdf-writer-1.1.3/ Ridiculous-0.3/ sources-0.0.1/
      actionpack-1.12.5/ activesupport-1.3.1/ gem_plugin-0.2.1/
      mongrel-0.3.13.4/ mysql-2.7/
      rails-1.1.6/ Ridiculous-0.5/
      transaction-simple-1.4.0/
      actionwebservice-1.1.6/ color-tools-1.3.0/ hoe-1.2.0/
      mysql-2.5.1/ mysql-2.7.1-mswin32/ rake-0.7.1/
      rubyforge-0.4.1/
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/
      bin/ ChangeLog demo/ images/ lib/ LICENCE
      manual.pwd README
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]#
      RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/
      charts/ charts.rb math.rb quickref.rb
      simpletable.rb techbook.rb writer/ writer.rb
      [root@linoleum ~]#
      RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
      writer/ writer.rb
      [root@linoleum ~]#
      RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
      [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
      [root@linoleum ~]# ./hello.rb
      ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
      from ./hello.rb:3
    • Andy Triboletti
      Hi Dave, try putting the line require rubygems before require pdf/writer Andy
      Message 2 of 5 , Apr 7 6:54 PM
      View Source
      • 0 Attachment
        Hi Dave, try putting the line

        require 'rubygems'

        before require "pdf/writer"

        Andy

        On 4/7/07, Dave Burns <tdbtdb@...> wrote:

        Okay embarrassing question. I just downloaded a gem and installed it,
        but I am not able to load/require it. Anyone know how to set up the
        rubypath in fedora? I found the location of the gem itself, but
        there's a lot of structure to it and it doesn't seem obvious what
        directory goes into the rubypath, or at least none of my guesses have
        worked.

        Mahalo in advance.
        Dave

        [root@linoleum ~]# cat hello.rb
        #!/usr/bin/ruby
        # This code is demo/hello.rb
        require "pdf/writer"
        pdf = PDF::Writer.new
        pdf.select_font "Times-Roman"
        pdf.text "Hello, Ruby.", :font_size => 72, :justification => :center
        File.open("hello.pdf", "wb") { |f| f.write pdf.render }

        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
        [root@linoleum ~]# echo "$RUBYPATH"
        /usr/lib/ruby/gems/1.8/gems
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/
        actionmailer-1.2.5/ activerecord-1.14.4/ daemons-1.0.3/
        mongrel-0.2.0/ mysql-2.6/
        pdf-writer-1.1.3/ Ridiculous-0.3/ sources-0.0.1/
        actionpack-1.12.5/ activesupport-1.3.1/ gem_plugin-0.2.1/
        mongrel-0.3.13.4/ mysql-2.7/
        rails-1.1.6/ Ridiculous-0.5/
        transaction-simple-1.4.0/
        actionwebservice-1.1.6/ color-tools-1.3.0/ hoe-1.2.0/
        mysql-2.5.1/ mysql-2.7.1-mswin32/ rake-0.7.1/
        rubyforge-0.4.1/
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/
        bin/ ChangeLog demo/ images/ lib/ LICENCE
        manual.pwd README
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]#
        RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/
        charts/ charts.rb math.rb quickref.rb
        simpletable.rb techbook.rb writer/ writer.rb
        [root@linoleum ~]#
        RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
        writer/ writer.rb
        [root@linoleum ~]#
        RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3
        [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
        [root@linoleum ~]# ./hello.rb
        ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
        from ./hello.rb:3


      • davidjburger
        When working with gems try: require rubygems before your other gem requires. djb ... (LoadError) ... (LoadError) ... (LoadError) ... (LoadError) ...
        Message 3 of 5 , Apr 8 3:28 PM
        View Source
        • 0 Attachment
          When working with gems try:

          require 'rubygems'

          before your other gem requires.

          djb

          --- In honolulu-coders@yahoogroups.com, "Dave Burns" <tdbtdb@...> wrote:
          >
          > Okay embarrassing question. I just downloaded a gem and installed it,
          > but I am not able to load/require it. Anyone know how to set up the
          > rubypath in fedora? I found the location of the gem itself, but
          > there's a lot of structure to it and it doesn't seem obvious what
          > directory goes into the rubypath, or at least none of my guesses have
          > worked.
          >
          > Mahalo in advance.
          > Dave
          >
          > [root@linoleum ~]# cat hello.rb
          > #!/usr/bin/ruby
          > # This code is demo/hello.rb
          > require "pdf/writer"
          > pdf = PDF::Writer.new
          > pdf.select_font "Times-Roman"
          > pdf.text "Hello, Ruby.", :font_size => 72, :justification => :center
          > File.open("hello.pdf", "wb") { |f| f.write pdf.render }
          >
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
          > [root@linoleum ~]# echo "$RUBYPATH"
          > /usr/lib/ruby/gems/1.8/gems
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/
          > actionmailer-1.2.5/ activerecord-1.14.4/ daemons-1.0.3/
          > mongrel-0.2.0/ mysql-2.6/
          > pdf-writer-1.1.3/ Ridiculous-0.3/ sources-0.0.1/
          > actionpack-1.12.5/ activesupport-1.3.1/ gem_plugin-0.2.1/
          > mongrel-0.3.13.4/ mysql-2.7/
          > rails-1.1.6/ Ridiculous-0.5/
          > transaction-simple-1.4.0/
          > actionwebservice-1.1.6/ color-tools-1.3.0/ hoe-1.2.0/
          > mysql-2.5.1/ mysql-2.7.1-mswin32/ rake-0.7.1/
          > rubyforge-0.4.1/
          > [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]#
          RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/
          > bin/ ChangeLog demo/ images/ lib/ LICENCE
          > manual.pwd README
          > [root@linoleum ~]#
          RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]#
          > RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/
          > charts/ charts.rb math.rb quickref.rb
          > simpletable.rb techbook.rb writer/ writer.rb
          > [root@linoleum ~]#
          > RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
          > writer/ writer.rb
          > [root@linoleum ~]#
          > RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]#
          RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          > [root@linoleum ~]#
          RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
          > [root@linoleum ~]# ./hello.rb
          > ./hello.rb:3:in `require': no such file to load -- pdf/writer
          (LoadError)
          > from ./hello.rb:3
          >
        • Dave Burns
          Thanks for the pointers, guys. Just curious, if requiring rubygems is, well, required, why have I run across several demo programs that leave that out? Is
          Message 4 of 5 , Apr 9 12:17 PM
          View Source
          • 0 Attachment
            Thanks for the pointers, guys.

            Just curious, if requiring rubygems is, well, required, why have I run across several demo programs that leave that out? Is there a way to make it unnecessary? More specifically, I've been playing with gems for mysql and PDF, both had simple demo/"hello world" programs that had no 'require "rubygems"' line in them. Both now run after modification thanks to your help, but why would people leave necessary code out of a simple demo? Just messing with the newbies?

            Dave

            On 4/7/07, Andy Triboletti <andy.triboletti@...> wrote:
            Hi Dave, try putting the line

            require 'rubygems'

            before require "pdf/writer"

            Andy

            On 4/7/07, Dave Burns < tdbtdb@...> wrote:

            Okay embarrassing question. I just downloaded a gem and installed it,
            but I am not able to load/require it. Anyone know how to set up the
            rubypath in fedora? I found the location of the gem itself, but
            there's a lot of structure to it and it doesn't seem obvious what
            directory goes into the rubypath, or at least none of my guesses have
            worked.

            Mahalo in advance.
            Dave

            [root@linoleum ~]# cat hello.rb
            #!/usr/bin/ruby
            # This code is demo/hello.rb
            require "pdf/writer"
            pdf = PDF::Writer.new
            pdf.select_font "Times-Roman"
            pdf.text "Hello, Ruby.", :font_size => 72, :justification => :center
            File.open("hello.pdf", "wb") { |f| f.write pdf.render }

            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
            [root@linoleum ~]# echo "$RUBYPATH"
            /usr/lib/ruby/gems/1.8/gems
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/
            actionmailer-1.2.5/ activerecord-1.14.4/ daemons-1.0.3/
            mongrel-0.2.0/ mysql-2.6/
            pdf-writer-1.1.3/ Ridiculous-0.3/ sources-0.0.1/
            actionpack-1.12.5/ activesupport-1.3.1/ gem_plugin-0.2.1/
            mongrel-0.3.13.4/ mysql-2.7/
            rails-1.1.6/ Ridiculous-0.5/
            transaction-simple-1.4.0/
            actionwebservice-1.1.6/ color-tools-1.3.0/ hoe-1.2.0/
            mysql-2.5.1/ mysql-2.7.1-mswin32/ rake-0.7.1/
            rubyforge-0.4.1/
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/
            bin/ ChangeLog demo/ images/ lib/ LICENCE
            manual.pwd README
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]#
            RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/
            charts/ charts.rb math.rb quickref.rb
            simpletable.rb techbook.rb writer/ writer.rb
            [root@linoleum ~]#
            RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
            writer/ writer.rb
            [root@linoleum ~]#
            RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3
            [root@linoleum ~]# RUBYPATH=/usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib
            [root@linoleum ~]# ./hello.rb
            ./hello.rb:3:in `require': no such file to load -- pdf/writer (LoadError)
            from ./hello.rb:3



          • dysinger
            It depends on if the ruby library was installed with rubygems or not. On some systems you may have a ruby library installed on it s own. Linux is like this.
            Message 5 of 5 , Apr 9 12:48 PM
            View Source
            • 0 Attachment
              It depends on if the ruby library was installed with rubygems or not.
              On some systems you may have a ruby library installed on it's own.
              Linux is like this. You can, for example, install MySQL support for
              ruby without installing rubygems on Ubuntu Linux using the package
              manager. In this case, you would not need the require 'rubygems'
              business at the top.

              --- In honolulu-coders@yahoogroups.com, "Dave Burns" <tdbtdb@...> wrote:
              >
              > Thanks for the pointers, guys.
              >
              > Just curious, if requiring rubygems is, well, required, why have I run
              > across several demo programs that leave that out? Is there a way to
              make it
              > unnecessary? More specifically, I've been playing with gems for
              mysql and
              > PDF, both had simple demo/"hello world" programs that had no 'require
              > "rubygems"' line in them. Both now run after modification thanks to your
              > help, but why would people leave necessary code out of a simple
              demo? Just
              > messing with the newbies?
              >
              > Dave
            Your message has been successfully submitted and would be delivered to recipients shortly.