Sha256: 495122af6d0606d5d88e7efe94e5c7954efb18878e70aa1a2b745304fa7beb60

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require 'reap/task'
require 'facet/gem/self/gempath'

class Reap::Template < Reap::Task

  task_desc "Create a ProjectInfo template."

  task_help %{

    reap template

    Creates an empty PrjectInfo file in the current directory.
    It will not overwrite a PrjectInfo file if one is already 
    present.

  }

  task_available { ! Reap.projectfile? }

  # Copies the file from lib/data to the current dir.

  def run
    f = nil
    if ::ProjectInfo::INFO_FILES.any?{ |f| File.exists?(f) }
      puts "Project file '#{f}' already exists."
      return
    end
    filename = 'ProjectInfo'
    # if using gems
    if dir = Gem.gempath('reap')
      dir = File.join( dir, 'data', 'reap', 'scaffold', 'standard' )
    else
      dir = File.join( ::Config::CONFIG['datadir'], 'reap', 'scaffold', 'standard' )
    end
    f = File.join( dir, filename )
    raise "ProjectInfo template file #{f} is missing." unless File.file?( f )
    # copy
    FileUtils.install( f, '.' )
    tell "#{filename} created. You'll need to fill it out."
    return nil
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
reap-4.5.2 lib/reap/task/template.rb