aboutsummaryrefslogtreecommitdiffhomepage
path: root/data/doc/sisu/v1/sisu_markup_samples/sisu_manual/Rantfile
blob: 37198c7c95c7829c76624d93ca44942fd7547ab2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
#!/usr/bin/env ruby
raise "Please, use ruby1.8.0 or later." if RUBY_VERSION < "1.8.0"
##!/usr/bin/ruby1.9
#raise "Please, use ruby1.9.0 or later." if RUBY_VERSION < "1.9.0"
=begin
 Rantfile mapping setup.rb directory structure

 SiSU Simple information Structuring Universe, Serialised information, Structured Units
 * SiSU at present is for the Linux/Unix platform
 * See homepage at: <<  http://www.jus.uio.no/sisu/SiSU  >>
 * &  <<  http://www.jus.uio.no/sisu/download  >>
 * &  <<  http://www.jus.uio.no/sisu/development  >>

 Rant is a Ruby 'ant' by Stefan Lang

 For Setup/Installation SiSU uses either:
 * Minero Aoki's setup.rb, provided along with SiSU, or
 * Rant which may be downloaded and installed from:
     http://make.rubyforge.org/

 * Name: Rant install/setup file for SiSU - Simple information Structuring Universe, Serialised information Structured Units
 *
 * Author: Ralph@Amissah.com
 * Description: Rant install/setup file which maps directory structure used by setup.rb
   * arch-tag: Rant install/setup file which maps directory structure used by setup.rb
   * $Id: Rantfile,v 1.2 2006/01/24 01:55:35 ralph Exp ralph $

 Copyright (C) 2005 Ralph Amissah (first release edition)
 Copyright (C) 1997 Ralph Amissah (first edition)

 * SiSU is released under a dual License: Dual License:
           (i) GPL 2 or later, for non-commercial use of the program and
           publications

           (ii) Distributed under a commercial license for everything else,
           (terms to be determined), that is for everything that is not (i)

  Summary of GPL 2

  This program is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published by the Free
  Software Foundation; either version 2 of the License, or (at your option)
  any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc., 59
  Temple Place, Suite 330, Boston, MA  02111-1307  USA

  If you have Internet connection, the latest version of the GPL should be
  available at these locations:
    http://www.fsf.org/licenses/gpl.html
    http://www.gnu.org/copyleft/gpl.html
    http://www.jus.uio.no/sisu/gpl2.fsf

  SiSU was first released to the public on January 4th 2005

  SiSU uses:

  *  Standard SiSU markup syntax,
  *  Standard SiSU meta-markup syntax, and the
  *  Standard SiSU object citation numbering and system

  * Ralph Amissah 1997, current 2005.
  All Rights Reserved.

 * Ralph Amissah mailto:ralph@amissah.com
   Ralph Amissah mailto:amissah@gmail.com

 * NOTE reminder to create independent setup file called install:
     rant-import --auto install
   then you can, as root (for default action):
     ruby install
   or for help on alternative actions:
     ruby install help
     ruby install -T

=end
#% produce a makefile suitable for the target platform
require 'rbconfig'
require 'date'
require 'find'
require 'fileutils'
require 'rbconfig.rb'
include FileUtils::Verbose
pf='rant/plugin/postfix.rb'
if File.file?(pf)
  require pf
  include Post
  @postfix=true
else @postfix=false
end
@dir=Hash.new
@proj=Hash.new
@proj[:name]='SiSU'
@proj[:rant]="Rantfile for the darcs-buildpackage debianisation of #{@proj[:name]}"
@dir[:proj]='sisu'
@dir[:proj_eg]='sisu-examples'
@dt=Date.today.to_s
@t=Time.now
day=if @t.day.to_s =~/^(\d)$/; "0#{$1}"
else @t.day.to_s
end
month=if @t.month.to_s =~/^(\d)$/; "0#{$1}"
else @t.month.to_s
end
@ymd="#{@t.year}#{month}#{day}"
@w=@t.strftime("%W")
@weekonly=@w
@week="#{@t.year}w#@w"
@monthonly=month
@month="#{@t.year}#{@t.month}"
@year=@t.year
d=@t.wday
@week_stamp="#{@t.year}w#@w"
#@week_stamp=@t.strftime("%Yw%W")
@week_slash_day="#@week_stamp/#{d}"
@week_dash_day="#@week_stamp-#{d}"
@host=Config::CONFIG['host']
@pwd=Dir.pwd
@dir[:arch]=Config::CONFIG['archdir']
@dir[:sitearch]=Config::CONFIG['sitearchdir']
@dir[:bin]=Config::CONFIG['bindir']
@dir[:lib]=Config::CONFIG['sitelibdir']
@dir[:data]=Config::CONFIG['datadir']
@dir[:conf]=Config::CONFIG['sysconfdir']                     #etc
@dir[:man]=Config::CONFIG['mandir']
@dir[:out]="#{Config::CONFIG['localstatedir']}/#{@dir[:proj]}"
@rubylib=Config::CONFIG['LIBRUBYARG_SHARED']
@home=ENV['HOME']
m=/.+\/(\S+)/m
@stub_pwd ||=@pwd[m,1]
prcss_dir='_sisu_processing'
prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}"
def filelist_array_all
  pwd=Dir.pwd
  files=Dir.glob("*.ss[tm]")
  files
end
def files_all
  file_array=filelist_array_all
  files=file_array.join(' ')
  files
end
def filelist_docs
  files='sisu_manual.ssm sisu_introduction.ssm sisu_help.sst sisu_help_sources.sst sisu_commands.sst sisu_markup.sst sisu_filetypes.sst sisu_config.ssi sisu_skin.sst sisu_css.ssi sisu_content_directories.ssi sisu_homepages.ssi sisu_examples.sst sisu_output_overview.sst sisu_webrick.sst sisu_quickstart.sst sisu_faq.sst sisu_syntax_highlighting.sst sisu_configuration.ssm sisu_description.sst sisu_remote.sst sisu_complete.sst sisu_postgresql.sst sisu_sqlite.sst sisu_pdf.sst sisu_search.ssm sisu_vim.sst sisu_doc.sst' # sisu_outpuman/man7/sisu_doc.7t_types.ssm sisu_sql.sst sisu_hyperestraier.sst sisu_latex.sst sisu_odf.sst sisu_xml.sst sisu_concordance.sst sisu_document_digest_certificate.sst document_digest_certificate.sst sisu_markup_source.sst sisupod.sst
  files
end
def filelist_manpage
  files='sisu.ssm sisu_introduction.ssm sisu_help.sst sisu_help_sources.sst sisu_commands.sst sisu_markup.sst sisu_filetypes.sst sisu_config.ssi sisu_skin.sst sisu_css.ssi sisu_content_directories.ssi sisu_homepages.ssi sisu_examples.ssi sisu_output_overview.sst sisu_webrick.sst sisu_download.ssi sisu_installation.ssi sisu_quickstart.sst sisu_howto.sst sisu_faq.sst sisu_syntax_highlighting.sst sisu_configuration.ssm sisu_remote.sst sisu_complete.sst sisu_postgresql.sst sisu_sqlite.sst sisu_pdf.sst sisu_search.ssm sisu_vim.sst sisu_doc.sst' # sisu_output_types.ssm sisu_sql.sst sisu_hyperestraier.sst sisu_latex.sst sisu_odf.sst sisu_xml.sst sisu_concordance.sst sisu_document_digest_certificate.sst document_digest_certificate.sst sisu_markup_source.sst sisupod.sst
  #puts files + "\n\n"
  files
end
def man_section(files_array,man_no='1')
  path_man_sisu_output='../../../../../../sisu-doc/doc/manuals_generated/sisu_manual/man'
  path_man_sisu_package='../../../../../man'
  files_array.each do |x|
    y=x.gsub(/(\S+?)\.1$/,"\\1.#{man_no}")
    unless man_no =~/^1$/
      system("mv -v #{path_man_sisu_output}/#{x} #{path_man_sisu_output}/#{y}")
    end
    puts "cp -v #{path_man_sisu_output}/#{y} #{path_man_sisu_package}/man#{man_no}/#{y}"
    #system("cp -v #{path_man_sisu_output}/#{y} #{path_man_sisu_package}/man#{man_no}/#{y}")
  end
end
def manpage_move
  files_man1=['sisu.1','sisu_commands.1','sisu_markup.1','sisu_configuration.1','sisu_webrick.1','sisu_help.1','sisu_help_sources.1','sisu_skin.1']
  files_man7=['sisu_complete.1','sisu_doc.1','sisu_postgresql.1','sisu_sqlite.1','sisu_pdf.1','sisu_vim.1'] # 'sisu_output_types.1' 'sisu_sql.1','sisu_hyperestraier.1','sisu_latex.1','sisu_odf.1','sisu_xml.1','sisu_concordance.1','sisu_document_digest_certificate.1','sisu_markup_source.1','sisupod.1'
  files_man8=['sisu_quickstart.1','sisu_howto.1','sisu_faq.1','sisu_syntax_highlighting.1','sisu_remote.1','sisu_search.1']
  man_section(files_man1,'1')
  man_section(files_man7,'7')
  man_section(files_man8,'8')
end
def files_array_docs
  file_array=filelist_docs.scan(/\S+?\.ss[mt]/)
  file_array
end
def files_docs
  file_array=files_array_docs
  files=file_array.join(' ')
  files
end
def files_array_manpage
  file_array=filelist_manpage.scan(/\S+?\.ss[mt]/)
  file_array
end
def files_manpage
  file_array=files_array_manpage
  files=file_array.join(' ')
  files
end
def manual
  system('sisu -CC')
  files_array_docs.each do |x|
    puts "sisu -3sS #{x}"
    system("sisu -3sS #{x}")
  end
end
def manual_rsync
  file_array=files_array_docs
  puts file_array.join(' ')
  system('sisu -CC')
  file_array.each do |x|
    puts "sisu -3sS #{x}; sisu -R #{x} &"
    system("sisu -3sS #{x}; sisu -R #{x} & ")
  end
end
def manpages
  puts files_manpage
  system("sisu -i #{files_manpage}")
end
def search_update
  file_array=filelist_search.scan(/\S+/)
  file_array.each do |x|
    puts "sisu -Dv --update #{x}"
    system("sisu -Dv --update #{x}")
  end
end
def search_update_sisu
  file_array=filelist_search_sisu.scan(/\S+/)
  file_array.each do |x|
    puts "sisu -Dv --update #{x}"
    system("sisu -Dv --update #{x}")
  end
end
def clean
  system("rm *._sst footnote_conversion_errors.txt .*.swp")
end
def zap(filelist)
  system("sisu -Z #{filelist}")
end
#% Help etc.
def rant_system_info
  puts <<WOK
  Host
    host:             #@host
    arch:             #{@dir[:arch]}
    sitearch:         #{@dir[:sitearch]}

  Directories for installation
    bin:                                          #{@dir[:bin]}
    lib (site-ruby):                              #{@dir[:lib]}/#{@dir[:proj]}/#{Version}
    conf [etc]:                                   #{@dir[:conf]}/#{@dir[:proj]}
    data (document samples, images, README):      #{@dir[:data]}/#{@dir[:proj]}  and  #{@dir[:data]}/doc/#{@dir[:proj]}
    man (manual pages):                           #{@dir[:man]}
    output:                                       #{@dir[:out]}
      processing:                                 #{@dir[:out]}/processing
      www:                                        #{@dir[:out]}/www

    rubylib:          #@rubylib

WOK
end
def rant_help
  puts <<WOK

#{@proj[:name]}
  #{@proj[:rant]}

Commands quick start list

  #{@proj[:name]} Rant Help:          (This Rantfile uses the same directory structure as setup.rb)
    rant -T                # a task list, (generated by Rant) for more complete and up to date help
    rant system            # system info used

For a more detailed and up to date list of command options use

  rant -T

WOK
end
                                                           #% tasks
desc 'generate and place all pages'
task :gen => [:gen]
task :genlite => [:genlite]
desc 'sisu manual'
task :manual => [:manual]
desc 'sisu man pages'
task :manpages => [:manpages]
desc 'place sisu man pages'
task :manpage_mv => [:manpage_mv]
desc 'list of files'
task :files => [:filelist]
desc 'list of manual files'
task :files_docs => [:filelist_docs]
desc 'list of manpage files'
task :files_man => [:filelist_manpage]
desc 'remove output, -Z zap'
task :zap => [:filelists_zap]
desc 'help'
task :help => [:help]
task :pwd => [:pwd]
task :files_all => [:filelist_all]
task :gen do
  zap(files_all)
  manual
  manpages
  manpage_move
  clean
end
task :genlite do
  zap(files_all)
  manual
  manpages
  clean
end
task :manpages do
  manpages
  manpage_move
  clean
end
task :manpage_mv do
  manpage_move
end
task :manual do
  manual
  clean
end
task :filelist do
  puts filelist_docs + "\n\n" + files_docs + "\n\n" + filelist_manpage + "\n\n" + files_manpage
end
task :filelist_manpage do
  puts filelist_manpage
end
task :filelist_docs do
  puts filelist_docs
end
task :filelist_all do
  puts files_all
end
task :filelists_zap do
  zap(files_all)
end
task :help do
  rant_help
end
__END__
#path_man_sisu_output='../../../manuals_generated/sisu_manual/man'