Ruby Tips: Difference between revisions

From EggeWiki
mNo edit summary
Line 1: Line 1:
==Install on Solaris==
This is for installing Ruby without root access into your home directory.
Mostly I followed the advice on http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger and http://santanatechnotes.blogspot.com/2005/12/ruby-and-tk-on-solaris.html.
First we need to build readline:
<pre>
wget ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
tar xzvf readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=/u/eggebr/pkgs/`archpath`
make
make install
cd ..
</pre>
Now for Ruby itself:
<pre>
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.4.tar.gz
tar xzvf ruby-1.8.4.tar.gz
cd ruby-1.8.4
./configure --prefix=/usr/local --with-readline-dir=/u/eggebr/pkgs/`archpath`
make
make install
</pre>
Assuming we have tk already installed, we can build the tk extension.
<pre>
cd ext/tk
ruby extconf.rb --with-tcl-dir=/usr/local/pkgs/tcl-8.3.5 --with-tk-dir=/usr/local/pkgs/tk-8.3.5 --with-tcllib=tcl8.3 --with-tklib=tk8.3 --enable-tcltk_stubs
make &amp;&amp; make install
cp -fr /usr/local/pkgs/tk-8.3.5/* /u/eggebr/pkgs/sunos-5.10-i86pc
</pre>
Now, I just need to test things out.
<pre>
require 'tk'
root = TkRoot.new() { title &quot;Hello, world!&quot; }
Tk.mainloop()
</pre>
==Escape invalid XML characters.==
==Escape invalid XML characters.==



Revision as of 10:54, 1 June 2006

Install on Solaris

This is for installing Ruby without root access into your home directory. Mostly I followed the advice on http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger and http://santanatechnotes.blogspot.com/2005/12/ruby-and-tk-on-solaris.html.

First we need to build readline:

wget ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
tar xzvf readline-5.1.tar.gz
cd readline-5.1
./configure --prefix=/u/eggebr/pkgs/`archpath`
make
make install
cd ..

Now for Ruby itself:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.4.tar.gz
tar xzvf ruby-1.8.4.tar.gz 
cd ruby-1.8.4
./configure --prefix=/usr/local --with-readline-dir=/u/eggebr/pkgs/`archpath`
make
make install

Assuming we have tk already installed, we can build the tk extension.

cd ext/tk
ruby extconf.rb --with-tcl-dir=/usr/local/pkgs/tcl-8.3.5 --with-tk-dir=/usr/local/pkgs/tk-8.3.5 --with-tcllib=tcl8.3 --with-tklib=tk8.3 --enable-tcltk_stubs
make && make install
cp -fr /usr/local/pkgs/tk-8.3.5/* /u/eggebr/pkgs/sunos-5.10-i86pc

Now, I just need to test things out.

require 'tk'
root = TkRoot.new() { title "Hello, world!" }
Tk.mainloop()


Escape invalid XML characters.

This is useful for running stuff through before posting it to the wiki.

echo "<a href=\"foo\">" | ruby -pe 'gsub!(/\&/, "&"); gsub!(/"/, """); gsub!(/</, "<"); gsub!(/>/, ">"); '
&lt;a href=&quot;foo&quot;&gt;