#102 ✓resolved
bahuvrihi

single require to use like optparse

Reported by bahuvrihi | 2008-09-10 10:14:16 UTC | 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 2008-09-12 11:50:58 UTC

    • 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 2008-09-13 12:38:32 UTC

    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