Sha256: 5a7efb11ac1ccdc3675d5bb9abe768b44be37845f3eeb97e9c50fc563ee75529

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'ratch/dsl'
#require 'annotatable'

module Ratch

  # = Ratch Script
  #
  # The Ratch Script class is used to run stand-alone ratch scripts.
  # Yep, this is actaully a class named exactly for what it is.
  # How rare.
  #
  class Script < DSL
    #include Annotatable

    #
    #annotation :cmd

    #
    #annotation :opt

    #
    #def commands
    #  c = {}
    #  self.class.annotations.each do |n, a|
    #    if a.key?(:cmd)
    #      c[n] = a[:cmd]
    #    end
    #  end
    #  c
    #end

    #
    #def initialize   
    #  @noharm  = %w{-n --noharm --dryrun --dry-run}.any?{ |a| ARGV.delete(a) }
    #  @verbose = %w{--verbose}.any?{|a| ARGV.delete(a) }
    #  @quiet   = %w{--quiet}.any?{|a| ARGV.delete(a) }
    #  @force   = %w{--force}.any?{|a| ARGV.delete(a) }
    #  @debug   = %w{--debug}.any?{|a| ARGV.delete(a) }
    #  @trace   = %w{--trace}.any?{|a| ARGV.delete(a) }
    #
    #  super
    #end

    #  @noharm  ||= %w{noharm n dryrun dry-run}.any?{|a| commandline.options[a] }
    #  @verbose ||= %w{verbose}.any?{|a| commandline.options[a] }
    #  @force  ||= %w{force}.any?{|a| commandline.options[a] }
    #  @debug ||= %w{debug}.any?{|a| commandline.options[a] }
    #  @trace ||= %w{trace}.any?{|a| commandline.options[a] }

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-1.0.0 lib/ratch/script.rb