aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--rbuild165
1 files changed, 84 insertions, 81 deletions
diff --git a/rbuild b/rbuild
index 00dab443..a5d17478 100644
--- a/rbuild
+++ b/rbuild
@@ -55,54 +55,57 @@ class Project_details
def platform_notice
"[#{name} is for the Linux/Unix Platforms]"
end
- def dir_proj
- 'sisu'
- end
def env
Config::CONFIG
end
def host
env['host']
end
- def dir_arch
- env['archdir']
- end
- def dir_sitearch
- env['sitearchdir']
- end
- def dir_bin
- env['bindir']
- end
- def dir_lib
- env['sitelibdir']
- end
- def dir_data
- env['datadir']
- end
- def dir_share
- "#{env['datadir']}/sisu"
- end
- def dir_conf
- env['sysconfdir']
- end
- def dir_man
- env['mandir']
- end
- def dir_vim
- "#{env['datadir']}/sisu/vim"
- end
- def dir_out
- "#{env['localstatedir']}/#{dir_proj}"
- end
- def dir_rubylib
- env['LIBRUBYARG_SHARED']
- end
- def dir_pwd
- Dir.pwd #ENV['PWD']
+ def dir
+ def proj
+ 'sisu'
+ end
+ def arch
+ env['archdir']
+ end
+ def sitearch
+ env['sitearchdir']
+ end
+ def bin
+ env['bindir']
+ end
+ def lib
+ env['sitelibdir']
+ end
+ def data
+ env['datadir']
+ end
+ def share
+ "#{env['datadir']}/sisu"
+ end
+ def conf
+ env['sysconfdir']
+ end
+ def man
+ env['mandir']
+ end
+ def vim
+ "#{env['datadir']}/sisu/vim"
+ end
+ def out
+ "#{env['localstatedir']}/#{proj}"
+ end
+ def rubylib
+ env['LIBRUBYARG_SHARED']
+ end
+ def pwd
+ Dir.pwd #ENV['PWD']
+ end
+ self
end
def version
stamp={}
- v="#{dir_pwd}/conf/sisu/version.yml"
+ v="#{dir.pwd}/conf/sisu/version.yml"
version=if File.exist?(v)
stamp=YAML::load(File::open(v))
stamp[:version]
@@ -151,8 +154,8 @@ def chmod_util(place)
end
#%% using a directory and its mapping
def setup_find_create(dir_get,dir_put) #primary,
- Find.find("#{@p.dir_pwd}/#{dir_get}") do |f|
- stub=f.scan(/#{@p.dir_pwd}\/#{dir_get}\/(\S+)/).join
+ Find.find("#{@p.dir.pwd}/#{dir_get}") do |f|
+ stub=f.scan(/#{@p.dir.pwd}\/#{dir_get}\/(\S+)/).join
place="#{dir_put}/#{stub}"
action=case
when File.file?(f)
@@ -168,8 +171,8 @@ def setup_find_create(dir_get,dir_put) #primary,
end
end
def setup_find_cp_r(dir_get,dir_put) #secondary, using recursive copy
- Find.find("#{@p.dir_pwd}/#{dir_get}") do |f|
- stub=f.scan(/#{@p.dir_pwd}\/#{dir_get}\/(\S+)/).join
+ Find.find("#{@p.dir.pwd}/#{dir_get}") do |f|
+ stub=f.scan(/#{@p.dir.pwd}\/#{dir_get}\/(\S+)/).join
place="#{dir_put}/#{stub}"
case
when File.file?(f)
@@ -186,22 +189,22 @@ def system_info
Host
host: #{@p.host}
- arch: #{@p.dir_arch}
- sitearch: #{@p.dir_sitearch}
+ arch: #{@p.dir.arch}
+ sitearch: #{@p.dir.sitearch}
Directories for installation
- bin: #{@p.dir_bin}
- lib (site-ruby): #{@p.dir_lib}/#{@p.dir_proj}/v*
- conf [etc]: #{@p.dir_conf}/#{@p.dir_proj}
- data (odf, shared images): #{@p.dir_share}
- vim (vim syntax, highlighting, ftplugin): #{@p.dir_data}/sisu/vim
- data (README, version_manifest): #{@p.dir_data}/doc/#{@p.dir_proj}
- man (manual pages): #{@p.dir_man}
- output: #{@p.dir_out}
- processing: #{@p.dir_out}/processing
- www: #{@p.dir_out}/www
+ bin: #{@p.dir.bin}
+ lib (site-ruby): #{@p.dir.lib}/#{@p.dir.proj}/v*
+ conf [etc]: #{@p.dir.conf}/#{@p.dir.proj}
+ data (odf, shared images): #{@p.dir.share}
+ vim (vim syntax, highlighting, ftplugin): #{@p.dir.data}/sisu/vim
+ data (README, version_manifest): #{@p.dir.data}/doc/#{@p.dir.proj}
+ man (manual pages): #{@p.dir.man}
+ output: #{@p.dir.out}
+ processing: #{@p.dir.out}/processing
+ www: #{@p.dir.out}/www
- rubylib: #{@p.dir_rubylib}
+ rubylib: #{@p.dir.rubylib}
WOK
end
@@ -375,59 +378,59 @@ task :default_notice do #notice
default_notice
end
task :default2 do #secondary
- setup_find_cp_r('bin',@p.dir_bin) if File.directory?('bin')
- setup_find_cp_r('lib',@p.dir_lib) if File.directory?('lib')
- setup_find_cp_r('conf',@p.dir_conf) if File.directory?('conf')
- setup_find_cp_r('data/sisu',@p.dir_share) if File.directory?('data/sisu') #
- setup_find_cp_r('data',@p.dir_data) if File.directory?('data')
- setup_find_cp_r('data/vim',"#{@p.dir_data}/vim") if File.directory?('data/vim')
- setup_find_cp_r('man',@p.dir_man) if File.directory?('man')
+ setup_find_cp_r('bin',@p.dir.bin) if File.directory?('bin')
+ setup_find_cp_r('lib',@p.dir.lib) if File.directory?('lib')
+ setup_find_cp_r('conf',@p.dir.conf) if File.directory?('conf')
+ setup_find_cp_r('data/sisu',@p.dir.share) if File.directory?('data/sisu') #
+ setup_find_cp_r('data',@p.dir.data) if File.directory?('data')
+ setup_find_cp_r('data/vim',"#{@p.dir.data}/vim") if File.directory?('data/vim')
+ setup_find_cp_r('man',@p.dir.man) if File.directory?('man')
end
task :setup_bin do #bin
- setup_find_create('bin',@p.dir_bin) if File.directory?('bin')
+ setup_find_create('bin',@p.dir.bin) if File.directory?('bin')
end
task :setup_lib do #lib
- setup_find_create('lib',@p.dir_lib) if File.directory?('lib')
+ setup_find_create('lib',@p.dir.lib) if File.directory?('lib')
end
task :setup_conf do #conf
- setup_find_create('conf',@p.dir_conf) if File.directory?('conf')
+ setup_find_create('conf',@p.dir.conf) if File.directory?('conf')
end
task :setup_share do #share
- setup_find_create('data/sisu',@p.dir_share) if File.directory?('data/sisu')
+ setup_find_create('data/sisu',@p.dir.share) if File.directory?('data/sisu')
end
task :setup_data do #data
- setup_find_create('data',@p.dir_data) if File.directory?('data')
+ setup_find_create('data',@p.dir.data) if File.directory?('data')
end
task :setup_man do #man
- setup_find_create('man',@p.dir_man) if File.directory?('man') #man pages
- setup_find_create('man.deb/man',@p.dir_man) if File.directory?('man.deb/man') #man pages
+ setup_find_create('man',@p.dir.man) if File.directory?('man') #man pages
+ setup_find_create('man.deb/man',@p.dir.man) if File.directory?('man.deb/man') #man pages
end
task :setup_vim do #man
- setup_find_create('data/vim',@p.dir_vim) if File.directory?('data/vim') #man pages
+ setup_find_create('data/vim',@p.dir.vim) if File.directory?('data/vim') #man pages
end
#%% post install
#%% clobber/remove tasks
task :remove_bin do
- rm_r "#{@p.dir_bin}/#{@p.dir_proj}" if FileTest.file?("#{@p.dir_bin}/#{@p.dir_proj}")
+ rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
end
task :remove_lib do
- rm_r "#{@p.dir_lib}/#{@p.dir_proj}" if FileTest.directory?("#{@p.dir_lib}/#{@p.dir_proj}")
+ rm_r "#{@p.dir.lib}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}")
end
task :remove_conf do
- rm_r "#{@p.dir_conf}/#{@p.dir_proj}" if FileTest.directory?("#{@p.dir_conf}/#{@p.dir_proj}")
+ rm_r "#{@p.dir.conf}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :remove_man do
- rm_r "#{@p.dir_man}/**/#{@p.dir_proj}" if FileTest.directory?("#{@p.dir_man}/man1/#{@p.dir_proj}")
+ rm_r "#{@p.dir.man}/**/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.man}/man1/#{@p.dir.proj}")
end
task :remove_version do
- rm_r "#{@p.dir_bin}/#{@p.dir_proj}" if FileTest.file?("#{@p.dir_bin}/#{@p.dir_proj}")
- rm_r "#{@p.dir_lib}/#{@p.dir_proj}/#{@p.version}" if FileTest.directory?("#{@p.dir_lib}/#{@p.dir_proj}/#{@p.version}")
- rm_r "#{@p.dir_conf}/#{@p.dir_proj} if FileTest.directory?("#{@p.dir_conf}/#{@p.dir_proj}")
+ rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
+ rm_r "#{@p.dir.lib}/#{@p.dir.proj}/#{@p.version}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}/#{@p.version}")
+ rm_r "#{@p.dir.conf}/#{@p.dir.proj} if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :remove_package do
- rm_r "#{@p.dir_bin}/#{@p.dir_proj}" if FileTest.file?("#{@p.dir_bin}/#{@p.dir_proj}")
- rm_r "#{@p.dir_lib}/#{@p.dir_proj}" if FileTest.directory?("#{@p.dir_lib}/#{@p.dir_proj}")
- rm_r "#{@p.dir_conf}/#{@p.dir_proj}" if FileTest.directory?("#{@p.dir_conf}/#{@p.dir_proj}")
+ rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
+ rm_r "#{@p.dir.lib}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}")
+ rm_r "#{@p.dir.conf}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :post_install_note do
puts <<WOK