BARRIER - require "rubygems"

Discussion in 'Ruby' started by Ilias Lazaridis, Jun 9, 2011.

  1. ruby 1.9.2p180 Windows 7

    Rubygems is included in ruby 1.9.

    Because it's included, I expect that it will work out-of-the-box,
    without the need to use

    ruby -rubygems myscript.rb

    and especially not

    require "rubygems"

    within *.rb files

    -

    The default-library-system which is included in the language, should
    be *enabled* by default, thus a user can simply click on the files and
    they start correctly, without the (logically false) need to have
    "require librarysystem" within the files.

    What step do I have to take, in order to activate rubygems as the
    default library system (thus I can start .rb files without having to
    require rubygems)?

    ..
     
    Ilias Lazaridis, Jun 9, 2011
    #1
    1. Advertisements

  2. Or you could try using the well documented RUBYOPT shell variable to
    set the value RUBYOPT=rubygems

    The only barrier here is that you didn't read the rubygems user guide
    which is available on the internet. It even explains how to do this on
    windows if you should be do hampered.
     
    Peter Hickman, Jun 9, 2011
    #2
    1. Advertisements

  3. Ilias Lazaridis

    Walton Hoops Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    C:\Users\walton.hoops\repos>ruby --version
    ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

    C:\Users\walton.hoops\repos>irb
    irb(main):001:0> require 'sinatra'
    => true
    irb(main):002:0>

    Works for me. Does it not for you? If not can you give us some more
    information, such as a simple demo that reproduces the issue?
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (MingW32)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQEcBAEBAgAGBQJN8SAWAAoJELvwGgGC0Isy0icIAJAXWanWpPKwfpwzeYw+j5vG
    /80kMMQOZc2MAxHAEy+OnPVw8rzkvxx2uiw9eHcIeLkLUNUAp7ABGO9AkudWItvW
    +CZUBxBeRNov6UhNY2+wKdJU3TpyMd+6OdjEidCnyEpqrks6f0kSPr7gefXtHc2X
    UFfQLuSJuMjUNim6vI9lPv6Q+FIectpNTTzE+N6tAk5pxU4VwXjBVBUpmRG6s/iN
    7BesAMavuDeEaCrODPu7axUgGhkv+St6q9OdXWlRFZZdwYkt78m+aaMiO0Qha15K
    pmUfubOtPf6SVOLRtBCoDhfsf5XXrRptvMl0IbaTBWNh/tk8MhMHVGmciCu6oh8=
    =4B/T
    -----END PGP SIGNATURE-----
     
    Walton Hoops, Jun 9, 2011
    #3
  4. same version here.
    It works.

    And in my file, I've removed "require 'rubygems' " now, and it works,
    too (to my surprise).

    But I'm sure it did not. After I installed via the "one-click-
    installer", I had to use "require 'rubygems' " in order to make it
    work.

    I've now uninstalled everything including the gems, and reinstalled:

    It works again.

    I can't recreate it on this machine anymore.
    It was really not much more than:

    require 'rubygems' #add this, thus files can be started with double-
    click on windows-explorer
    require 'sinatra'
    require 'json'

    #some code to test rest & json

    ..
     
    Ilias Lazaridis, Jun 10, 2011
    #4
  5. Ilias Lazaridis

    Luis Lavena Guest

    There is no such thing as One-Click Installer, is RubyInstaller

    Ruby 1.9.1 and 1.9.2 remove the need for require "rubygems"

    If you can't replicate it, then it didn't happen.
    Has nothing to do with your machine, it works since long time ago, we
    worked really hard to ensure that was for everybody.
    Please note that you mentioned "One-Click Installer" but also
    mentioned 1.9.2

    RubyInstaller do not associate with .rb and .rbw files by default, you
    need to check these options.

    If you had a previous "One-Click Installer" (1.8.6 or older) and that
    was associated with .rb files, that could explain why you needed
    require "rubygems".
     
    Luis Lavena, Jun 10, 2011
    #5
  6. Confirmed, RubyInstaller
    It happened, just don't know the cause.
    I see, possibly this should be enabled by default (a knowledgeable
    user will take action and disable if he needs so)
    There is a possibility that this was the case.

    One other possible influence could be the Kommodo IDE.

    Anyway, if you say that this is a solved issue, than I consider it
    closed.

    btw:

    Thank you for this RubyInstaller, makes things very easy.

    ..
     
    Ilias Lazaridis, Jun 10, 2011
    #6
  7. Ilias Lazaridis

    Walton Hoops Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    That would be my guess as well. If you installed 1.8.6 from the (now
    discontinued) one click installer, and later installed 1.9.2 via Ruby
    Installer, by default it didn't associate the *.rb files with the new
    installation, so when you ran from the command line you were using 1.9.2
    as intended, but double clicking the file ran it on 1.8.6.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (MingW32)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQEcBAEBAgAGBQJN8lExAAoJELvwGgGC0IsyCywH/37DoakVro2Yd2msF6b2a2L1
    a+tnnPVcNXemV74gtwo9uVlPfLJ8mUNdopgfYLg+kdIBC6xpxcIUYy/iCb/wm+C+
    Qn8zaC+R7RGmVCw/9Pw5tYJ4E/GXPCb/jdnW0NORMrDqUHeoai8cXfI8HY9wPK8F
    N5RwVCY+eWboH1DnJ6GFIm5ECZg565gjBEuz2APH1bVuOc9sUW74I8ynWx1G0Jha
    L46c9FEfFCmJy5muknZ+Hcs08newoYUAIELt/4W2yRtxtRxrAfUFfXBdtJ/5POdk
    dseOEm/Q3o6p2SePjkAuQb59g2/5ZtLGfVZ1daIH6bBevaUiGeR4YGen7gVf7o8=
    =E18s
    -----END PGP SIGNATURE-----
     
    Walton Hoops, Jun 10, 2011
    #7
  8. Ilias Lazaridis

    Luis Lavena Guest

    Defaults like file associations and editors are very subjective.

    This is how RubyInstaller stand about that:

    https://github.com/oneclick/rubyinstaller/wiki/FAQ#bundled_scite
    http://groups.google.com/group/rubyinstaller/msg/34dd829ebe0e4567

    Want it different, build your installer and name it IlliasInstaller.

    Something more constructive than that is what RailsInstaller project
    did.
     
    Luis Lavena, Jun 11, 2011
    #8
  9. [...] - (expanding issue, getting personal)

    No need to get personal or to extend the issue, it's very simple:

    The fundamental user expectation is that it works out-of-the-box,
    without any intervention.

    And this is the major requirement to an installer.

    Usually there is a choice, something like:

    [X] Default Installation
    [ ] Custom Installation

    "Default Installation" does not mean "I don't touch anything".

    It means "I take the necessary actions to make the product running on
    this machine".

    If a user wants to have more control over the installation, he selects
    "Custom installation".

    ..
     
    Ilias Lazaridis, Jun 11, 2011
    #9
  10. Ilias Lazaridis

    Luis Lavena Guest

    Oh, you mean magical, like an automated install? Or probably you mean
    unattended installation, that is when there is no user intervention.

    The fundamentals are: when I install something, I don't want it mess
    with my existing stuff.

    If you actually install stuff on Windows, you will know how counter
    productive is when you install something to try out and it changes all
    your defaults.
    What this does is hide the actions in two obscure items that newcomers
    will not know what it means. Default installation doesn't say
    anything, Neither does custom.

    Right now the installers show in one single screen all your options,
    which if users actually READ will be able to get what they want from
    the installation.
     
    Luis Lavena, Jun 11, 2011
    #10
  11. [...] - (ha! )

    You have to increase your precision in order to mimic my writing
    style.

    Back to topic: please ask some product manager that you trust about
    the basic installer requirement that I've mentioned (it's not my
    requirement, but a general one).

    ..
     
    Ilias Lazaridis, Jun 11, 2011
    #11
  12. Maybe if you took the time out of being a thoroughly abrasive
    individual, you would have actually read the rubyinstall web page and
    found the link to request a bug/feature. Developers are not at your beck
    and call.
     
    Matt Harrison, Jun 11, 2011
    #12
  13. Here is a quote from Microsoft's UX design guidelines:
    "Don't force users to opt out of installing optional features. Allow
    them to opt in instead. For example, users should explicitly choose to
    install a Windows Desktop Gadget."

    Source: http://msdn.microsoft.com/en-us/library/ee915058.aspx

    --=20
    Phillip Gawlowski

    A method of solution is perfect if we can forsee from the start,
    and even prove, that following that method we shall attain our aim.
    =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Leibnitz
     
    Phillip Gawlowski, Jun 11, 2011
    #13
  14. This subjects "optional features".

    The basic requirement I've mentioned subjects "necessary setup actions
    to make product operative".

    ..

    http://lazaridis.com
     
    Ilias Lazaridis, Jun 11, 2011
    #14
  15. I hope you feel better now.

    ..
     
    Ilias Lazaridis, Jun 11, 2011
    #15
  16. So, the RubyInstaller doesn't actually install Ruby and its
    dependencies? That's *all* that a setup package is required to do.
    File association and path changing are very much optional, since Ruby
    will work without those.

    --=20
    Phillip Gawlowski

    A method of solution is perfect if we can forsee from the start,
    and even prove, that following that method we shall attain our aim.
    =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Leibnitz
     
    Phillip Gawlowski, Jun 11, 2011
    #16

  17. Ruby is operative without file associations to .rb/.rbw files. While
    setting file associations is a sensible default for lots of software,
    the usual use case of RubyInstaller is such that it is not clearly one
    of the cases where file associations by default make sense; so the
    safer choice is to minimize disruption by not setting them.
     
    Christopher Dicely, Jun 12, 2011
    #17
  18. Verification:

    * Install with the defaults (just "click through")
    * Go to the command line, and start ruby (type "ruby" then [ENTER]
    * Go to the explorer and create this file "test.rb" with content "puts
    'hi'", double click this file

    Both will not work.

    ..
     
    Ilias Lazaridis, Jun 12, 2011
    #18
  19. http://tvtropes.org/pmwiki/pmwiki.php/Main/CaptainObvious

    --=20
    Phillip Gawlowski

    A method of solution is perfect if we can forsee from the start,
    and even prove, that following that method we shall attain our aim.
    =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Leibnitz
     
    Phillip Gawlowski, Jun 12, 2011
    #19
  20. Of course it's obvious, and as an (obvious) conclusion you previous
    statement becomes false.

    "File association and path changing are very much optional, since
    Ruby
    will work without those. "

    But what becomes even more obvious is, that I'm loosing my time with
    you.

    I'm sure that the relevant people will realize that in context
    "newcomer", both options should be enabled by default.

    Topic closed.

    ..
     
    Ilias Lazaridis, Jun 12, 2011
    #20
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.