#!/usr/bin/env ruby =begin @history: 2011-02-05 1.0.1: better myconf 2011-02-05 0.9.1: Created =end require 'optparse' # http://ruby.about.com/od/advancedruby/a/optionparser.htm #require '~/lib/ric.rb' require 'rubygems' require 'ric' require 'yaml' $PROG_VER = '1.0.2' $DEBUG = false $myconf = { 'author' => 'Riccardo Carlesso ', 'description' => 'Copies files from a directory to another.', 'from' => '~/Documents/', 'to' => '/tmp/my_docs_backup/', 'files' => ["**/{*.{mp3,jpg}}", 'README', 'put', 'your', 'files', 'here' ], 'dryrun' => true, } def main debug_on 'Just created script, presuming u need some debug. TODO REMOVE ME when everything works!' if $DEBUG # Maybe you may want to check on ARGV deb "+ Your configuration: #{purple $myconf}" include Ric::Conf include Ric::Files myconf = load_auto_conf('xcopy', :sample_hash => $myconf) xcopy( File.expand_path(myconf['from']), File.expand_path(myconf['to']), myconf['files'] , #myconf :dryrun => myconf['dryrun'] ) end main()