postmodern / chruby

Changes the current Ruby
MIT License
2.87k stars 189 forks source link

webrick reports using ruby 1.9.3? #341

Closed mustmodify closed 9 years ago

mustmodify commented 9 years ago
jw@logopolis:/projects/mustmodify/cajun_zydeco$ chruby
   rbx-2.5.1
   rbx-2.5.2
   rbx-2.5.7
   rbx-2.5.8
   ruby-1.9.3-p448
   ruby-2.1.3
 * ruby-2.1.6
   ruby-2.2.2

jw@logopolis:/projects/mustmodify/cajun_zydeco$ cat .ruby-version
ruby-2.1.6

jw@logopolis:/projects/mustmodify/cajun_zydeco$ which ruby
/opt/rubies/ruby-2.1.6/bin/ruby

jw@logopolis:/projects/mustmodify/cajun_zydeco$ which rackup
/home/jw/.gem/ruby/2.1.6/bin/rackup

jw@logopolis:/projects/mustmodify/cajun_zydeco$ ruby -v
ruby 2.1.6p336 (2015-04-13 revision 50298) [x86_64-linux]

jw@logopolis:/projects/mustmodify/cajun_zydeco$ rackup
[2015-07-22 08:03:53] INFO  WEBrick 1.3.1
[2015-07-22 08:03:53] INFO  ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2015-07-22 08:03:53] INFO  WEBrick::HTTPServer#start: pid=6583 port=9292

Any thoughts about why webrick reports using ruby 1.9.3? It's not just confused... I changed config.ru to:

run lambda { |env|
  [
    404,
    {
      'Content-Type'  => 'text/html',
    },
    ["#{RUBY_VERSION}"]
  ]
}

and then:

jw@logopolis:/projects/mustmodify/cajun_zydeco$ curl localhost:9292/stuff
1.9.3
postmodern commented 9 years ago

What does head -n 1 $(which rackup) show? Maybe it's an old #!?

mustmodify commented 9 years ago

genius.

jw@logopolis:/projects/mustmodify/cajun_zydeco$ head -n 1 $(which rackup)
#!/usr/bin/env ruby1.9.1
postmodern commented 9 years ago

gem pristin can re-generate the rubygems binstubs, or you can set gem: --env-shebang in ~/.gemrc.