#134 new
bahuvrihi

Light-Tap

Reported by bahuvrihi | December 30th, 2008 @ 12:05 PM

It would be nice to have a light tap task that will compile tap into a single script for quick loading, and to 'freeze' a particular distribution.


desc "Compiles tap into a single rb script"
task :compile do
  # interesting proposal -- much, much quicker loading on 
  # windows where reading files is apparently quite slow.
  #
  # Notes:
  # - Task files should not be included since they may contain
  #   manifest information that implicitly uses the path name.
  # - Autoloaded files should not be included either (and in 
  #   some cases maybe a require should be turned into an 
  #   autoload?)
  #
  @@sources = {}
  def require(file)
    result = super
    
    tap_file = "#{File.dirname(__FILE__)}/lib/#{file}.rb"
    return result unless File.exists?(tap_file)
    
    content = File.read(tap_file)
    content.gsub!(/^require\s+['"](.*)['"]$/) do |match|
      @@sources.has_key?($1) ? @@sources[$1] : match
    end
    @@sources[file] = content
    
    result
  end
  
  require 'tap'
  File.open("taq.rb", "w") do |target|
    target << @@sources['tap'].gsub(/\r?\n^\s*\#.*$/, "")
  end
end

Comments and changes to this ticket

  • bahuvrihi

    bahuvrihi January 3rd, 2009 @ 01:17 PM

    You could compile a tap or rap executable using this method, and get seamless functionality.

  • bahuvrihi

    bahuvrihi February 14th, 2009 @ 11:21 PM

    • Tag set to tap-tasks

    LiteTap

    Task

    • App
    • Root
    • Minimap
    • ExecutableQueue
    • Dependencies
    • Aggregator
    • Executable
    • Dependency
    • Audit
    • Configurable
    • Lazydoc
    • Intern
    • Joins

    Optional

    • FileTask
    • ShellUtils
    • Tasks

    No

    • Manifest
    • Node
    • Parser
    • Schema
    • TDoc
    • Env
    • Exe
    • Generators
    • Declarations
    • Spec
    • Test

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