#!/usr/bin/env ruby raise "Please, use ruby1.8.0 or later." if RUBY_VERSION < "1.8.0" ##!/usr/bin/ruby1.9 #raise "Please, use ruby1.9.0 or later." if RUBY_VERSION < "1.9.0" =begin Rantfile mapping setup.rb directory structure SiSU Simple information Structuring Universe, Serialised information, Structured Units * SiSU at present is for the Linux/Unix platform * See homepage at: << http://www.jus.uio.no/sisu/SiSU >> * & << http://www.jus.uio.no/sisu/download >> * & << http://www.jus.uio.no/sisu/development >> Rant is a Ruby 'ant' by Stefan Lang For Setup/Installation SiSU uses either: * Minero Aoki's setup.rb, provided along with SiSU, or * Rant which may be downloaded and installed from: http://make.rubyforge.org/ * Name: Rant install/setup file for SiSU - Simple information Structuring Universe, Serialised information Structured Units * * Author: Ralph@Amissah.com * Description: Rant install/setup file which maps directory structure used by setup.rb * arch-tag: Rant install/setup file which maps directory structure used by setup.rb * $Id: Rantfile,v 1.2 2006/01/24 01:55:35 ralph Exp ralph $ Copyright (C) 2005 Ralph Amissah (first release edition) Copyright (C) 1997 Ralph Amissah (first edition) * SiSU is released under a dual License: Dual License: (i) GPL 2 or later, for non-commercial use of the program and publications (ii) Distributed under a commercial license for everything else, (terms to be determined), that is for everything that is not (i) Summary of GPL 2 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA If you have Internet connection, the latest version of the GPL should be available at these locations: http://www.fsf.org/licenses/gpl.html http://www.gnu.org/copyleft/gpl.html http://www.jus.uio.no/sisu/gpl2.fsf SiSU was first released to the public on January 4th 2005 SiSU uses: * Standard SiSU markup syntax, * Standard SiSU meta-markup syntax, and the * Standard SiSU object citation numbering and system * Ralph Amissah 1997, current 2005. All Rights Reserved. * Ralph Amissah mailto:ralph@amissah.com Ralph Amissah mailto:amissah@gmail.com * NOTE reminder to create independent setup file called install: rant-import --auto install then you can, as root (for default action): ruby install or for help on alternative actions: ruby install help ruby install -T =end #% produce a makefile suitable for the target platform require 'rbconfig' require 'date' require 'find' require 'fileutils' require 'rbconfig.rb' include FileUtils::Verbose pf='rant/plugin/postfix.rb' if File.file?(pf) require pf include Post @postfix=true else @postfix=false end @dir=Hash.new @proj=Hash.new @proj[:name]='SiSU' @proj[:rant]="Rantfile for the darcs-buildpackage debianisation of #{@proj[:name]}" @dir[:proj]='sisu' @dir[:proj_eg]='sisu-examples' @dt=Date.today.to_s @t=Time.now day=if @t.day.to_s =~/^(\d)$/; "0#{$1}" else @t.day.to_s end month=if @t.month.to_s =~/^(\d)$/; "0#{$1}" else @t.month.to_s end @ymd="#{@t.year}#{month}#{day}" @w=@t.strftime("%W") @weekonly=@w @week="#{@t.year}w#@w" @monthonly=month @month="#{@t.year}#{@t.month}" @year=@t.year d=@t.wday @week_stamp="#{@t.year}w#@w" #@week_stamp=@t.strftime("%Yw%W") @week_slash_day="#@week_stamp/#{d}" @week_dash_day="#@week_stamp-#{d}" @host=Config::CONFIG['host'] @pwd=Dir.pwd @dir[:arch]=Config::CONFIG['archdir'] @dir[:sitearch]=Config::CONFIG['sitearchdir'] @dir[:bin]=Config::CONFIG['bindir'] @dir[:lib]=Config::CONFIG['sitelibdir'] @dir[:data]=Config::CONFIG['datadir'] @dir[:conf]=Config::CONFIG['sysconfdir'] #etc @dir[:man]=Config::CONFIG['mandir'] @dir[:out]="#{Config::CONFIG['localstatedir']}/#{@dir[:proj]}" @rubylib=Config::CONFIG['LIBRUBYARG_SHARED'] @home=ENV['HOME'] m=/.+\/(\S+)/m @stub_pwd ||=@pwd[m,1] prcss_dir='_sisu_processing' prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" def filelist_array_all pwd=Dir.pwd files=Dir.glob("*.ss[tm]") files end def files_all file_array=filelist_array_all files=file_array.join(' ') files end def filelist_docs files='sisu_manual.ssm sisu_introduction.ssm sisu_help.sst sisu_help_sources.sst sisu_commands.sst sisu_markup.sst sisu_filetypes.sst sisu_config.ssi sisu_skin.sst sisu_css.ssi sisu_content_directories.ssi sisu_homepages.ssi sisu_examples.sst sisu_output_overview.sst sisu_webrick.sst sisu_quickstart.sst sisu_faq.sst sisu_syntax_highlighting.sst sisu_configuration.ssm sisu_description.sst sisu_remote.sst sisu_complete.sst sisu_postgresql.sst sisu_sqlite.sst sisu_pdf.sst sisu_search.ssm sisu_vim.sst sisu_doc.sst' # sisu_outpuman/man7/sisu_doc.7t_types.ssm sisu_sql.sst sisu_hyperestraier.sst sisu_latex.sst sisu_odf.sst sisu_xml.sst sisu_concordance.sst sisu_document_digest_certificate.sst document_digest_certificate.sst sisu_markup_source.sst sisupod.sst files end def filelist_manpage files='sisu.ssm sisu_introduction.ssm sisu_help.sst sisu_help_sources.sst sisu_commands.sst sisu_markup.sst sisu_filetypes.sst sisu_config.ssi sisu_skin.sst sisu_css.ssi sisu_content_directories.ssi sisu_homepages.ssi sisu_examples.ssi sisu_output_overview.sst sisu_webrick.sst sisu_download.ssi sisu_installation.ssi sisu_quickstart.sst sisu_howto.sst sisu_faq.sst sisu_syntax_highlighting.sst sisu_configuration.ssm sisu_remote.sst sisu_complete.sst sisu_postgresql.sst sisu_sqlite.sst sisu_pdf.sst sisu_search.ssm sisu_vim.sst sisu_doc.sst' # sisu_output_types.ssm sisu_sql.sst sisu_hyperestraier.sst sisu_latex.sst sisu_odf.sst sisu_xml.sst sisu_concordance.sst sisu_document_digest_certificate.sst document_digest_certificate.sst sisu_markup_source.sst sisupod.sst #puts files + "\n\n" files end def man_section(files_array,man_no='1') path_man_sisu_output='../../../../../../sisu-doc/doc/manuals_generated/sisu_manual/man' path_man_sisu_package='../../../../../man' files_array.each do |x| y=x.gsub(/(\S+?)\.1$/,"\\1.#{man_no}") unless man_no =~/^1$/ system("mv -v #{path_man_sisu_output}/#{x} #{path_man_sisu_output}/#{y}") end puts "cp -v #{path_man_sisu_output}/#{y} #{path_man_sisu_package}/man#{man_no}/#{y}" #system("cp -v #{path_man_sisu_output}/#{y} #{path_man_sisu_package}/man#{man_no}/#{y}") end end def manpage_move files_man1=['sisu.1','sisu_commands.1','sisu_markup.1','sisu_configuration.1','sisu_webrick.1','sisu_help.1','sisu_help_sources.1','sisu_skin.1'] files_man7=['sisu_complete.1','sisu_doc.1','sisu_postgresql.1','sisu_sqlite.1','sisu_pdf.1','sisu_vim.1'] # 'sisu_output_types.1' 'sisu_sql.1','sisu_hyperestraier.1','sisu_latex.1','sisu_odf.1','sisu_xml.1','sisu_concordance.1','sisu_document_digest_certificate.1','sisu_markup_source.1','sisupod.1' files_man8=['sisu_quickstart.1','sisu_howto.1','sisu_faq.1','sisu_syntax_highlighting.1','sisu_remote.1','sisu_search.1'] man_section(files_man1,'1') man_section(files_man7,'7') man_section(files_man8,'8') end def files_array_docs file_array=filelist_docs.scan(/\S+?\.ss[mt]/) file_array end def files_docs file_array=files_array_docs files=file_array.join(' ') files end def files_array_manpage file_array=filelist_manpage.scan(/\S+?\.ss[mt]/) file_array end def files_manpage file_array=files_array_manpage files=file_array.join(' ') files end def manual system('sisu -CC') files_array_docs.each do |x| puts "sisu -3sS #{x}" system("sisu -3sS #{x}") end end def manual_rsync file_array=files_array_docs puts file_array.join(' ') system('sisu -CC') file_array.each do |x| puts "sisu -3sS #{x}; sisu -R #{x} &" system("sisu -3sS #{x}; sisu -R #{x} & ") end end def manpages puts files_manpage system("sisu -i #{files_manpage}") end def search_update file_array=filelist_search.scan(/\S+/) file_array.each do |x| puts "sisu -Dv --update #{x}" system("sisu -Dv --update #{x}") end end def search_update_sisu file_array=filelist_search_sisu.scan(/\S+/) file_array.each do |x| puts "sisu -Dv --update #{x}" system("sisu -Dv --update #{x}") end end def clean system("rm *._sst footnote_conversion_errors.txt .*.swp") end def zap(filelist) system("sisu -Z #{filelist}") end #% Help etc. def rant_system_info puts < [:gen] task :genlite => [:genlite] desc 'sisu manual' task :manual => [:manual] desc 'sisu man pages' task :manpages => [:manpages] desc 'place sisu man pages' task :manpage_mv => [:manpage_mv] desc 'list of files' task :files => [:filelist] desc 'list of manual files' task :files_docs => [:filelist_docs] desc 'list of manpage files' task :files_man => [:filelist_manpage] desc 'remove output, -Z zap' task :zap => [:filelists_zap] desc 'help' task :help => [:help] task :pwd => [:pwd] task :files_all => [:filelist_all] task :gen do zap(files_all) manual manpages manpage_move clean end task :genlite do zap(files_all) manual manpages clean end task :manpages do manpages manpage_move clean end task :manpage_mv do manpage_move end task :manual do manual clean end task :filelist do puts filelist_docs + "\n\n" + files_docs + "\n\n" + filelist_manpage + "\n\n" + files_manpage end task :filelist_manpage do puts filelist_manpage end task :filelist_docs do puts filelist_docs end task :filelist_all do puts files_all end task :filelists_zap do zap(files_all) end task :help do rant_help end __END__ #path_man_sisu_output='../../../manuals_generated/sisu_manual/man'