great work! is it on its way to the raa? i've never bothered with install scripts before. but with this it sounds like a piece of cake. so now i will. thanks. -transami On Thursday 12 December 2002 01:47 pm, Phil Tomson wrote: > In article <atagr002v9o / enews3.newsguy.com>, > > Phil Tomson <ptkwt / shell1.aracnet.com> wrote: > >I proposed this idea last night on the tail-end of another thread and on > >the RubyGarden wiki at QuickGuideToPackagingDiscussion as well as on > >the raa-install list, but I thought it might make a good RCR: > > > >Anyone else find the current intall.rb/setup.rb script a bit awkward? When > >I create a package I've got to remember where I left > >install.rb and copy it over into my package directory. Then I've got to > >tar everything up and I've got a package... Like I said, seems a little > >awkward. What if an InstallPkg module that had all of the functionality > >of the install.rb/setup.rb scripts was included with Ruby. Then package > >creators could create very simple install.rb scripts that would look like: > > > > #install.rb > > require 'install_pkg' > > include InstallPkg > > depends_on_hash= > > {"rexml"=>'0.5.0',"rubyfoo"=>'2.3.1','jabber4r'=>'1.2.1 } > > install_package(packageName, depends_on_hash, ...other arguments?...) > > > >Perhaps these install.rb scripts could even be automatically generated by > >running some built-in package-gen script which would also create the > >tar.gz package itself? > > > >This would offer the following advantages: > >1) no more copying install.rb over into your package dir. > >2) it encourages the package creator to list dependencies and versions > >(though it might also be possible to figure these out automatically) > >3) the install.rb takes care of installing dependencies (via > >raa-install) which keeps raa-install simple and it's purpose clear > >(separation of responsibilities). > >4) It seems better from a code reuse standpoint. I see that a lot of > >people write their own install.rb scripts or they cut and paste from the > >install.rb on the RAA - this seems very inefficient. A standard Install > >API would help a lot and people wouldn't have to reinvent the wheel all > >the time. > > FYI: I've got a working prototype for the propoed InstallPkg module. > It's a quick kludge - I took Minero Aoki's install.rb and wrapped the > classes he defined in there in a 'module InstallPkg' and added a few module > methods. The kludgy part is how I had to deal with the commandline options > he was using and turning them into arguments to methods (that part will > have to be rewritten). > > So basically using this module you would create your own install.rb file > like: > > #your install.rb would look something like this: > require 'install-pkg' > depends_on = {'webfetcher'=>'0.0.0', 'scan_for_ruby'=>'0.0.0'} > InstallPkg.install_pkg('thispkg',depends_on) > > and run it like so: > > $ ruby install.rb > > (it does the config, setup and install steps for you so you don't have to > > :) > > Comments? Suggestions? > > Phil