#!/usr/bin/ruby # # Ruby script to build the P4Ruby distribution. # $:.unshift( "." ) require "makemodule" require "fileutils" class P4Ruby19 # => Empty constructor def initialize end include P4RubyCommon # Copy a file into a directory - creating the target directories as # required # def filecopy( srcpath, topdir ) dstpath = topdir + "/" + srcpath dstdir = File.dirname( dstpath ) FileUtils.mkdir( dstdir ) unless File.exists?( dstdir ) FileUtils.cp( srcpath, dstpath ) end # # Remove a directory recursively. # def cleanup( path ) FileUtils.remove_entry_secure( path ) if File.exists?( path ) end # # Populate the distribution directory # def populate( build_dir ) Dir.mkdir( build_dir ) or raise( RuntimeError, "Can't create #{build_dir}" ) # # Copy the release notes into 'RELNOTES.txt'. This is ugly, but we need # a way to include the release notes in the distribution, but still store # them in the standard place # FileUtils.cp( @@RELNOTES_PATH, "RELNOTES.txt" ) mfest = File.open( "MANIFEST" ) files = mfest.readlines() mfest.close files.each do |file| file.sub!( /\r?\n/, "" ) filecopy( file, build_dir ) end end end