Good day! To execute my script / program, the following command line argument construction is required:
ruby shell.rb <module_name> <options_for_module> An example of launching an application with the backup and rpmbuild modules:
ruby shell.rb backup --dest=/mnt/backup --source=/var/www --exclude-list=list01 --gzip --ssh='user@foo.server.example.com' ruby shell.rb rpmbuild --builddir=/home/rpm --tool=mock Ie: The parameters following the module name depend on the module itself and relate only to it, the module I described something like this:
module Backup ... class OptparseBase ... # тут описание параметров end # class end # module Parsil arguments with optparse.
The problem is that I am not a programmer and I cannot think of a way to read these external modules (Backup, Rpmbuild ...) depending on the first parameter. I would also like to make an internal separation in the module itself, for example, when starting ruby shell.rb backup::freebsd [opt] and ruby shell.rb backup::linux [opt] must be different variables or methods.
I hope that clearly explained the task, please tell me the direction.
#Читать первый параметр, аперкейсить его и передавать в load #{name}.rb - это мне кажется слишком просто, думаю в ruby есть более красивое решение, за этим и обратился. #