Sha256: 0a7196a3ce8b8a3168da69f2030f05ecc0684efb2e52c985af71102e7e66ae9d

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
require File.join( File.dirname(__FILE__), %w[.. lib fred] )
require 'rubygems'

# Initializes the MOle. The configuration file will be read from config/mole_conf.rb.
require 'mole'
::Mole.initialize( :moleable       => true, 
                   :application    => "RubyApp",
                   :perf_threshold => 2,
                   :mole_config    => File.join( File.dirname(__FILE__), %w[.. config mole_conf.rb]) )
::Mole.dump
::Mole.load_mole_configuration                   
                   
class Runner
  def initialize( args )
    check_args( args )
    fred = RubyApp::Fred.new
    case args.first
      when "--feature": fred.my_feature( 10, "Hello", 20 ) { puts "Hello" }
      when "--slow"   : fred.my_slow_feature( "World" )
      when "--hosed"  : fred.my_hosed_feature( "Boom" ) rescue nil
    end
  end
  
  def check_args( args )
    print_usage if !args or args.empty? or !["--feature", "--slow", "--hosed"].include?( args.first )
  end
  
  def print_usage
    puts "Please enter one of the following options: --feature | --slow | --hosed"
  end
end

Runner.new( ARGV )

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
derailed-mole-1.0.10 samples/rubyapp/bin/ruby_app
mole-1.0.9 samples/rubyapp/bin/ruby_app
mole-1.0.12 samples/rubyapp/bin/ruby_app
mole-1.0.11 samples/rubyapp/bin/ruby_app
mole-1.0.7 samples/rubyapp/bin/ruby_app
mole-1.0.8 samples/rubyapp/bin/ruby_app
mole-1.0.6 samples/rubyapp/bin/ruby_app