I am sponsoring this fast track for Prashant Srinivasan. Details below.
Appendix 2 is in the materials directory.
Template Version: @(#)sac_nextcase 1.64 07/13/07 SMI
This information is Copyright 2007 Sun Microsystems
1. Introduction
1.1. Project/Component Working Name:
Including Ruby 1.8 with Solaris
1.2. Name of Document Author/Supplier:
Author: Prashant Srinivasan
1.3 Date of This Document:
16 October, 2007
4. Technical Description
Including Ruby 1.8 with Solaris
Prashant Srinivasan <Prashant.Srinivasan at Sun.COM>
15 October 2007
1. Summary and motivation
This project delivers Ruby into Solaris.
Ruby, the scripting language[1], and Rails, the associated web
application framework[2], are fast gaining popularity, and Ruby's
inclusion into Solaris will enable it to be a more attractive
platform for Ruby/Rails developers and deployments.
Certain extensions[section 3] to the Ruby language, and a packaging
program, Rubygems[5] are also included based on the necessity for
an end user to install such programs to have a functional Ruby
installation and to be able to add functionality in a seamless manner.
This case seeks Micro Release Binding.
2. Technical issues
2.1. Key objects.
/usr/ruby/1.8/bin/erb
/usr/ruby/1.8/bin/irb
/usr/ruby/1.8/bin/rdoc
/usr/ruby/1.8/bin/ri
/usr/ruby/1.8/bin/ruby
/usr/ruby/1.8/bin/testrb
/usr/ruby/1.8/bin/gem
/usr/ruby/1.8/bin/gem_mirror
/usr/ruby/1.8/bin/gem_server
/usr/ruby/1.8/bin/gemlock
/usr/ruby/1.8/bin/gemri
/usr/ruby/1.8/bin/gemwhich
/usr/ruby/1.8/bin/index_gem_repository.rb
/usr/ruby/1.8/bin/update_rubygems
All other objects will be contained within the
/usr/ruby/[<version>.<minor-version>] and the
/var/ruby/<version>.<minor-version>/gems hierarchy.
The proposed directory layouts for Ruby are:
/usr/ruby/[<version>.<minor-version>]/
bin
include
lib
man
share
src
/var/ruby/<version>.<minor-version>/gem_home
/usr/ruby/[<version>.<minor-version>]/bin/<executable>
will be linked symbolically from
/usr/bin/<executable><version>.<minor-version>
and from /usr/bin/<executable>. The latter link will always point to
the highest <version>.<minor-version> of Ruby installed on the system.
The former will be a set of links to different Ruby major
versions installed on the system. This is a direct outcome of
the versioning policy described in 2.2.
This will also encourage the usage of the style "#!/usr/bin/env ruby"
or "#!/usr/bin/env ruby1.8" depending on whether the programmer is
interested in locking in to a specific <version>.<minor-version>,
or is open to having her/his program interpreted by the most recent
Ruby installation.
The detailed directory and file layout for Ruby is provided in
Appendix 2.
2.2. Versioning
The Ruby development processes follow the ubiquitous
"continuous development" model, typical of many Open Source projects.
Currently, versions 1.8.6 patch 110 is the latest stable release.
Ruby 1.9 is under development, slated for release in December 2007.
Ruby 1.9 is the subversion trunk, with Ruby 1.8 forming a
branch(ruby_1_8). Ruby 1.8.6 and Ruby 1.8.5 are in
maintenance mode, with 1.8.7 in development. It is expected
that Ruby 1.8.5 will no longer be maintained after Ruby 1.8.7
is released.
The versioning model for Ruby is
<version>.<subversion>.<teeny-version>.
This project covers the integration of Ruby 1.8 into Solaris.
The compatibility expectations for Ruby are as follows:
A development release is an unstable release that can have significant
feature changes from the previous release, and can potentially break
compatibility.
A production release is, as the name suggests, a stable
release, such that compatibility is largely maintained across
minor versions.
The absence of a point release(or the "TEENY" version field), or a
point release of "0" serves as a development version.
For example, 1.9(==1.9.0) is a development release,
and development updates to the corresponding Subversion branch are
not numbered. Once 1.9 is deemed production ready, it will be
released as 1.9.l, which will be a production release.
Version x.y.z is a development release iff z == 0, or z is undefined;
The oddness/evenness of y not withstanding.
The corollary is that version x.y.z is a production release iff z > 0.
Version x.y.z is compatible for different values of z, such that z > 0.
The corollary being that x.y.z is not compatible for x.p.z if
y != p. And it is compatible only if y == p.
Compatibility expectations for Rubygems are as follows:
Rubygems intends to maintain compatibility across releases,
with two exceptions:
(1) It depends on Ruby, hence the Ruby compatibility expectations
apply.
(2) Interfaces (which, in this context refers to both APIs
provided for Ruby programmers, and command line
arguments; [8] and [9] provide examples) can be
deprecated. In Rubygems deprecation means that use of
the deprecated interface results in a runtime warning.
Deprecated interfaces will be available for at least 6
months (that is, at least 2 minor releases) after being
marked as such.
Repository structure changes are not foreseen or planned. But
in the unlikely eventuality that they occur, the Rubygems
community intends to develop migration tools to help end users
move to newer versions of Rubygems.
The notion of a development release does not exist in
Rubygems; experimental features are released in beta versions,
and they are removed if not found useful. The beta tag is
removed after the feature gains maturity, and a release is made.
Hence any version x.y.z is suitable for inclusion with Solaris
as long as it is not labelled "beta".
Rubygems will be a part of the Ruby distribution. Ruby 1.9
onward will provide stable releases of Rubygems.
2.3. Packaging and Delivery
The current proposal allows for the inclusion and coexistence
of multiple versions of Ruby by keeping each installation under
a version-specific subdirectory. The package SUNWruby18u,
and SUNWruby18r, will contain the Ruby and Rubygems interfaces.
Rubygems[5] provides the gems package management interfaces
to install or upgrade Ruby libraries over the internet,
by connecting to a gem repository(using a process similar to
Perl's CPAN architecture[6]), this will allow end users to
easily install Rails, or other Ruby libraries.
Individual Ruby libraries which are distributed as Gems will
not be packaged with Solaris, and is outside the scope of this
ARC case. The Gem packaging system provides programmatic
features to Ruby programs(such as the ability to specify
library dependencies in Ruby code), and the growing trend
among Ruby developers is to package libraries as Gems.
Migrating Ruby Gems into their component Ruby libraries for
Solaris packaging is not preferred, since Gem support is
popular with the Ruby community(and is only expected to grow
with the acceptance of Rubygems into the Ruby distribution).
Packaging Ruby libraries which are distributed as Gems with
Solaris, while maintaining the advantages of Gem packaging for
Ruby users deserves more research. However the packaging of
the Rubygems program will allow easy installation of Ruby
libraries.
The /var/ruby/1.8/gem_home directory is the home for Ruby libraries
(gems) installed using Rubygems.
This is also the home to a subset of the Rubygems
functionality and documentation. This, as well as other
libraries which an user may install, by using the Rubygems
program, are open to modification on a per zone basis, and
hence are located in the /var hierarchy.
Upgrades to the Ruby platform, when available will require
upgrading the SUNWruby[version] usr and root packages. It is
expected that users will have different major versions of the
package installed, since releases are not guaranteed to be
compatible across them. Newer minor versions of the Ruby
interfaces will upgrade the existing interfaces, since these
will be compatible.
3. Ruby Extensions and Gems.
Ruby supports a loadable module interface(known in Ruby
parlance as "Extensions"), allowing the Ruby runtime to
communicate with, and bind to, external interfaces.
Extensions are implemented using a C interface. Extensions
have an associated dynamically loadable shared object(*.so),
and quite often two, since the extension itself usually loads
another shared object. Gems[5] are Ruby libraries that are
installed using the "gem" interface such that they are located
in the default search path of the Ruby runtime. Some Ruby
gems also include native extensions(Mongrel[7] is an example).
3.1. Included Ruby Extensions.
The initial integration will provide the following, a select subset
of the extant Ruby extensions.
readline [command line support for Ruby and Rails]
openssl [HTTPS support]
readline [command line input processing for Ruby and Rails]
tk [to support the TK toolkit]
curses [terminal control library]
openssl [HTTPS support]
Additional extensions can be delivered subsequent to the initial
integration, depending on user community and customer requests.
4. Ruby Internationalization.
Ruby offers the ability to use different character sets based
on the value of a global variable, $KCODE. It does not have
built in features for message localization.
5. Ruby Documentation.
Ruby is well documented[3]. The API documentation and a man
page, a subset of the comprehensive documentation available on
the internet, are available with the Ruby installation by
invoking "ri".
5.1. Manual Pages.
Ruby provides a man page, which will be delivered in the man directory
[/usr/ruby/[<version>.<subversion>/man]. The contents of this
man page, modified appropriately for Solaris, is provided in
Appendix 1.
A symbolic link will be created from the standard Solaris man page
location(/usr/share/man/man1/ruby.1) to
/usr/ruby/[<version>.<subversion>]/man1/ruby.1.
6. Interfaces
6.1. Imported Interfaces.
NAME STABILITY NOTES
OpenSSL [Secure Sockets Layer] External/Volatile PSARC/2003/500
Curses [CRT screen handling] Stable ASARC 1992/040
Readline (statically linked) Uncommitted PSARC 2007/188
Tcl/Tk Uncommitted PSARC 2007/317
6.2. Exported Interfaces.
NAME STABILITY NOTES
SUNWruby18u Uncommitted Package Name
SUNWruby18r Uncommitted Package Name
Ruby Language interfaces Uncommitted Language Interfaces
/usr/ruby/[version]/bin
erb Uncommitted Executable
gem Uncommitted Executable
gem_mirror Uncommitted Executable
gem_server Uncommitted Executable
gemlock Uncommitted Executable
gemri Uncommitted Executable
gemwhich Uncommitted Executable
index_gem_repository.rb Uncommitted Executable
irb Uncommitted Executable
rdoc Uncommitted Executable
ri Uncommitted Executable
ruby Uncommitted Executable
testrb Uncommitted Executable
update_rubygems Uncommitted Executable
/usr/ruby/[version]/man1/ruby.1 Uncommitted Man page
/usr/bin/erb Volatile Symbolic link
/usr/bin/gem Volatile Symbolic link
/usr/bin/gem_mirror Volatile Symbolic link
/usr/bin/gem_server Volatile Symbolic link
/usr/bin/gemlock Volatile Symbolic link
/usr/bin/gemri Volatile Symbolic link
/usr/bin/gemwhich Volatile Symbolic link
/usr/bin/index_gem_repository.rb Volatile Symbolic link
/usr/bin/irb Volatile Symbolic link
/usr/bin/rdoc Volatile Symbolic link
/usr/bin/ri Volatile Symbolic link
/usr/bin/ruby Volatile Symbolic link
/usr/bin/testrb Volatile Symbolic link
/usr/bin/update_rubygems Volatile Symbolic link
/usr/share/man/man1/ruby.1 Volatile Symbolic link
/usr/bin/erb1.8 Uncommitted Symbolic link
/usr/bin/gem1.8 Uncommitted Symbolic link
/usr/bin/gem_mirror1.8 Uncommitted Symbolic link
/usr/bin/gem_server1.8 Uncommitted Symbolic link
/usr/bin/gemlock1.8 Uncommitted Symbolic link
/usr/bin/gemri1.8 Uncommitted Symbolic link
/usr/bin/gemwhich1.8 Uncommitted Symbolic link
/usr/bin/index_gem_repository.rb1.8 Uncommitted Symbolic link
/usr/bin/irb1.8 Uncommitted Symbolic link
/usr/bin/rdoc1.8 Uncommitted Symbolic link
/usr/bin/ri1.8 Uncommitted Symbolic link
/usr/bin/ruby1.8 Uncommitted Symbolic link
/usr/bin/testrb1.8 Uncommitted Symbolic link
/usr/bin/update_rubygems1.8 Uncommitted Symbolic link
Extensions and Libraries
NAME STABILITY NOTES
readline Uncommitted Library to process command line input.
Tk Uncommitted Extension to support the TK toolkit
curses Uncommitted The terminal control library
openssl Uncommitted HTTPS support
7. References.
[1] http://www.ruby-lang.org/
[2] http://www.rubyonrails.org/
[3] http://ruby-doc.org
[4] http://api.rubyonrails.org
[5] http://www.rubygems.org/
[6] http://www.cpan.org/
[7] http://mongrel.rubyforge.org/
[8] http://blog.segment7.net/articles/2007/10/08/time-today-going-away
[9] http://blog.segment7.net/articles/2007/10/13/rubygems-beta-0-9-4-5
Appendix 1: Ruby man page:
UNIX RUBY(1)
NAME
ruby - Interpreted object-oriented scripting language
SYNOPSIS
ruby [--copyright] [--version] [-Sacdlnpswvy] [-0[octal]]
[-C directory] [-F pattern] [-I directory] [-K c]
[-T[level]] [-e command] [-i[extension]] [-r library]
[-x[directory]] [--] [program_file] [argument ...]
DESCRIPTION
Ruby is an interpreted scripting language for quick and easy
object-oriented programming. It has many features to pro-
cess text files and to do system management tasks (as in
Perl). It is simple, straight-forward, and extensible.
If you want a language for easy object-oriented programming,
or you don't like the Perl ugliness, or you do like the con-
cept of LISP, but don't like too much parentheses, Ruby may
be the language of your choice.
FILES
Ruby 1.8 is integrated with Solaris.
The following files specify the installation locations for
Ruby:
/var/ruby/1.8/gem_home Contains the Rubygems repository.
Configure the GEM_HOME environment
variable to point to
/var/ruby/1.8/gem_home to use the
this installation of Rubygems.
/usr/ruby/1.8/bin Contains the Ruby executable as
well as other utility programs, and
Rubygems programs.
These programs are linked from
/usr/bin. For example:
/usr/ruby/1.8/bin/ruby is linked
from /usr/bin/ruby1.8, and may be
linked from /usr/bin/ruby if 1.8 is
the latest version of Ruby installed
on this system.
FEATURES
Ruby's features are as follows:
Interpretive
Ruby is an interpreted language, so you don't have to
recompile programs written in Ruby to execute them.
Variables have no type (dynamic typing)
Variables in Ruby can contain data of any type. You
don't have to worry about variable typing. Conse-
quently, it has a weaker compile time check.
No declaration needed
You can use variables in your Ruby programs without any
declarations. Variable names denote their scope,
local, global, instance, etc.
Simple syntax
Ruby has a simple syntax influenced slightly from Eif-
fel.
No user-level memory management
Ruby has automatic memory management. Objects no
longer referenced from anywhere are automatically col-
lected by the garbage collector built into the inter-
preter.
December 3Last0change: Ruby Programmers Reference Guide 1
UNIX RUBY(1)
Everything is an object
Ruby is the purely object-oriented language, and was so
since its creation. Even such basic data as integers
are seen as objects.
Class, inheritance, and methods
Of course, as an object-oriented language, Ruby has
such basic features like classes, inheritance, and
methods.
Singleton methods
Ruby has the ability to define methods for certain
objects. For example, you can define a press-button
action for certain widget by defining a singleton
method for the button. Or, you can make up your own
prototype based object system using singleton methods,
if you want to.
Mix-in by modules
Ruby intentionally does not have the multiple inheri-
tance as it is a source of confusion. Instead, Ruby
has the ability to share implementations across the
inheritance tree. This is often called `Mix-in'.
Iterators
Ruby has iterators for loop abstraction.
Closures
In Ruby, you can objectify the procedure.
Text processing and regular expression
Ruby has a bunch of text processing features like in
Perl.
Bignums
With built-in bignums, you can for example calculate
factorial(400).
Exception handling
As in Java(tm).
Direct access to the OS
Ruby can use most UNIX system calls, often used in
December 3Last0change: Ruby Programmers Reference Guide 2
UNIX RUBY(1)
system programming.
Dynamic loading
On most UNIX systems, you can load object files into
the Ruby interpreter on-the-fly.
OPTIONS
Ruby interpreter accepts following command-line options
(switches). They are quite similar to those of perl(1).
--copyright
Prints the copyright notice.
--version
Prints the version of Ruby interpreter.
-0[octal]
(The digit ``zero''.) Specifies the input record
separator ("$/") as an octal number. If no digit is
given, the null character is taken as the separator.
Other switches may follow the digits. -00 turns Ruby
into paragraph mode. -0777 makes Ruby read whole file
at once as a single string since there is no legal
character with that value.
-C directory
Causes Ruby to switch to the directory.
-F pattern
Specifies input field separator ("$;").
-I directory
Used to tell Ruby where to load the library scripts.
Directory path will be added to the load-path variable
("$:").
-K kcode
Specifies KANJI (Japanese) encoding.
-S Makes Ruby use the PATH environment variable to search
for script, unless if its name begins with a slash.
This is used to emulate #! on machines that don't
December 3Last0change: Ruby Programmers Reference Guide 3
UNIX RUBY(1)
support it, in the following manner:
#! /usr/bin/ruby
# This line makes the next one a comment in Ruby \
exec /usr/bin/ruby -S $0 $*
-T[level]
Turns on taint checks at the specified level (default
1).
-a Turns on auto-split mode when used with -n or -p. In
auto-split mode, Ruby executes
$F = $_.split
at beginning of each loop.
-c Causes Ruby to check the syntax of the script and exit
without executing. If there are no syntax errors, Ruby
will print ``Syntax OK'' to the standard output.
-d
--debug
Turns on debug mode. "$DEBUG" will be set to true.
-e command
Specifies script from command-line while telling Ruby
not to search the rest of arguments for a script file
name.
-h
--help
Prints a summary of the options.
-i extension
Specifies in-place-edit mode. The extension, if speci-
fied, is added to old file name to make a backup copy.
For example:
% echo matz > /tmp/junk
% cat /tmp/junk
matz
% ruby -p -i.bak -e '$_.upcase!' /tmp/junk
% cat /tmp/junk
MATZ
December 3Last0change: Ruby Programmers Reference Guide 4
UNIX RUBY(1)
% cat /tmp/junk.bak
matz
-l (The lowercase letter ``ell''.) Enables automatic
line-ending processing, which means to firstly set "$\"
to the value of "$/", and secondly chops every line
read using chop!.
-n Causes Ruby to assume the following loop around your
script, which makes it iterate over file name arguments
somewhat like sed -n or awk.
while gets
...
end
-p Acts mostly same as -n switch, but print the value of
variable "$_" at the each end of the loop. For exam-
ple:
% echo matz | ruby -p -e '$_.tr! "a-z", "A-Z"'
MATZ
-r library
Causes Ruby to load the library using require. It is
useful when using -n or -p.
-s Enables some switch parsing for switches after script
name but before any file name arguments (or before a
--). Any switches found there are removed from ARGV
and set the corresponding variable in the script. For
example:
#! /usr/bin/ruby -s
# prints "true" if invoked with `-xyz' switch.
print "true\n" if $xyz
On some systems "$0" does not always contain the full
pathname, so you need the -S switch to tell Ruby to
search for the script if necessary. To handle embedded
spaces or such. A better construct than "$*" would be
${1+"$@"}, but it does not work if the script is being
interpreted by csh(1).
-v
December 3Last0change: Ruby Programmers Reference Guide 5
UNIX RUBY(1)
--verbose
Enables verbose mode. Ruby will print its version at
the beginning, and set the variable "$VERBOSE" to true.
Some methods print extra messages if this variable is
true. If this switch is given, and no other switches
are present, Ruby quits after printing its version.
-w Enables verbose mode without printing version message
at the beginning. It sets the "$VERBOSE" variable to
true.
-x[directory]
Tells Ruby that the script is embedded in a message.
Leading garbage will be discarded until the first that
starts with ``#!'' and contains the string, ``ruby''.
Any meaningful switches on that line will applied. The
end of script must be specified with either EOF, "^D"
("control-D"), "^Z" ("control-Z"), or reserved word
__END__. If the directory name is specified, Ruby will
switch to that directory before executing script.
-y
--yydebug
Turns on compiler debug mode. Ruby will print a bunch
of internal state messages during compiling scripts.
You don't have to specify this switch, unless you are
going to debug the Ruby interpreter.
ENVIRONMENT
RUBYLIB
A colon-separated list of directories that are added to
Ruby's library load path ("$:"). Directories from this
environment variable are searched before the standard
load path is searched.
e.g.:
RUBYLIB="$HOME/lib/ruby:$HOME/lib/rubyext"
RUBYOPT
Additional Ruby options.
e.g.
RUBYOPT="-w -Ke"
RUBYPATH
December 3Last0change: Ruby Programmers Reference Guide 6
UNIX RUBY(1)
A colon-separated list of directories that Ruby
searches for Ruby programs when the -S flag is speci-
fied. This variable precedes the PATH environment
variable.
RUBYSHELL
The path to the system shell command. This environment
variable is enabled for only mswin32, mingw32, and OS/2
platforms. If this variable is not defined, Ruby
refers to COMSPEC.
PATH Ruby refers to the PATH environment variable on calling
Kernel#system.
RUBYLIB_PREFIX
This variable is obsolete.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWruby18r |
|_____________________________|_____________________________|
| | SUNWruby18u |
|_____________________________|_____________________________|
| Interface Stability | Uncommitted |
|_____________________________|_____________________________|
NOTES
Source for Ruby is available on http://opensolaris.org.
AUTHORS
Ruby is designed and implemented by Yukihiro Matsumoto
<matz at netlab.jp>.
6. Resources and Schedule
6.4. Steering Committee requested information
6.4.1. Consolidation C-team Name:
sfw
6.5. ARC review type: FastTrack
6.6. ARC Exposure: open