The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Scripting Portupgrade with Ruby

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Scripting Portupgrade with Ruby Posted: Mar 18, 2005 9:41 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Scripting Portupgrade with Ruby
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

I guess it’s hard to top RubyX when it comes to an OS alliance with Ruby. However, FreeBSD’s portupgrade long ago heaved the bar up—it’s a scriptable application for updating ports. I’ve always considered it to be neck-and-neck with tDiary for being Ruby’s first killer app. And portupgrade has got tDiary beat on worldwide adoption. tDiary is hot snakes in Japan—and only.

The primary means of scripting portupgrade is with the pkgtools.conf, which is a Ruby script full of constants. For example, should you want to give make arguments for certain packages, MAKE_ARGS is a hash:

  MAKE_ARGS = {
    'editors/vim' => 'NO_GUI=yes WITH_RUBY=yes',
    'shells/scponly' => 'WITH_SCPONLY_SCP=yes WITH_SCPONLY_GFTP=yes 
       WITH_SCPONLY_WINSCP=yes WITH_SCPONLY_CHROOT=yes',
    'sysutils/gkrellm2' => 'GKRELLM_SERVER_ONLY=yes'
  }

If you know Ruby, scripting portupgrade becomes really trivial. In fact, one of the first Ruby programs I wrote kept the long and winding PHP make flags I had and abstracted them into a simple array.

Like so:

  PHP_OPTS = %w[bz2 ctype imap MySQL overload pcre
    posix session sockets standard tokenizer xml 
    xmlrpc zlib]
  MAKE_ARGS = {
    'lang/php4' => "BATCH=yes WITH_APACHE2=yes " +
        PHP_OPTS.collect { |o| "WITH_#{o.upcase}=yes" }.join( ' ' )
  }

Imagine if you could script your web server in this manner. See and it seems like the budding courtship between lighttpd and Ruby would yield such scripting. (VHosts in a YAML file, anyone??)

The author of portupgrade (and portsdb), knu, has been the Ruby CVS chieftain since 2000. He has been nothing but judicious and kind. And we’ve all benefited from cvsmailer at one time or another, wouldn’t you say??

Read: Scripting Portupgrade with Ruby

Topic: The net benefit of transparency Previous Topic   Next Topic Topic: Hacking The Shakes Into Your Apple

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use