touch dates
[software/sisu] / qi
1 #!/usr/bin/env ruby
2 =begin
3 Common Rakefile, Rantfile installer for SiSU
4 softlink Rakefile and Rantfile to this file
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) 2007 Ralph Amissah
11
12 * License: LGPL - GNU Lesser General Public License
13 [same license as Rant provided within the Rant package]
14
15 * Ralph Amissah <ralph@amissah.com>
16 Ralph Amissah <ralph.amissah@gmail.com>
17
18 Rake is a Ruby build program by Jim Weirich
19 * Rake may be downloaded and installed from:
20 <http://rake.rubyforge.org/>
21
22 Rant is a Ruby build program by Stefan Lang
23 * Rant may be downloaded and installed from:
24 <http://make.rubyforge.org/>
25
26 Notes on use:
27 [if rake is preferred and installed]
28 rake -T
29 [if rant is preferred and installed]
30 rant -T
31
32 SiSU can also be Setup/Installation using:
33 * Minero Aoki's setup.rb, provided along with SiSU, or
34
35 =end
36 #%% produce a makefile suitable for the target platform
37 #require 'mkmf'
38 #create_makefile("sisu")
39 #% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file)
40 begin
41 require 'thor'
42 rescue LoadError
43 puts 'thor (package ruby-thor) not found'
44 end
45 require_relative 'setup/sisu_version' # setup/sisu_version.rb
46 include SiSUversion
47 require_relative 'setup/qi_libs' # setup/qi_libs.rb
48 require 'find'
49 require 'fileutils'
50 include FileUtils
51 require 'pathname'
52 require 'rbconfig.rb'
53 require 'yaml'
54 module SiSUconf
55 class Configure < Thor
56 class_option :verbose, :type => :boolean
57 desc 'setup --all --bin --lib --conf --data --alt',
58 'setup sisu'
59 options \
60 :all => :boolean,
61 :bin => :boolean,
62 :lib => :boolean,
63 :conf => :boolean,
64 :data => :boolean,
65 :share => :boolean,
66 :man => :boolean,
67 :vim => :boolean,
68 :alt => :boolean
69 def setup
70 unless options.length >= 1 \
71 and not (options[:bin] \
72 or options[:lib] \
73 or options[:conf] \
74 or options[:data] \
75 or options[:share] \
76 or options[:man] \
77 or options[:vim])
78 puts 'setup --all --bin --lib --conf --data --share --man --vim'
79 end
80 if not options[:alt]
81 if options[:all] \
82 or options[:bin]
83 exclude_files=['sisugem']
84 Install.setup_find_create('bin',Project_details.dir.bin,exclude_files) \
85 if File.directory?('bin')
86 end
87 if options[:all] \
88 or options[:lib]
89 Install.setup_find_create('lib',Project_details.dir.lib) \
90 if File.directory?('lib')
91 end
92 if options[:all] \
93 or options[:conf]
94 Install.setup_find_create('conf',Project_details.dir.conf) \
95 if File.directory?('conf')
96 end
97 if options[:all] \
98 or options[:data]
99 Install.setup_find_create('data',Project_details.dir.data) \
100 if File.directory?('data')
101 end
102 if options[:all] \
103 or options[:share]
104 Install.setup_find_create('data/sisu',Project_details.dir.share) \
105 if File.directory?('data/sisu')
106 end
107 if options[:all] \
108 or options[:man]
109 Install.setup_find_create('man',Project_details.dir.man) \
110 if File.directory?('man')
111 end
112 if options[:all] \
113 or options[:vim]
114 Install.setup_find_create('data/vim',Project_details.dir.vim) \
115 if File.directory?('data/vim')
116 end
117 else
118 if options[:all] \
119 or options[:bin]
120 Install.setup_find_cp_r('bin',Project_details.dir.bin) \
121 if File.directory?('bin')
122 end
123 if options[:all] \
124 or options[:bin]
125 Install.setup_find_cp_r('lib',Project_details.dir.lib) \
126 if File.directory?('lib')
127 end
128 if options[:all] \
129 or options[:conf]
130 Install.setup_find_cp_r('conf',Project_details.dir.conf) \
131 if File.directory?('conf')
132 end
133 if options[:all] \
134 or options[:data]
135 Install.setup_find_cp_r('data',Project_details.dir.data) \
136 if File.directory?('data')
137 end
138 if options[:all] \
139 or options[:share]
140 Install.setup_find_cp_r('data/sisu',Project_details.dir.share) \
141 if File.directory?('data/sisu') #
142 end
143 if options[:all] \
144 or options[:man]
145 Install.setup_find_cp_r('man',Project_details.dir.man) \
146 if File.directory?('man')
147 end
148 #if options[:all] \
149 #or options[:vim]
150 # Install.setup_find_cp_r('data/vim',"#{Project_details.dir.data}/vim") \
151 # if File.directory?('data/vim')
152 #end
153 end
154 end
155 desc 'gem --create --build --install --stable --unstable',
156 'gem create build and install'
157 options \
158 :stable => :boolean,
159 :unstable => :boolean,
160 :create => :boolean,
161 :build => :boolean,
162 :install => :boolean
163 def gem
164 if options[:unstable]
165 if options[:create]
166 Gemspecs::Current.create_unstable
167 #Gemspecs::Next.create_unstable
168 puts 'created gemspec, version: unstable' \
169 if options[:verbose]
170 end
171 if options[:build]
172 Gemspecs::Current.build_unstable
173 #Gemspecs::Next.build_unstable
174 puts 'built gem, version: unstable' \
175 if options[:verbose]
176 end
177 if options[:install]
178 Gemspecs::Current.install_unstable
179 #Gemspecs::Next.install_unstable
180 puts 'installed gem, version: unstable' \
181 if options[:verbose]
182 end
183 end
184 if options[:stable] \
185 or not options[:unstable]
186 if options[:create]
187 Gemspecs::Current.create_stable
188 #Gemspecs::Current.create_unstable
189 puts 'created gemspec, version: stable' \
190 if options[:verbose]
191 end
192 if options[:build]
193 Gemspecs::Current.build_stable
194 #Gemspecs::Next.build_stable
195 puts 'built gem, version: stable' \
196 if options[:verbose]
197 end
198 if options[:install]
199 Gemspecs::Current.install_stable
200 #Gemspecs::Next.install_stable
201 puts 'installed gem, version: stable' \
202 if options[:verbose]
203 end
204 end
205 if options.length < 2
206 system("#{$called_as} help gem")
207 end
208 end
209 desc 'pkg',
210 'package maintenance tasks, of no general interest (maintainer specific for package maintainer\'s convenience)'
211 options \
212 :update_version=> :boolean,
213 :tip => :boolean
214 def pkg
215 if options[:tip]
216 Package.sequence
217 end
218 if options[:update_version]
219 Version_info::Update.update_stable
220 Version_info::Update.update_unstable
221 puts "\n" + Version_info::Update.changelog_header_stable
222 puts "\n" + Version_info::Update.changelog_header_unstable
223 end
224 if options.length == 0
225 system("#{$called_as} help pkg")
226 system("#{$called_as} pkg --tip")
227 end
228 end
229 end
230 end
231 begin
232 $called_as,$argv=$0,$*
233 SiSUconf::Configure.start(ARGV)
234 rescue
235 end
236 __END__