Sha256: 5062f0689a4c4ff69ed72938020ecf403c9d6468fc8588c1d2075534441b2d33

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

# = Reap

#--
# NOTE With the latest rendition of Reap the Reap module
# is not used as much. Perhaps Tasks and TaskSpace should
# move into it but for the moment they are more convenient
# outside of it.
#++

module Reap
  Version = "6.0.0"
end

require 'facet/hash/to_proc'
require 'facet/kernel/require_all'

# Reap project information object.
require 'reap/projectinfo'

# Prime ProjectInfo by moving to file's location.
located = ProjectInfo.prime_location

# Load task system.
require 'facets/more/taskable'

# Load built-in tasks.
require 'reap/tasks'

# Load custom project tasks.
if located
  require_all('./task/*') if File.directory?('task')
end

# Setup YAML load types based on task generators.
Tasks.public_instance_methods(false).each do |type|
#Task.singleton_methods(true).each do |type|
  YAML.add_private_type( type.to_s ) do |syck_type, data|
    data = {} if data == "" or data.nil?
    data[:task_type] = type
    data
  end
end

# Load the ProjectInfo file.
ProjectInfo.instance

# Create the tasks.
module TaskSpace

  # Tasks acts as our DSL for task generation.
  extend Tasks

  # Include the tools tasks use.
  include Reap::TaskUtils

  # Look up all defined task with descriptions.
  def self.visible_tasks
    described_tasks
  end

  # Look up all defined task without descriptions.
  def self.hidden_tasks
    undescribed_tasks
  end

  # Create specialty tasks (don't neccessarily require manual definition)
  Tasks.available.each do |type, cond|
    if cond.call
      send( type, type.to_s )
    end
  end

  # Create all tasks as define in the ProjectInfo file.
  ProjectInfo.instance.each do |name, value|
    if Hash === value and value.key?(:task_type)
      desc( value['desc'] ) if value.key?('desc')  # desc okay?
      send( value[:task_type], name, &value )
    end
  end

  # Create any tasks define by a Reapfile script.
  [ 'Reapfile', 'reapfile', 'REAPFILE' ].each do |f|
    if File.file?(f)
      module_eval( File.read(f) )
      break
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reap-6.0.0 lib/reap/reap.rb
reap-6.0.1 lib/reap/reap.rb
reap-6.0.2 lib/reap/reap.rb