summaryrefslogtreecommitdiffstats
path: root/setup/qi_libs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'setup/qi_libs.rb')
-rw-r--r--setup/qi_libs.rb243
1 files changed, 102 insertions, 141 deletions
diff --git a/setup/qi_libs.rb b/setup/qi_libs.rb
index 938724a..6dc2fcf 100644
--- a/setup/qi_libs.rb
+++ b/setup/qi_libs.rb
@@ -6,10 +6,10 @@ module Project_details
'SiSU'
end
def self.summary
- 'documents - structuring, publishing in multiple formats and search'
+ 'documents - structuring, publishing in multiple formats & search'
end
def self.description
- 'documents - structuring, publishing in multiple formats and search'
+ 'documents - structuring, publishing in multiple formats & search'
end
def self.homepage
'http://www.sisudoc.org'
@@ -244,15 +244,9 @@ module Version_info
? (%{#{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"
+ def self.yml_file_path
+ 'data/sisu/version.yml'
end
def self.settings(file)
v="#{Dir.pwd}/#{file}"
@@ -262,16 +256,10 @@ module Version_info
end
end
def self.changelog_file_stable
- 'data/doc/sisu/CHANGELOG_v5'
- end
- def self.changelog_file_unstable
- 'data/doc/sisu/CHANGELOG_v6'
+ 'data/doc/sisu/CHANGELOG_v7'
end
def self.file_stable
- yml_file_path(SiSU_version_dir_stable)
- end
- def self.file_unstable
- yml_file_path(SiSU_version_dir_unstable)
+ yml_file_path
end
def self.setting_stable
hsh=settings(file_stable)
@@ -279,18 +267,9 @@ module Version_info
match(hsh[:version])[1]
hsh
end
- def self.setting_unstable
- hsh=settings(file_unstable)
- hsh[:version_number]=/([0-9]+\.[0-9]+\.[0-9]+)/.
- match(hsh[:version])[1]
- hsh
- end
def self.content_stable
Version_info.contents(setting_stable)
end
- def self.content_unstable
- Version_info.contents(setting_unstable)
- end
end
module Next
def self.settings(v)
@@ -304,15 +283,9 @@ module Version_info
def self.setting_stable
settings(SiSU_version_next_stable)
end
- def self.setting_unstable
- settings(SiSU_version_next_unstable)
- end
def self.content_stable(rel)
Version_info.contents(setting_stable,rel)
end
- def self.content_unstable(rel)
- Version_info.contents(setting_unstable,rel)
- end
end
module Update
def self.version_number(vi)
@@ -344,6 +317,32 @@ proceed? }
end
end
end
+ def self.update_documentation
+ fn="#{Dir.pwd}/data/doc/sisu/markup-samples/manual/_sisu/sisu_document_make"
+ if File.file?(fn) \
+ and File.writable?(fn)
+ ver_no_stable=Version_info::Current.setting_stable[:version_number]
+ debian_stable='Jessie'
+ debian_testing='Stretch'
+ sisu_doc_make = IO.readlines(fn)
+ sisu_doc_make_next=sisu_doc_make.each.map do |line|
+ line=line.gsub(/(\/$\{sisu_stable\}\/,)'[0-9]+\.[0-9]+\.[0-9]+'/,"\\1'#{ver_no_stable}'").
+ gsub(/(\/$\{debian_stable\}\/,)'\*\{[A-Z][a-z]+\}\*'/,
+ "\\1'*{#{debian_stable}}*'").
+ gsub(/(\/$\{debian_testing\}\/,)'\*\{[A-Z][a-z]+\}\*'/,
+ "\\1'*{#{debian_testing}}*'")
+ line
+ end
+ if sisu_doc_make_next.length == sisu_doc_make.length
+ sisu_doc_make_file=File.new(fn,'w+')
+ sisu_doc_make_next.flatten.each do |line|
+ sisu_doc_make_file << line
+ end
+ sisu_doc_make_file.close
+ else puts "expected changelog arrays to have same length, in: #{pkgbuild.length}, out: #{pkgbuild_next.length}"
+ end
+ end
+ end
def self.update_stable(rel=:release)
version_info_update_commit(
Version_info::Current.file_stable,
@@ -353,14 +352,34 @@ proceed? }
Version_info::Next.content_stable(rel),
)
end
- def self.update_unstable(rel=:release)
- version_info_update_commit(
- Version_info::Current.file_unstable,
- Version_info::Current.setting_unstable,
- Version_info::Current.content_unstable,
- Version_info::Next.setting_unstable,
- Version_info::Next.content_unstable(rel),
- )
+ def self.update_pkgbuild_stable(rel=:release)
+ vn=version_number_stable
+ ans=%{update PKGBUILD version info:
+pkgver=#{vn}
+
+proceed? }
+ resp=Utils.answer?(ans)
+ if resp
+ filename='PKGBUILD_tar_xz'
+ fn="#{Dir.pwd}/setup/#{filename}"
+ if File.writable?(fn)
+ pkgbuild = IO.readlines(fn)
+ pkgbuild_next=pkgbuild.each.map do |line|
+ if line =~/^\s*pkgver=/
+ line=line.gsub(/^\s*(pkgver=)[0-9.]+/,"\\1#{vn}")
+ else line
+ end
+ end
+ if pkgbuild.length == pkgbuild_next.length
+ pkgbuild_file=File.new(fn,'w+')
+ pkgbuild_next.flatten.each do |line|
+ pkgbuild_file << line
+ end
+ pkgbuild_file.close
+ else puts "expected changelog arrays to have same length, in: #{pkgbuild.length}, out: #{pkgbuild_next.length}"
+ end
+ end
+ end
end
def self.changelog_header(vi)
vn=version_number(vi)
@@ -404,9 +423,6 @@ proceed? }
def self.changelog_header_stable_filename
Version_info::Current.changelog_file_stable
end
- def self.changelog_header_unstable_filename
- Version_info::Current.changelog_file_unstable
- end
def self.changelog_header_stable
ch=changelog_header(Version_info::Current.setting_stable)
changelog_header_release(
@@ -415,14 +431,6 @@ proceed? }
Version_info::Current.setting_stable
)
end
- def self.changelog_header_unstable
- ch=changelog_header(Version_info::Current.setting_unstable)
- changelog_header_release(
- changelog_header_unstable_filename,
- ch,
- Version_info::Current.setting_unstable
- )
- end
def self.changelog_header_pre_release(vi)
vn=version_number(vi)
<<-WOK
@@ -465,10 +473,6 @@ proceed? }
ch=changelog_header_pre_release(Version_info::Current.setting_stable)
changelog_header_pre_release_write(changelog_header_stable_filename,ch)
end
- def self.changelog_header_unstable_pre_release
- ch=changelog_header_pre_release(Version_info::Current.setting_unstable)
- changelog_header_pre_release_write(changelog_header_unstable_filename,ch)
- end
def self.commit_changelog(rel=:release,msg)
system(%{
git commit -a -m"#{msg}"
@@ -521,16 +525,14 @@ module GitExtractTaggedVersionBuild
begin
ver=if tag =~/sisu_[0-9]\.[0-9]+\.[0-9]+/ then tag
elsif tag =~/^[0-9]\.[0-9]+\.[0-9]+/ then 'sisu_' + tag
- else branch
+ else branch
end
- stable=options[:stable] ? '--stable ' : ''
- unstable=options[:unstable] ? '--unstable ' : ''
create=options[:create] ? '--create ' : ''
build=options[:build] ? '--build ' : ''
install=options[:install] ? '--install ' : ''
commands =<<-WOK
git checkout #{ver} &&
- #{$called_as} gem #{ver} #{stable}#{unstable}#{create}#{build}#{install};
+ #{$called_as} gem #{ver} #{create}#{build}#{install};
WOK
puts commands
begin
@@ -555,20 +557,43 @@ date: #{vi[:date]}
summary: #{vi[:project]}
WOK
end
- def self.contents(vi,branch)
+ def self.contents(vi)
<<-WOK
Gem::Specification.new do |s|
s.name = '#{vi[:project].downcase}'
s.version = '#{vi[:version_number]}'
+ s.date = '#{vi[:date]}'
+ s.summary = '#{Project_details.summary} (linux calls)'
+ s.description = '#{Project_details.description} [#{Version_info.version_number_info(vi)}] (linux calls & without external dependencies)'
+ s.homepage = '#{Project_details.homepage}'
s.authors = ["Ralph Amissah"]
s.email = 'ralph.amissah@gmail.com'
+ s.license = 'GPL3'
+ s.files = Dir['lib/#{Project_details.name.downcase}.rb'] +
+ Dir['lib/#{Project_details.name.downcase}/*.rb'] +
+ Dir['data/#{Project_details.name.downcase}/version.yml'] +
+ Dir['data/#{Project_details.name.downcase}/image/*'] +
+ Dir['bin/#{Project_details.name.downcase}gem'] +
+ Dir['bin/#{Project_details.name.downcase}']
+ s.executables << '#{Project_details.name.downcase}gem' << '#{Project_details.name.downcase}'
+ s.has_rdoc = false
+end
+ WOK
+ end
+ def self.contents_git(vi)
+ <<-WOK
+Gem::Specification.new do |s|
+ s.name = '#{vi[:project].downcase}'
+ s.version = '#{Version_info.version_number_use(vi)}'
s.date = '#{vi[:date]}'
- s.summary = '#{Project_details.summary} #{Version_info.version_number_info(vi)}'
- s.description = '#{Project_details.description} #{Version_info.version_number_info(vi)} (without external dependencies)'
+ s.summary = '#{Project_details.summary} (linux calls)'
+ s.description = '#{Project_details.description} [#{Version_info.version_number_info(vi)}] (linux calls & without external dependencies)'
s.homepage = '#{Project_details.homepage}'
+ s.authors = ["Ralph Amissah"]
+ s.email = 'ralph.amissah@gmail.com'
s.license = 'GPL3'
- s.files = Dir['lib/#{Project_details.name.downcase}/#{branch}/*.rb'] +
- Dir['data/#{Project_details.name.downcase}/version/#{branch}.yml'] +
+ s.files = `git ls-files -z lib`.split("\x0") +
+ Dir['data/#{Project_details.name.downcase}/version.yml'] +
Dir['data/#{Project_details.name.downcase}/image/*'] +
Dir['bin/#{Project_details.name.downcase}gem'] +
Dir['bin/#{Project_details.name.downcase}']
@@ -592,106 +617,42 @@ end
end
def self.install(fn)
system(%{
- sudo gem install --no-document --verbose #{fn}.gem
+ sudo gem install --local --no-document --verbose #{fn}.gem
})
end
module Current
+ def self.filename
+ Project_details.name.downcase
+ end
def self.filename_stable
Project_details.name.downcase \
+ '-' \
+ Version_info::Current.setting_stable[:version_number]
end
- def self.filename_unstable
- Project_details.name.downcase \
- + '-' \
- + Version_info::Current.setting_unstable[:version_number]
- end
def self.info_stable
Gemspecs.info(Version_info::Current.setting_stable)
end
- def self.info_unstable
- Gemspecs.info(Version_info::Current.setting_unstable)
- end
def self.current_stable
Gemspecs.contents(
Version_info::Current.setting_stable,
- SiSU_version_dir_stable
- )
- end
- def self.current_unstable
- Gemspecs.contents(
- Version_info::Current.setting_unstable,
- SiSU_version_dir_unstable
- )
- end
- def self.create_stable
- Gemspecs.create(filename_stable,current_stable)
- Gemspecs.create(
- "#{Project_details.name.downcase}-stable",
- current_stable
- )
- end
- def self.create_unstable
- Gemspecs.create(filename_unstable,current_unstable)
- Gemspecs.create(
- "#{Project_details.name.downcase}-unstable",
- current_unstable
- )
- end
- def self.build_stable
- Gemspecs.build(filename_stable)
- end
- def self.build_unstable
- Gemspecs.build(filename_unstable)
- end
- def self.install_stable
- Gemspecs.install(filename_stable)
- end
- def self.install_unstable
- Gemspecs.install(filename_unstable)
- end
- end
- module Next
- def self.filename_stable
- Project_details.name.downcase \
- + '-' \
- + Version_info::Next.setting_stable[:version_number]
- end
- def self.filename_unstable
- Project_details.name.downcase \
- + '-' \
- + Version_info::Next.setting_unstable[:version_number]
- end
- def self.setting_stable
- Gemspecs.contents(
- Version_info::Next.setting_stable,
- SiSU_version_dir_stable
)
end
- def self.setting_unstable
- Gemspecs.contents(
- Version_info::Next.setting_unstable,
- SiSU_version_dir_unstable
+ def self.current_git_version
+ Gemspecs.contents_git(
+ Version_info::Current.setting_stable,
)
end
- def self.create_stable
- Gemspecs.create(filename_stable,setting_stable)
- end
- def self.create_unstable
- Gemspecs.create(filename_unstable,setting_unstable)
+ def self.create_stable(version=:version_standard)
+ (version==:version_git) \
+ ? (Gemspecs.create(filename,current_git_version))
+ : (Gemspecs.create(filename,current_stable))
end
def self.build_stable
- Gemspecs.build(filename_stable)
- end
- def self.build_unstable
- Gemspecs.build(filename_unstable)
+ Gemspecs.build(filename)
end
def self.install_stable
Gemspecs.install(filename_stable)
end
- def self.install_unstable
- Gemspecs.install(filename_unstable)
- end
end
end
module Package