# ___ __ __ _ _ _____ _ # / __| __ __ _ / _|/ _|___| |__| | |_ _|_ _ __| |__ # \__ \/ _/ _` | _| _/ _ \ / _` | | |/ _` (_-< / / # |___/\__\__,_|_| |_| \___/_\__,_| |_|\__,_/__/_\_\ # # Current scaffold task just copies a folder. This incomplete # version was an idea for dynamically creating the scaffolding # instead. #require 'rbconfig' module Scaffold extend self SVNPaths => %w{ trunk branch tag scrap package } TrunkPaths = %w{ bin lib ext conf data test note sample } TrunkFiles = %w{ README INSTALL COPYING ProjectInfo ChangeLog Todo RakeFile setup.rb } def init( scf ) scf.name ||= 'yourlib.projectdomain.org' end def run( scf ) t = Time.now.strftime("%Y-%m-%d") libdir = File.join( 'lib', "#{@name},#{t}" ) if @scm SCMPaths.each { |d| makedir( d ) } Dir.chdir 'trunk' end TrunkPaths.each { |d| makedir( d ) } makedir_with_check( libdir ) TrunkFiles.each { |f| temlpate( f ) } end private # Copy a file from lib/data to the current dir. def template( filename ) dir = File.join( File.dirname(__FILE__), 'data' ) #dir = File.join( ::Config::CONFIG['datadir'], DATA_DIR ) f = File.join( dir, filename ) unless File.file?( f ) puts f raise "Tempfile is missing." end if File.exists?(filename) puts "#{filename} already exists." return end # copy tmpf to Reapfile FileUtils.cp( f, filename ) #puts "#{filename} created. You'll need to fill it out." end # Make a directory as long as it doesn't already exist. def makedir( dir ) FileUtils.makedir_p( dir ) unless File.directory?( dir ) end end =begin def scaffold require 'reap/scaffold' name = domain = Scaffold.go( name, domain ) end def template( file_name = ProjectInfo ) #dir = File.dirname(File.dirname(__FILE__)) dir = File.join( ::Config::CONFIG['datadir'], DATA_DIR ) tmpf = File.join( dir, 'template.yaml' ) unless File.file?( tmpf ) puts tmpf raise "Tempfile is missing." end if File.directory?(filename) puts "#{filename} a directory. Cannot comply." return elsif File.file?(filename) puts "#{filename} already exists." return end # copy tmpf to Reapfile FileUtils.cp( tmpf, filename ) puts "#{filename} created. You'll need to fill it out." end =end