#102 ✓resolved
bahuvrihi

single require to use like optparse

Reported by bahuvrihi | September 10th, 2008 @ 10:14 AM | in Tap-0.11.0

This is the suggestion John made; have a single file to require that effectively will allow a file to define and launch a task, so that the task basically serves as an option parser.

Comments and changes to this ticket

  • bahuvrihi

    bahuvrihi September 12th, 2008 @ 11:50 AM

    • State changed from “new” to “resolved”
    • Assigned user set to “bahuvrihi”

    Ok, so it works like this:

    
    #!/usr/bin/env ruby
    
    require 'rubygems'
    require 'tap'
    
    # Goodnight::manifest your basic goodnight moon task
    # Says goodnight with a configurable message.
    Tap.tasc('goodnight', :message => 'goodnight') do |name|
      log message, name
      "#{message} #{name}"
    end.execute
    
  • bahuvrihi

    bahuvrihi September 13th, 2008 @ 12:38 PM

    Maybe even better (so that the class definition can be used in other context without executing):

    
    
    #!/usr/bin/env ruby
    
    require 'rubygems'
    require 'tap'
    
    # Goodnight::manifest your basic goodnight moon task
    # Says goodnight with a configurable message.
    Tap.tasc('goodnight', :message => 'goodnight') do |name|
      log message, name
      "#{message} #{name}"
    end
    
    Goodnight.execute if __FILE__ == $0
    
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A framework for making configurable, file-based tasks and workflows.

People watching this ticket

Tags

Pages