Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Ruby Compile.

Reply
Thread Tools

Ruby Compile.

 
 
Tridib Bandopadhyay
Guest
Posts: n/a
 
      10-22-2010
I am running Ruby 1.8.1 on CentOS release 4.8(Final)..

I have compiled the Ruby and my 'make test' command gives me test
succeeded.



Can I run a small ruby code without installing ruby.If so,how to do..

I tried to run a small program but when trying to run it as

--ruby calc.rb >>>It shows command not found.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Jeremy Bopp
Guest
Posts: n/a
 
      10-22-2010
On 10/22/2010 10:57 AM, Tridib Bandopadhyay wrote:
> I am running Ruby 1.8.1 on CentOS release 4.8(Final)..
>
> I have compiled the Ruby and my 'make test' command gives me test
> succeeded.
>
>
>
> Can I run a small ruby code without installing ruby.If so,how to do..
>
> I tried to run a small program but when trying to run it as
>
> --ruby calc.rb >>>It shows command not found.


In the top level of your Ruby source directory should be the compiled
ruby program. The problem that this path is not in your PATH
environment variable, so simply invoking ruby as "ruby" will not find
it. There are a couple of options available to you:

1) Add the path to the directory containing the ruby program you built
to your PATH environment variable:
PATH=/path/to/ruby/source:$PATH
2) Run ruby using an explicit path to ruby such as:
/path/to/ruby/source/ruby calc.rb

There are other variations on these options, but these are the basics.

-Jeremy

 
Reply With Quote
 
 
 
 
Tridib Bandopadhyay
Guest
Posts: n/a
 
      10-22-2010
Jeremy Bopp wrote in post #956345:
> On 10/22/2010 10:57 AM, Tridib Bandopadhyay wrote:
>>
>> --ruby calc.rb >>>It shows command not found.

>
> In the top level of your Ruby source directory should be the compiled
> ruby program. The problem that this path is not in your PATH
> environment variable, so simply invoking ruby as "ruby" will not find
> it. There are a couple of options available to you:
>
> 1) Add the path to the directory containing the ruby program you built
> to your PATH environment variable:
> PATH=/path/to/ruby/source:$PATH
> 2) Run ruby using an explicit path to ruby such as:
> /path/to/ruby/source/ruby calc.rb
>
> There are other variations on these options, but these are the basics.
>
> -Jeremy



I am running it on a server of my School....So i didn't get it how to
do?.

Secondly when I type ls -lt the latest file which shows is

rbconfigure.rb

Regards
Tridib

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Jeremy Bopp
Guest
Posts: n/a
 
      10-22-2010
On 10/22/2010 11:10 AM, Tridib Bandopadhyay wrote:
> Jeremy Bopp wrote in post #956345:
>> On 10/22/2010 10:57 AM, Tridib Bandopadhyay wrote:
>>>
>>> --ruby calc.rb >>>It shows command not found.

>>
>> In the top level of your Ruby source directory should be the compiled
>> ruby program. The problem that this path is not in your PATH
>> environment variable, so simply invoking ruby as "ruby" will not find
>> it. There are a couple of options available to you:
>>
>> 1) Add the path to the directory containing the ruby program you built
>> to your PATH environment variable:
>> PATH=/path/to/ruby/source:$PATH
>> 2) Run ruby using an explicit path to ruby such as:
>> /path/to/ruby/source/ruby calc.rb
>>
>> There are other variations on these options, but these are the basics.
>>
>> -Jeremy

>
>
> I am running it on a server of my School....So i didn't get it how to
> do?.


The options I listed are about as basic as it gets, I'm afraid. My
recommendation is that you take the first option. Open your shell on
the server and enter the following:

PATH=/path/to/ruby/source:$PATH

Where /path/to/ruby/source is the full path to the location where you
extracted the Ruby sources in order to build your version of Ruby.

> Secondly when I type ls -lt the latest file which shows is
>
> rbconfigure.rb


I'm not sure what you're trying to tell me here. The most current file
in a directory I don't know about (since you didn't say) doesn't appear
relevant to you running ruby to process your calc.rb script.

-Jeremy

 
Reply With Quote
 
Rajinder Yadav
Guest
Posts: n/a
 
      10-22-2010
On Fri, Oct 22, 2010 at 11:57 AM, Tridib Bandopadhyay
<(E-Mail Removed)> wrote:
> I am running Ruby 1.8.1 on CentOS release 4.8(Final)..
>
> I have compiled the Ruby and my 'make test' command gives me test
> succeeded.
>
>
>
> Can I run a small ruby code without installing ruby.If so,how to do..
>
> I tried to run a small program but when trying to run it as
>
> --ruby calc.rb >>>It shows command not found.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>


try building the ruby source this way so it builds and installs under
your home folder, you can later just delete this folder without worry

cd ~
mkdir -p ruby/local/

now cd into the source folder where you extracted the ruby source

NOTE: the use of tilda ~ in the path below, you want to install it
under your home folder ~/ruby/local/

/configure --prefix=~/ruby/local
make
make test
make install

export $PATH=~/ruby/local:$PATH

now test if you can run ruby with:
ruby -v

the export command will only be good for the current session, if you
want to make it permanent, save it to you bash start up file

nano ~/.bashrc

add the line at the bottom of your file

$PATH=~/ruby/local:$PATH

save and exit the file

btw, i am assuming you're using the bash shell. if you still don't
know what to do ask your sysadmin for help at school

--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

 
Reply With Quote
 
Rajinder Yadav
Guest
Posts: n/a
 
      10-22-2010
On Fri, Oct 22, 2010 at 3:03 PM, Rajinder Yadav <(E-Mail Removed)> wrote:


> try building the ruby source this way so it builds and installs under
> your home folder, you can later just delete this folder without worry
>
> cd ~
> mkdir -p ruby/local/
>
> now cd into the source folder where you extracted the ruby source
>
> NOTE: the use of tilda ~ in the path below, you want to install it
> under your home folder ~/ruby/local/
>
> ./configure --prefix=~/ruby/local
> make
> make test
> make install
>
> export $PATH=~/ruby/local:$PATH


correction to the path,

export $PATH=~/ruby/local/bin:$PATH

> now test if you can run ruby with:
> ruby -v
>
> the export command will only be good for the current session, if you
> want to make it permanent, save it to you bash start up file
>
> nano ~/.bashrc
>
> add the line at the bottom of your file
>
> $PATH=~/ruby/local:$PATH


same correction here

> $PATH=~/ruby/local/bin:$PATH


>
> save and exit the file
>
> btw, i am assuming you're using the bash shell. if you still don't
> know what to do ask your sysadmin for help at school
>


--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1

 
Reply With Quote
 
Tridib Bandopadhyay
Guest
Posts: n/a
 
      10-25-2010
@Rajinder Yadav

I don't want to install ruby. I just want to compile it which is done
for me.

As its showing test succeeded on Make test command.But i tried a simple
ruby code as

puts 1+2

with file named calc.rb and tried to run it with command.

ruby calc.rb>>> Its telling me command not found.
__________________________________________________ _________
Secondly I tried what you said in my home directory within the server.

/configure --prefix=~/ruby/local

Its telling me.

configure: error: expected an absolute directory name for --prefix:
~/ruby/local

Regards.

Tridib

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Ammar Ali
Guest
Posts: n/a
 
      10-25-2010
On Mon, Oct 25, 2010 at 7:40 PM, Tridib Bandopadhyay <(E-Mail Removed)> wrote:
> @Rajinder Yadav
>
> I don't want to install ruby. I just want to compile it which is done
> for me.
>
> As its showing test succeeded on Make test command.But i tried a simple
> ruby code as
>
> puts 1+2
>
> with file named calc.rb and tried to run it with command.
>
> ruby calc.rb>>> Its telling me command not found.


Yes. You didn't install ruby, you just compiled it. The system can't
find the ruby command you compiled.


> __________________________________________________ _________
> Secondly I tried what you said in my home directory within the server.
>
> ./configure --prefix=~/ruby/local
>
> Its telling me.
>
> configure: error: expected an absolute directory name for --prefix:
> ~/ruby/local


The suggestion is good. You need to replace the '~' in the path with
the path of your home directory:

./configure --prefix=/home/your-user-name/ruby/local

You might also need to create the path for 'ruby/local' with:

mkdir -p ~/ruby/local

Rajinder's comments tell you how to add that special path (the system
doesn't know to look there) to the system's list of places to look for
commands, so you can just type:

$ ruby 'puts 1 + 2'

instead of:

$ /home/your-user-name/ruby/local/bin/ruby

HTH,
Ammar

 
Reply With Quote
 
Tridib Bandopadhyay
Guest
Posts: n/a
 
      10-25-2010
Ammar Ali wrote in post #956972:


>
> The suggestion is good. You need to replace the '~' in the path with
> the path of your home directory:
>
> ./configure --prefix=/home/your-user-name/ruby/local
>
> Ammar


Thank You It is working now.....It shows config.status: creating
Makefile


Now what I have to do?..

Regards

Tridib

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Tridib Bandopadhyay
Guest
Posts: n/a
 
      10-25-2010
DaShiell, Jude T. CIV NAVAIR 1490, 1, 26 wrote in post #956977:
> First if you built in /usr/local/src, /usr/local/src/ruby-1.9.2/bin is
> likely to hold your ruby executable. So be in the same directory then
> run ./ruby calc.rb with calc.rb being temporarily placed in that bin
> directory. I think you'll have your expected results once you do that.
> Hth.


Thank You very much...I got the result I was expecting....

Regards

Tridib

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruby extension (C++) on OS X [ruby 1.8.2] and Google-Sketchup [ruby 1.8.5] Nicholas Ruby 3 01-28-2007 01:48 AM
The Ruby Edge - Digg for Ruby and Ruby On Rails roschler Ruby 0 10-15-2006 11:35 PM
ruby-talk, comp.lang.ruby, ruby-talk-google Phrogz Ruby 4 09-06-2006 06:43 PM
#!/usr/bin/ruby , #!/usr/bin/ruby -w , #!/usr/bin/ruby -T?, #!/usr/bin/ruby -T1... anne001 Ruby 1 04-23-2006 03:02 PM
[ANN] ruby-freedb, ruby-serialport, ruby-mp3info moved to Rubyforge guillaume.pierronnet@ratp.fr Ruby 0 08-31-2003 11:57 PM



Advertisments