diff options
| -rwxr-xr-x | qi | 23 | ||||
| -rw-r--r-- | setup/qi_libs.rb | 66 | ||||
| -rw-r--r-- | setup/rbuild_libs.rb | 4 | 
3 files changed, 76 insertions, 17 deletions
| @@ -50,7 +50,8 @@ module SiSUconf        :man => :boolean,        :vim => :boolean,        :alt => :boolean, -      :dryrun => :boolean +      :dryrun => :boolean, +      :is => :boolean      def setup        unless options.length >= 1 \        and not (options[:bin] \ @@ -63,6 +64,10 @@ module SiSUconf          puts 'setup --all --bin --lib --conf --data --share --man --vim'        end        act=(options[:dryrun]) ? (:dryrun) : (:action) +      if options[:is] +        puts Version_info.version_number_info_stable +        puts Version_info.version_number_info_unstable +      end        if not options[:alt]          if options[:all] \          or options[:bin] @@ -185,9 +190,13 @@ module SiSUconf        :unstable => :boolean,        :create => :boolean,        :build => :boolean, -      :install => :boolean +      :install => :boolean, +      :is => :boolean      def gem        if options[:unstable] +        if options[:is] +          puts Version_info.version_number_info_unstable +        end          if options[:create]            Gemspecs::Current.create_unstable            #Gemspecs::Next.create_unstable @@ -209,6 +218,9 @@ module SiSUconf        end        if options[:stable] \        or not options[:unstable] +        if options[:is] +          puts Version_info.version_number_info_stable +        end          if options[:create]            Gemspecs::Current.create_stable            #Gemspecs::Current.create_unstable @@ -239,8 +251,13 @@ module SiSUconf      options \        :open_version=> :boolean,        :version_and_tag_for_release=> :boolean, -      :tip => :boolean +      :tip => :boolean, +      :is => :boolean      def pkg +      if options[:is] +        puts Version_info.version_number_info_stable +        puts Version_info.version_number_info_unstable +      end        if options[:tip]          Package.sequence        end diff --git a/setup/qi_libs.rb b/setup/qi_libs.rb index 90359a5c..9d11cecd 100644 --- a/setup/qi_libs.rb +++ b/setup/qi_libs.rb @@ -5,6 +5,9 @@ module Project_details    def self.name      'SiSU'    end +  def self.description +    'documents - structuring, publishing in multiple formats and search' +  end    def self.thor      "ruby-thor files for the installation/setup of #{name}"    end @@ -207,6 +210,40 @@ module Version_info  :date: "#{vi[:date]}"      WOK    end +  def self.git_version_extract +    if FileTest.file?('/usr/bin/git') +      x=`git describe --long --tags 2>&1`.strip. +        gsub(/^[a-z_-]*([0-9.]+)/,'\1'). +        gsub(/([^-]*-g)/,'r\1'). +        gsub(/-/,'.') +      x=(x=~/^[0-9]+\.[0-9]+\.[0-9]+\.r[0-9]+\.g[0-9a-f]{7}/) \ +      ? x +      : nil +    else nil +    end +  end +  def self.version_number_use(vi) +    (git_version_extract.nil?) \ +    ? (vi[:version]) +    : git_version_extract +  end +  def self.version_number_info(vi) +    (Version_info.version_number_use(vi) != vi[:version_number]) \ +    ? (%{#{vi[:version_number]} from git #{Version_info.version_number_use(vi)}}) +    : vi[:version_number] +  end +  def self.version_number_info_stable +    vi=Version_info::Current.setting_stable +    (Version_info.version_number_use(vi) != vi[:version_number]) \ +    ? (%{#{vi[:version_number]} from git #{Version_info.version_number_use(vi)}}) +    : vi[:version_number] +  end +  def self.version_number_info_unstable +    vi=Version_info::Current.setting_unstable +    (Version_info.version_number_use(vi) != vi[:version_number]) \ +    ? (%{#{vi[:version_number]} from git #{Version_info.version_number_use(vi)}}) +    : vi[:version_number] +  end    module Current      def self.yml_file_path(version)        "data/sisu/version/#{version}.yml" @@ -272,6 +309,13 @@ module Version_info      end    end    module Update +    def self.version_number(vi) +      /([0-9]+\.[0-9]+\.[0-9]+)/.match(vi[:version])[1] +    end +    def self.version_number_stable +      vi=Version_info::Current.setting_stable +      /([0-9]+\.[0-9]+\.[0-9]+)/.match(vi[:version])[1] +    end      def self.version_info_update_commit(filename,vi_hash_current,vi_content_current,vi_hash_next,vi_content_next)        ans=%{update #{Project_details.name.downcase} version info replacing:    #{vi_hash_current.sort} @@ -313,7 +357,7 @@ proceed? }        )      end      def self.changelog_header(vi) -      vn=/([0-9]+\.[0-9]+\.[0-9]+)/.match(vi[:version])[1] +      vn=version_number(vi)        <<-WOK  ** #{vn}.orig.tar.xz (#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')})  http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} @@ -333,9 +377,8 @@ proceed? }          fn="#{Dir.pwd}/#{filename}"          if File.writable?(fn)            changelog_arr_current = IO.readlines(fn) -          changelog_arr_next=[] -          changelog_arr_current.each do |line| -            changelog_arr_next <<=if line =~/^\*\* [0-9]+\.[0-9]+\.[0-9]+(?:_pre_rel)?\.orig\.tar\.xz \(Open commit window: [0-9]{4}-[0-9]{2}-[0-9]{2}; Pre-Release\)\)$/ +          changelog_arr_next=changelog_arr_current.each.map do |line| +            if line =~/^\*\* [0-9]+\.[0-9]+\.[0-9]+(?:_pre_rel)?\.orig\.tar\.xz \(Open commit window: [0-9]{4}-[0-9]{2}-[0-9]{2}; Pre-Release\)\)$/                "** #{vi[:version]}.orig.tar.xz " \                + "(#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')})\n"              else line @@ -377,7 +420,7 @@ proceed? }        )      end      def self.changelog_header_pre_release(vi) -      vn=/([0-9]+\.[0-9]+\.[0-9]+)/.match(vi[:version])[1] +      vn=version_number(vi)        <<-WOK  ** #{vn}.orig.tar.xz (Open commit window: #{vi[:date]}; Pre-Release))  http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} @@ -397,8 +440,7 @@ proceed? }          fn="#{Dir.pwd}/#{filename}"          if File.writable?(fn)            changelog_arr_current = IO.readlines(fn) -          changelog_arr_next=[] -          changelog_arr_current.each do |line| +          changelog_arr_next=changelog_arr_current.each.map do |line|              changelog_arr_next <<=if line =~/^--- HEAD ---$/                line << ("\n" + ch)              else line @@ -522,18 +564,18 @@ date:       #{vi[:date]}  summary:    #{vi[:project]}      WOK    end -  def self.contents(vi,version) +  def self.contents(vi,branch)      <<-WOK  Gem::Specification.new do |s|    s.name           = '#{vi[:project].downcase}'    s.version        = '#{vi[:version_number]}'    s.date           = '#{vi[:date]}' -  s.summary        = '#{vi[:project]}' -  s.description    = '#{Project_details.name} gem' +  s.summary        = '#{Version_info.version_number_info(vi)}' +  s.description    = '#{Project_details.description}'    s.authors        = ["Ralph Amissah"]    s.email          = 'ralph.amissah@gmail.com' -  s.files          = Dir['lib/#{Project_details.name.downcase}/#{version}/*.rb'] + -                     Dir['data/#{Project_details.name.downcase}/version/#{version}.yml'] + +  s.files          = Dir['lib/#{Project_details.name.downcase}/#{branch}/*.rb'] + +                     Dir['data/#{Project_details.name.downcase}/version/#{branch}.yml'] +                       Dir['data/#{Project_details.name.downcase}/image/*'] +                       Dir['bin/#{Project_details.name.downcase}gem'] +                       Dir['bin/#{Project_details.name.downcase}'] diff --git a/setup/rbuild_libs.rb b/setup/rbuild_libs.rb index b999704b..5345631b 100644 --- a/setup/rbuild_libs.rb +++ b/setup/rbuild_libs.rb @@ -137,14 +137,14 @@ module Utils  end  module Install                                                             #%% using a directory and its mapping -  def self.setup_find_create(dir_get,dir_put,exclude_files=[''])               #primary, +  def self.setup_find_create(dir_get,dir_put,exclude_files=['\*'],act)               #primary,      begin        Find.find("#{Project_details.dir.pwd}/#{dir_get}") do |f|          stub=f.scan(/#{Project_details.dir.pwd}\/#{dir_get}\/(\S+)/).join          place="#{dir_put}/#{stub}"          action=case          when File.file?(f) -          unless f =~/#{exclude_files.inspect}/ +          unless f =~/#{exclude_files.join("|")}/              cp(f,place)              Utils.chmod_file(place)              "->  #{dir_put}/" | 
