nix: adjust, packages in shell.nix
[software/sisu] / qi
1 #!/usr/bin/env ruby
2 =begin
3
4 - Description:
5
6 - Homepage: <http://www.jus.uio.no/sisu/SiSU>
7 <http://search.sisudoc.org>
8 - Download: <http://www.jus.uio.no/sisu/download>
9
10 - Copyright: (C) 2015, 2020 Ralph Amissah
11
12 - License:
13
14 - Ralph Amissah <ralph.amissah@gmail.com>
15
16 =end
17 #% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file)
18 begin
19 require 'thor'
20 rescue LoadError
21 puts 'thor (package ruby-thor) not found'
22 end
23 begin
24 require './setup/sisu_version' # ./setup/sisu_version.rb
25 include SiSUversion
26 rescue LoadError
27 puts 'this does not appear to be a SiSU development directory'
28 exit
29 end
30 require_relative 'setup/qi_libs' # setup/qi_libs.rb
31 require 'find'
32 require 'fileutils'
33 include FileUtils
34 require 'pathname'
35 require 'rbconfig.rb'
36 require 'yaml'
37 module SiSUconf
38 class Configure < Thor
39 class_option :verbose, :type => :boolean
40 desc 'setup --all --bin --lib --conf --data --alt --dryrun',
41 'setup sisu'
42 options \
43 :all => :boolean,
44 :bin => :boolean,
45 :lib => :boolean,
46 :conf => :boolean,
47 :data => :boolean,
48 :share => :boolean,
49 :man => :boolean,
50 :vim => :boolean,
51 :alt => :boolean,
52 :dryrun => :boolean,
53 :is => :boolean
54 def setup
55 unless options.length >= 1 \
56 and not (options[:bin] \
57 or options[:lib] \
58 or options[:conf] \
59 or options[:data] \
60 or options[:share] \
61 or options[:man] \
62 or options[:vim])
63 puts 'setup --all --bin --lib --conf --data --share --man --vim'
64 end
65 act=(options[:dryrun]) ? (:dryrun) : (:action)
66 if options[:is]
67 puts Version_info.version_number_info_stable
68 end
69 if not options[:alt]
70 if options[:all] \
71 or options[:bin]
72 exclude_files=['sisugem']
73 Install.setup_find_create(
74 'bin',
75 Project_details.dir.bin,
76 exclude_files,
77 act
78 ) if File.directory?('bin')
79 end
80 if options[:all] \
81 or options[:lib]
82 Install.setup_find_create(
83 'lib',
84 Project_details.dir.lib,
85 act
86 ) if File.directory?('lib')
87 end
88 if options[:all] \
89 or options[:conf]
90 Install.setup_find_create(
91 'conf',
92 Project_details.dir.conf,
93 act
94 ) if File.directory?('conf')
95 end
96 if options[:all] \
97 or options[:data]
98 Install.setup_find_create(
99 'data',
100 Project_details.dir.data,
101 act
102 ) if File.directory?('data')
103 end
104 if options[:all] \
105 or options[:share]
106 Install.setup_find_create(
107 'data/sisu',
108 Project_details.dir.share,
109 act
110 ) if File.directory?('data/sisu')
111 end
112 if options[:all] \
113 or options[:man]
114 Install.setup_find_create(
115 'man',
116 Project_details.dir.man,
117 act
118 ) if File.directory?('man')
119 end
120 if options[:all] \
121 or options[:vim]
122 Install.setup_find_create(
123 'data/vim',
124 Project_details.dir.vim,
125 act
126 ) if File.directory?('data/vim')
127 end
128 else
129 if options[:all] \
130 or options[:bin]
131 Install.setup_find_cp_r(
132 'bin',
133 Project_details.dir.bin,
134 act
135 ) if File.directory?('bin')
136 end
137 if options[:all] \
138 or options[:bin]
139 Install.setup_find_cp_r(
140 'lib',
141 Project_details.dir.lib,
142 act
143 ) if File.directory?('lib')
144 end
145 if options[:all] \
146 or options[:conf]
147 Install.setup_find_cp_r(
148 'conf',
149 Project_details.dir.conf,
150 act
151 ) if File.directory?('conf')
152 end
153 if options[:all] \
154 or options[:data]
155 Install.setup_find_cp_r(
156 'data',
157 Project_details.dir.data,
158 act
159 ) if File.directory?('data')
160 end
161 if options[:all] \
162 or options[:share]
163 Install.setup_find_cp_r(
164 'data/sisu',
165 Project_details.dir.share,
166 act
167 ) if File.directory?('data/sisu') #
168 end
169 if options[:all] \
170 or options[:man]
171 Install.setup_find_cp_r(
172 'man',
173 Project_details.dir.man,
174 act
175 ) if File.directory?('man')
176 end
177 #if options[:all] \
178 #or options[:vim]
179 # Install.setup_find_cp_r('data/vim',"#{Project_details.dir.data}/vim") \
180 # if File.directory?('data/vim')
181 #end
182 end
183 end
184 desc 'pkg',
185 'package maintenance tasks, ' \
186 + 'of no general interest ' \
187 + '(maintainer specific for package maintainer\'s convenience)'
188 options \
189 :open_version=> :boolean,
190 :version_and_tag_for_release=> :boolean,
191 :tip => :boolean,
192 :is => :boolean
193 def pkg
194 if options[:is]
195 puts Version_info.version_number_info_stable
196 end
197 if options[:tip]
198 Package.sequence
199 end
200 if options[:open_version]
201 Version_info::Update.update_documentation
202 Version_info::Update.update_stable(:pre_release)
203 Version_info::Update.update_pkgbuild_stable(:pre_release)
204 Version_info::Update.changelog_header_stable_pre_release
205 Version_info::Update.changelog_header_commit(:pre_release)
206 end
207 if options[:version_and_tag_for_release]
208 Version_info::Update.update_documentation
209 Version_info::Update.update_stable(:release)
210 Version_info::Update.update_pkgbuild_stable(:release)
211 Version_info::Update.changelog_header_stable
212 Version_info::Update.changelog_header_commit_tag_upstream(:release)
213 end
214 if options.length == 0
215 system("#{$called_as} help pkg")
216 system("#{$called_as} pkg --tip")
217 end
218 end
219 desc 'gem --create --build --install',
220 'gem create build and install'
221 options \
222 :create => :boolean,
223 :build => :boolean,
224 :install => :boolean,
225 :git_version_number => :boolean,
226 :is => :boolean
227 def gem
228 if options[:is]
229 puts Version_info.version_number_info_stable
230 end
231 if options[:create]
232 version=(options[:git_version_number]) \
233 ? :version_git
234 : :version_standard
235 Gemspecs::Current.create_stable(version)
236 puts 'created gemspec' \
237 if options[:verbose]
238 end
239 if options[:build]
240 Gemspecs::Current.build_stable
241 puts 'built gem' \
242 if options[:verbose]
243 end
244 if options[:install]
245 version=(options[:git_version_number]) \
246 ? :version_git
247 : :version_standard
248 Gemspecs::Current.install_stable(version)
249 puts 'installed gem, version: stable' \
250 if options[:verbose]
251 end
252 unless options.length > 0
253 system("#{$called_as} help gem")
254 end
255 end
256 end
257 end
258 begin
259 $called_as,$argv=$0,$*
260 SiSUconf::Configure.start(ARGV)
261 rescue
262 end
263 __END__