Sha256: d98ccfeb00a496a877846649daf6b4246d2b008ff4f68365962bd9655676f3a3

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

#!/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 <riccardo.carlesso@gmail.com>',
      '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()

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ric-0.14.2 bin/ric-xcopy
ric-0.14.1 bin/ric-xcopy
ric-0.14.0 bin/ric-xcopy