From da5e7ffe9b6b76f965d3ec01b4bef0c99b7f1955 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 2 Dec 2013 23:30:51 -0500 Subject: v4 v5: rake create build & install sisu gemspec; bin/sisugem (add .gitignore) * rake gemcbi #(create build install sisu gem) * rake gemspecscreate && \ rake gembuild && \ sudo rake geminstall * rake gemspecscreate && \ gem build sisu5.gemspec && \ sudo gem install --no-rdoc --no-ri \ sisu-5.1.0.gem * bin/sisu updated (modified to take account of gems) * bin/sisugem added * .gitignore sisu-*.gem sisu*.gemspec consider inclusion (& tracking) of rake created sisu4.gemspec sisu5.gemspec (as this makes their availability more obvious) * once gem is installed: "sisu _5.1.0_ -vM" (to see version, commands otherwise as usual) if paths are such that sisu is not available "sisugem _5.1.0_ -vM" should work (as it is installed by gemspec, but not other sisu installers) --- .gitignore | 7 + bin/sisu | 25 ++-- bin/sisugem | 1 + data/doc/sisu/CHANGELOG_v4 | 22 +++ data/doc/sisu/CHANGELOG_v5 | 22 +++ lib/sisu/v4/hub.rb | 4 +- lib/sisu/v4/screen_text_color.rb | 3 + lib/sisu/v5/hub.rb | 5 + lib/sisu/v5/screen_text_color.rb | 3 + rbuild | 293 +++++++++++++++++++++++++++++++++++++-- 10 files changed, 361 insertions(+), 24 deletions(-) create mode 100644 .gitignore create mode 120000 bin/sisugem diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b5bf83df --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +*~ +sisu-*.gem +sisu*.gemspec diff --git a/bin/sisu b/bin/sisu index 7dcb09bb..0786500f 100644 --- a/bin/sisu +++ b/bin/sisu @@ -54,31 +54,35 @@ WOK $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_called_from_directory=Dir.pwd - if $0 !~/\bsisu[45]$/ + require 'rubygems' + check_sisu_stable_ruby_version? + if __FILE__ =~/gem/ \ + and __FILE__ =~/sisu-[45]\.\d+\.\d+/ + SiSU_version_dir=(__FILE__ =~/sisu-5\.\d+\.\d+/) \ + ? 'v5' + : 'v4' + elsif $0 !~/\b(?:sisu[45]|sisugem)$/ SiSU_version_dir=case argv.inspect when /"(?:--v4)"/ - check_sisu_stable_ruby_version? 'v4' when /"(?:--v5)"/ - check_sisu_stable_ruby_version? 'v5' - when /"(?:--dev)"/ - check_sisu_dev_ruby_version? + when /"--dev"/ 'v5' else - check_sisu_stable_ruby_version? 'v4' end else SiSU_version_dir=case $0 when /\bsisu4$/ - check_sisu_stable_ruby_version? 'v4' when /\bsisu5$/ - check_sisu_stable_ruby_version? 'v5' + when /sisugem$/ # should have been caught earlier, unused, debug check + SiSU_version_dir=(__FILE__ =~/sisu-5\.\d+\.\d+/) \ + ? 'v5' + : 'v4' else - check_sisu_stable_ruby_version? 'v4' end end @@ -158,6 +162,7 @@ rescue STDERR.puts $! STDERR.puts $@ require 'rbconfig' + require 'rubygems' e=Config::CONFIG puts %{ #{%x{ruby -v}.strip.to_s} @@ -166,6 +171,8 @@ rescue ruby named: #{e['ruby_version']} rubylib: #{e['rubylibdir']} rubylib local: #{e['sitelibdir']} + gem dir: #{Gem.dir} + gem path: #{Gem.path} } system(%{echo " system RUBYPATH: ${RUBYPATH} diff --git a/bin/sisugem b/bin/sisugem new file mode 120000 index 00000000..b4999d51 --- /dev/null +++ b/bin/sisugem @@ -0,0 +1 @@ +sisu \ No newline at end of file diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 9f32230c..7e451e0a 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -30,6 +30,28 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.13.orig.tar.xz sisu_4.2.13.orig.tar.xz sisu_4.2.13-1.dsc +* rake create build & install sisu gemspec; bin/sisugem (add .gitignore) + * rake gemcbi #(create build install sisu gem) + * rake gemspecscreate && \ + rake gembuild && \ + sudo rake geminstall + * rake gemspecscreate && \ + gem build sisu5.gemspec && \ + sudo gem install --no-rdoc --no-ri \ + sisu-5.1.0.gem + * bin/sisu updated (modified to take account of gems) + * bin/sisugem added + * .gitignore sisu-*.gem sisu*.gemspec + consider inclusion (& tracking) of rake created sisu4.gemspec sisu5.gemspec + (as this makes their availability more obvious) + * once gem is installed: "sisu _5.1.0_ -vM" (to see version, commands + otherwise as usual) if paths are such that sisu is not available + "sisugem _5.1.0_ -vM" should work (as it is installed by gemspec, but not + other sisu installers) + +* hub, sisu4 -M (maintenance mode) provide info as to path to hub.rb (i.e. where + library is being drawn) + %% 4.2.12.orig.tar.xz (2013-11-08:44/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.12 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.12-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index b2c2be4c..04412472 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -42,6 +42,28 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.1.0.orig.tar.xz * xmlns xlink using xl +* rake create build & install sisu gemspec; bin/sisugem (add .gitignore) + * rake gemcbi #(create build install sisu gem) + * rake gemspecscreate && \ + rake gembuild && \ + sudo rake geminstall + * rake gemspecscreate && \ + gem build sisu5.gemspec && \ + sudo gem install --no-rdoc --no-ri \ + sisu-5.1.0.gem + * bin/sisu updated (modified to take account of gems) + * bin/sisugem added + * .gitignore sisu-*.gem sisu*.gemspec + consider inclusion (& tracking) of rake created sisu4.gemspec sisu5.gemspec + (as this makes their availability more obvious) + * once gem is installed: "sisu _5.1.0_ -vM" (to see version, commands + otherwise as usual) if paths are such that sisu is not available + "sisugem _5.1.0_ -vM" should work (as it is installed by gemspec, but not + other sisu installers) + +* hub, sisu5 -M (maintenance mode) provide info as to path to hub.rb (i.e. where + library is being drawn) + %% 5.0.25.orig.tar.xz (2013-11-08:44/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.25 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.25-1 diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index ebe9ccf4..5965994f 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -388,7 +388,6 @@ module SiSU SiSU_Source::SiSUpodSource.new(@opt).read end if @opt.act[:share_source][:set]==:on -#REDO require_relative 'share_src' # -s share_src.rb begin ensure @@ -516,6 +515,9 @@ module SiSU SiSU_Env::InfoProcessingFlag.new if @opt.act[:version_info][:set]==:on #% version information SiSU_Env::InfoAbout.new(@opt).sisu_version + if @opt.cmd =~/[vVM]/ + SiSU_Screen::Ansi.new(@opt.cmd,' ' + File.dirname(__FILE__)).grey + end end if @opt.act[:dal][:set]==:on \ or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C diff --git a/lib/sisu/v4/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb index ea9ae24d..5e395133 100644 --- a/lib/sisu/v4/screen_text_color.rb +++ b/lib/sisu/v4/screen_text_color.rb @@ -253,6 +253,9 @@ module SiSU_Screen %{#{@cX.off} } + %{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.} end + def grey + puts "#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}" + end def txt_white puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}" end diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb index 256210df..c158f214 100644 --- a/lib/sisu/v5/hub.rb +++ b/lib/sisu/v5/hub.rb @@ -523,6 +523,11 @@ module SiSU SiSU_Env::InfoProcessingFlag.new if @opt.act[:version_info][:set]==:on #% version information SiSU_Env::InfoAbout.new(@opt).sisu_version + if (@opt.act[:verbose][:set]==:on \ + || @opt.act[:verbose_plus][:set]==:on \ + || @opt.act[:maintenance][:set]==:on) + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],' ' + File.dirname(__FILE__)).grey + end end if @opt.act[:dal][:set]==:on \ or @opt.act[:maintenance][:set]==:on #% --maintenance, -m for -C diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index 4e4a319f..1d9de72c 100644 --- a/lib/sisu/v5/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -244,6 +244,9 @@ module SiSU_Screen %{#{@cX.off} } + %{#{@cX.cyan}nav only: #{@txt[4]}#{@cX.off}.} end + def grey + puts "#{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.cyan}#{@txt[1]}#{@cX.off}" + end def txt_white puts "\t#{@cX.white}#{@txt[0]}#{@cX.off} #{@cX.white}#{@txt[1]}#{@cX.off}" end diff --git a/rbuild b/rbuild index 084d3ad7..f2cc6638 100644 --- a/rbuild +++ b/rbuild @@ -147,15 +147,17 @@ def chmod_util(place) end end #%% using a directory and its mapping -def setup_find_create(dir_get,dir_put) #primary, +def setup_find_create(dir_get,dir_put,exclude_files=['']) #primary, 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) - cp(f,place) - chmod_file(place) - "-> #{dir_put}/" + unless f =~/#{exclude_files.inspect}/ + cp(f,place) + chmod_file(place) + "-> #{dir_put}/" + end when File.directory?(f) FileUtils.mkpath(place) unless FileTest.directory?(place) "./#{dir_get}/" @@ -202,6 +204,212 @@ def system_info WOK end +def sisu_version_info + def version_file + def v4 + 'data/sisu/v4/v/version.yml' + #"#{Dir.pwd}/data/sisu/v4/v/version.yml" + end + def v5 + 'data/sisu/v5/v/version.yml' + end + self + end + def v4 + v="#{Dir.pwd}/#{version_file.v4}" + if File.exist?(v) + YAML::load(File::open(v)) + else '' + end + end + def v5 + v="#{Dir.pwd}/#{version_file.v5}" + if File.exist?(v) + YAML::load(File::open(v)) + else '' + end + end + def current + puts v4 + puts v5 + end + def system_date + `date "+%Y-%m-%d"`.strip + end + def system_date_stamp + `date "+%Yw%W/%u"`.strip + end + def set + def v4 + { + project: 'SiSU', + version: '4.2.13', + date: "#{system_date}", + date_stamp: "#{system_date_stamp}", + } + end + def v5 + { + project: 'SiSU', + version: '5.0.26', + date: "#{system_date}", + date_stamp: "#{system_date_stamp}", + } + end + def version_info_commit(filename,versioninfo,newversioninfo,existingversioninfo,version_file_is) + ans=%{update sisu version info replacing: + #{existingversioninfo.sort} +with: + #{newversioninfo.sort} + +#{version_file_is} becoming: +#{versioninfo} +proceed? } + resp=answer?(ans) + exit unless resp + fn="#{Dir.pwd}/#{filename}" + if File.writable?("#{Dir.pwd}/.") + file_version=File.new(fn,'w+') + file_version << versioninfo + file_version.close + else + puts %{*WARN* is the file or directory writable? could not create #{filename}} + end + end + def commit_v4 + versioninfo= <<-WOK +--- +:version: #{sisu_version_info.v4[:version]} +:date_stamp: #{sisu_version_info.v4[:date_stamp]} +:date: "#{sisu_version_info.v4[:date]}" +:project: #{sisu_version_info.v4[:project]} + WOK + puts version_file.v4 + version_info_commit(version_file.v4,versioninfo,set.v4,sisu_version_info.v4,version_file.v4) + end + def commit_v5 + versioninfo= <<-WOK +--- +:version: #{sisu_version_info.v5[:version]} +:date_stamp: #{sisu_version_info.v5[:date_stamp]} +:date: "#{sisu_version_info.v5[:date]}" +:project: #{sisu_version_info.v5[:project]} + WOK + puts version_file.v5 + version_info_commit(version_file.v5,versioninfo,set.v5,sisu_version_info.v5,version_file.v5) + end + def date_info + end + def changelog_header + def v4 + <<-WOK +%% #{sisu_version_info.v4[:version]}.orig.tar.xz (#{sisu_version_info.v4[:date]}:#{sisu_version_info.v4[:date_stamp]}) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v4[:version]} +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v4[:version]}-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v4[:version]}-1.dsc + WOK + end + def v5 + <<-WOK +%% #{sisu_version_info.v5[:version]}.orig.tar.xz (#{sisu_version_info.v5[:date]}:#{sisu_version_info.v5[:date_stamp]}) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v5[:version]} +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v5[:version]}-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v5[:version]}-1.dsc + WOK + end + self + end + self + end + self +end +def version_update_manual + puts 'date: ' + `date "+%Y-%m-%d"` + puts 'date_stamp: ' + `date "+%Yw%W/%u"` +end +def gemspecs + def sisu4 + <<-WOK +Gem::Specification.new do |s| + s.name = '#{sisu_version_info.v4[:project].downcase}' + s.version = '#{sisu_version_info.v4[:version]}' + s.date = '#{sisu_version_info.v4[:date]}' + s.summary = '#{sisu_version_info.v4[:project]}' + s.description = 'SiSU gem' + s.authors = ["Ralph Amissah"] + s.email = 'ralph.amissah@gmail.com' + s.files = Dir['lib/sisu/v4/*.rb'] + + Dir['lib/sisu/v5/*.rb'] + + Dir['data/sisu/v4/v/version.yml'] + + Dir['data/sisu/v5/v/version.yml'] + + Dir['bin/sisugem'] + + Dir['bin/sisu'] + s.license = 'GPL3' + s.executables << 'sisugem' << 'sisu' +end + WOK + end + def sisu5 + <<-WOK +Gem::Specification.new do |s| + s.name = '#{sisu_version_info.v5[:project].downcase}' + s.version = '#{sisu_version_info.v5[:version]}' + s.date = '#{sisu_version_info.v5[:date]}' + s.summary = '#{sisu_version_info.v5[:project]}' + s.description = 'SiSU gem' + s.authors = ["Ralph Amissah"] + s.email = 'ralph.amissah@gmail.com' + s.files = Dir['lib/sisu/v4/*.rb'] + + Dir['lib/sisu/v5/*.rb'] + + Dir['data/sisu/v4/v/version.yml'] + + Dir['data/sisu/v5/v/version.yml'] + + Dir['bin/sisugem'] + + Dir['bin/sisu'] + s.license = 'GPL3' + s.executables << 'sisugem' << 'sisu' +end + WOK + end + def gemspec_create(filename,gemspec) + fn="#{Dir.pwd}/#{filename}" + if File.writable?("#{Dir.pwd}/.") + file_sisu_gemspec=File.new(fn,'w+') + file_sisu_gemspec << gemspec + file_sisu_gemspec.close + else + puts %{*WARN* is the file or directory writable? could not create #{filename}} + end + end + def sisu4_gemspec_create + filename='sisu4.gemspec' + gemspec_create(filename,sisu4) + end + def sisu5_gemspec_create + filename='sisu5.gemspec' + gemspec_create(filename,sisu5) + end + def sisu4_build + system(%{ gem build sisu4.gemspec }) + end + def sisu5_build + system(%{ gem build sisu5.gemspec }) + end + def sisu4_install + system(%{ + sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v4[:version]}.gem + }) + end + def sisu5_install + system(%{ + sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v5[:version]}.gem + }) + end + self +end def project_help puts < [:default_notice,:setup_base] #task :default => [:help,:notice,:project] desc "Setup/Install #{@p.name} and try generate a file" @@ -248,6 +456,24 @@ desc "Setup/Install #{@p.name}: bin, lib and conf (no data)" task :setup_base=> [:setup_bin,:setup_lib,:setup_conf,:setup_share,:setup_man,:setup_vim] desc "Setup/Install #{@p.name} bin, lib and conf (no data and no attempt to do postinstall setup)" task :base=> [:setup_base] +desc "check package version" +task :sisuversion => [:sisu_version] +desc "set package version" +task :sisuversionset => [:sisu_version_set] +desc "check gempsec info" +task :gemspec => [:gemspec_info] +desc "create gempsec" +task :gemspecscreate => [:gemspecs_create] +desc "build gem" +task :gembuild => [:gem_build] +desc "install gem" +task :geminstall => [:gem_install] +desc "build and install gem" +task :gembuildinstall => [:gem_build,:gem_install] +desc "create, build and install sisu gem" +task :gemcbi => [:gemspecs_create,:gem_build,:gem_install] +desc "check changelog headers" +task :changelogheaders => [:changelog_headers] if File.directory?('bin') #bin desc "Setup #{@p.name} bin only, synonym :bin" task :bin => [:setup_bin] @@ -297,10 +523,6 @@ if File.directory?('conf') #conf desc "Remove #{@p.name} conf only" #remove conf task :remove_conf => [:remove_conf] end -#if File.directory?('data') #data -# desc "Remove #{@p.name} data only" #remove data -# task :remove_data => [:remove_data] -#end desc "Re-setup #{@p.name}, synonym :reinstall" #resetup reinstall task :resetup => [:remove, :setup] task :reinstall => [:remove, :setup] @@ -345,8 +567,6 @@ task :help => [:project_help,:system_info,:tasks] #desc "Setup/Install #{@p.name} (uses filelist)" task :install => [:default_notice,:project] task :install_bin => [:setup_bin] -desc '[make rant independent install file]' -task :create_rant_independent_task_file => [:rant_independence] #%% setup/install tasks task :rant_independence do #notice resp='' @@ -381,7 +601,8 @@ task :default2 do #secondary 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') + exclude_files=['sisugem'] + setup_find_create('bin',@p.dir.bin,exclude_files) if File.directory?('bin') end task :setup_lib do #lib setup_find_create('lib',@p.dir.lib) if File.directory?('lib') @@ -401,6 +622,50 @@ task :setup_man do #man end task :setup_vim do #man setup_find_create('data/vim',@p.dir.vim) if File.directory?('data/vim') #man pages +end +task :gemspec_info do #man + version_update_manual + gemspecs.sisu4 + gemspecs.sisu5 +end +task :gemspecs_create do #man + gemspecs.sisu4_gemspec_create + gemspecs.sisu5_gemspec_create +end +task :gem_build do #man + gemspecs.sisu4_build + gemspecs.sisu5_build +end +task :gem_install do #man + gemspecs.sisu4_install + gemspecs.sisu5_install +end +task :changelog_headers do #man + puts '---' + puts sisu_version_info.set.changelog_header.v4 + puts '---' + puts sisu_version_info.set.changelog_header.v5 +end +task :sisu_version do #man + puts sisu_version_info.set.v4 + puts sisu_version_info.set.v5 + puts sisu_version_info.current + #version.current.each do |x| + # puts x + #end + puts sisu_version_info.v4[:project] + puts sisu_version_info.v4[:version] + puts sisu_version_info.v4[:date] + puts sisu_version_info.v4[:date_stamp] + puts '---' + puts sisu_version_info.v5[:project] + puts sisu_version_info.v5[:version] + puts sisu_version_info.v5[:date] + puts sisu_version_info.v5[:date_stamp] +end +task :sisu_version_set do #man + sisu_version_info.set.commit_v4 + sisu_version_info.set.commit_v5 end #%% post install #%% clobber/remove tasks -- cgit v1.2.3