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