Here's an ARC draft for the RubyOnRails components 
and a request for comments.

(I've also posted a copy at 
 http://wikis.sun.com/display/WebStack/RoR_ARC_Case )

Thanks,
 -ps

Including Ruby on Rails with Solaris - ARC Draft

Prashant Srinivasan <Prashant.Srinivasan at Sun.COM>
26 September 2007

1.      Summary and motivation

        This project delivers Ruby on Rails(RoR) set of components
        into Solaris.  Ruby, the scripting language[1], and Rails,
        the associated web application framework[2], are fast gaining 
        popularity, and their inclusion into Solaris will enable it to
        be a more attractive platform for Ruby/RoR developers and deployments.

        Certain extensions[section 3] to the Ruby language, and libraries
        [section 3], are also included based on the necessity for an end user
        to install such programs to have a functional Ruby/RoR stack.

        This case seeks Micro Release Binding. 
                
2.      Technical issues
        2.1.    Key objects.

        /usr/ruby/1.8.6/bin/cgi-fcgi
        /usr/ruby/1.8.6/bin/erb
        /usr/ruby/1.8.6/bin/gem
        /usr/ruby/1.8.6/bin/gem_mirror
        /usr/ruby/1.8.6/bin/gem_server
        /usr/ruby/1.8.6/bin/gemlock
        /usr/ruby/1.8.6/bin/gemri
        /usr/ruby/1.8.6/bin/gemwhich
        /usr/ruby/1.8.6/bin/gpgen
        /usr/ruby/1.8.6/bin/index_gem_repository.rb
        /usr/ruby/1.8.6/bin/irb
        /usr/ruby/1.8.6/bin/mongrel_rails
        /usr/ruby/1.8.6/bin/rails
        /usr/ruby/1.8.6/bin/rake
        /usr/ruby/1.8.6/bin/rdoc
        /usr/ruby/1.8.6/bin/redcloth
        /usr/ruby/1.8.6/bin/ri
        /usr/ruby/1.8.6/bin/ruby
        /usr/ruby/1.8.6/bin/testrb
        /usr/ruby/1.8.6/bin/update_rubygems


                
        All other objects will be contained within the
        /usr/ruby/[<version>.<subversion>.<minor-subversion>] hierarchy.
        

        
        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 update 5000 is the latest stable 
release.
        Ruby 1.9 is under development, slated for release in December 2007.
                
        The versioning model for Ruby is 
<version>.<subversion>.<minor-subversion>.
        Ruby 1.8.6 patchupdate 5000 is being included into Solaris.
        
        2.3.    Directory Naming and Structure
        
        The proposed directory layout for RoR is:
                /usr/ruby/[<version>.<subversion>.<minor-subversion>]/
                        bin
                                include
                                lib
                                man
                                share
                                src

        /usr/ruby/ will expose bin, include, lib, man, share, and src 
directories.
        These will be symbolic links to corresponding directories in the highest
        numbered <version>.<subversion>.<minor-subversion> directory in 
/usr/ruby,
        hence, users will be able to use "/usr/ruby/bin/ruby" to invoke the 
most 
        recent version.
        
        The detailed directory and file layout for RoR is provided in [7].

        2.4.    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 proposed package, SUNWruby,
        will contain all the Ruby interfaces and the extensions an libraries
        that are installed into Ruby.  The libraries(Ruby gems[4]) will be 
upgradeable
        using the gems package management interface  over the internet, by 
connecting
        to a gem repository.  This is a process similar to Perl's CPAN 
architecture[6].
        Upgrades to the Ruby platform, when available will require upgrading the
        SUNWruby package. 
        It is expected that users will have different versions of the package 
installed,
        since releases are not guaranteed to be compatible, and upstream 
applications
        "certify" to a particular <version>.<subversion>.<minor-subversion> of 
Ruby.




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 is an example).
                
        3.1.    Included Ruby Extensions and Gems.
        
        The initial integration will provide the following, a subset of the 
extant Ruby
        extensions and Gems, in addition to gems that are dependent on Rails.
 

                    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]
                    redcloth    [Textile implementation]
                    ruby-fcgi   [fcgi support]
                    rails       [web application framework]
                    mongrel     [HTTP Server]
                    redcloth    [Textile parsing]
                    
                    


        Additional extensions can be delivered subsequent to the initial
        integration, depending on user community and customer requests.

4.      Ruby and Rails 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.  Rails, based on Ruby, offers the same support for
        Internationalization.

5.      Ruby and Rails Documentation.
        Ruby and Rails are well documented[3][4].  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 appropriate 
man directory     
        [/usr/ruby/[<version>.<subversion>.<minor-subversion>]/man], with
        an appropriate symbolic link from /usr/ruby/man. The contents of this
        man page is provided in Addendum 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>.<minor-subversion>]. 

6.      Interfaces

        6.1.    Interface Stability.

        The RoR stack, as a set of Open Source projects, is controlled by
        a group of developers external of, and independent from, SMI. These
        projects make no guarantees or promises of ABI or API compatibility
        between releases.

        6.2.    Imported Interfaces.

        NAME                            STABILITY               NOTES

        OpenSSL [Secure Sockets Layer]  External/Volatile PSARC/2003/500
        Curses [CRT screen handling]    Stable
        Readline[functions to edit command lines](statically linked into the 
Ruby executable)   External
        PSARC 2007/188
        Tcl/Tk                          Uncommitted       PSARC 2007/317
          

        6.3.    Exported Interfaces.
          There are no advertised programmatic interfaces.  
        NAME                    STABILITY               NOTES

        SUNWruby                Uncommitted             Package Name
        /usr/ruby/[version]/bin/cgi-fcgi        Uncommitted             
Executable
        /usr/ruby/[version]/bin/erb             Uncommitted             
Executable
        /usr/ruby/[version]/bin/gem             Uncommitted             
Executable
        /usr/ruby/[version]/bin/gem_mirror      Uncommitted             
Executable
        /usr/ruby/[version]/bin/gem_server      Uncommitted             
Executable
        /usr/ruby/[version]/bin/gemlock         Uncommitted             
Executable
        /usr/ruby/[version]/bin/gemri           Uncommitted             
Executable
        /usr/ruby/[version]/bin/gemwhich        Uncommitted             
Executable
        /usr/ruby/[version]/bin/gpgen           Uncommitted             
Executable
        /usr/ruby/[version]/bin/index_gem_repository.rb Uncommitted     
Executable
        /usr/ruby/[version]/bin/irb             Uncommitted             
Executable
        /usr/ruby/[version]/bin/mongrel_rails   Uncommitted             
Executable
        /usr/ruby/[version]/bin/rails           Uncommitted             
Executable
        /usr/ruby/[version]/bin/rake            Uncommitted             
Executable
        /usr/ruby/[version]/bin/rdoc            Uncommitted             
Executable
        /usr/ruby/[version]/bin/redcloth        Uncommitted             
Executable
        /usr/ruby/[version]/bin/ri              Uncommitted             
Executable
        /usr/ruby/[version]/bin/ruby            Uncommitted             
Executable
        /usr/ruby/[version]/bin/testrb          Uncommitted             
Executable
        /usr/ruby/[version]/bin/update_rubygems Uncommitted             
Executable


          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
          redcloth      Uncommitted             Textile implementation
          ruby-fcgi     Uncommitted             fcgi for Apache/Lighttpd 
support by Ruby
          
          
          

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://wikis.sun.com/display/WebStack/Directory_and_File_Layout

         
Addendum 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.

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/ruby/bin/ruby
          # This line makes the next one a comment in Ruby \
            exec /usr/ruby/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/local/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.

AUTHORS
     Ruby is  designed  and  implemented  by  Yukihiro  Matsumoto
     <matz at netlab.jp>.

December 3Last0change: Ruby Programmers Reference Guide         7

-- 
Prashant Srinivasan
F/OSS Enthusiast
Sun Microsystems, Inc.
http://blogs.sun.com/prashant
GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x82FBDE5A



Reply via email to