aboutsummaryrefslogtreecommitdiffhomepage
path: root/rbuild
blob: f2cc663882d0170bd2d9af631be9aee80268e141 (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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
#!/usr/bin/env ruby
raise 'Please, use ruby1.9.3 or later.' if RUBY_VERSION < '1.9.3'
=begin
 Common Rakefile, Rantfile installer for SiSU
   softlink Rakefile and Rantfile to this file

 * Homepage: <http://www.jus.uio.no/sisu/SiSU>
             <http://search.sisudoc.org>
 * Download: <http://www.jus.uio.no/sisu/download>

 Copyright (C) 2007 Ralph Amissah

 * License: LGPL - GNU Lesser General Public License
     [same license as Rant provided within the Rant package]

 * Ralph Amissah <ralph@amissah.com>
   Ralph Amissah <ralph.amissah@gmail.com>

 Rake is a Ruby build program by Jim Weirich
 * Rake may be downloaded and installed from:
     <http://rake.rubyforge.org/>

 Rant is a Ruby build program by Stefan Lang
 * Rant may be downloaded and installed from:
     <http://make.rubyforge.org/>

 Notes on use:
   [if rake is preferred and installed]
     rake -T
   [if rant is preferred and installed]
     rant -T

 SiSU can also be Setup/Installation using:
 * Minero Aoki's setup.rb, provided along with SiSU, or

=end
#%% produce a makefile suitable for the target platform
#require 'mkmf'
#create_makefile("sisu")
require 'find'
require 'fileutils'
#require 'ftools'
require 'rbconfig.rb'
require 'yaml'
include FileUtils
class Project_details
  def name
    'SiSU'
  end
  def rake_rant
    "Rakefile/Rantfile for the installation/setup of #{name}"
  end
  def platform_notice
    "[#{name} is for the Linux/Unix Platforms]"
  end
  def env
    Config::CONFIG
  end
  def host
    env['host']
  end
  def dir
    def proj
      'sisu'
    end
    def arch
      env['archdir']
    end
    def sitearch
      env['sitearchdir']
    end
    def bin
      env['bindir']
    end
    def lib
      env['sitelibdir']
    end
    def data
      env['datadir']
    end
    def share
      "#{env['datadir']}/sisu"
    end
    def conf
      env['sysconfdir']
    end
    def man
      env['mandir']
    end
    def vim
      "#{env['datadir']}/sisu/vim"
    end
    def out
      "#{env['localstatedir']}/#{proj}"
    end
    def rubylib
      env['LIBRUBYARG_SHARED']
    end
    def pwd
      Dir.pwd #ENV['PWD']
    end
    self
  end
  def version
    stamp={}
    v="#{dir.pwd}/conf/sisu/version.yml"
    if File.exist?(v)
      stamp=YAML::load(File::open(v))
      stamp[:version]
    else ''
    end
  end
end
@p=Project_details.new
def answer?(ask)
  resp='redo'
  print ask + " ['yes', 'no' or 'quit']: "
  resp=File.new('/dev/tty').gets.strip
  #resp=gets.strip
  if resp == 'yes'; true
  elsif resp == 'no'; false
  elsif resp =~/^quit|exit$/; exit
  else puts "[please type: 'yes', 'no' or 'quit']"
    answer?(ask)
  end
end
def default_notice
  ans= %{#{@p.rake_rant}
  Information on alternative actions is available using:
  [if rake (or rant) is installed:]
    "rake help" or "rake -T" (or "rant help" or "rant -T")
  Default action selected - "install #{@p.name}" proceed? }
  resp=answer?(ans)
  exit unless resp
end
def get_username
  gets.strip
end
def chmod_file(place)
  if place =~/\/bin/; File.chmod(0755,place)
  else                File.chmod(0644,place)
  end
end
def chmod_util(place)
  if place =~/\/bin/; chmod(0755,place)
  else                chmod(0644,place)
  end
end
                                                           #%% using a directory and its mapping
def setup_find_create(dir_get,dir_put,exclude_files=[''])                     #primary,
  Find.find("#{@p.dir.pwd}/#{dir_get}") do |f|
    stub=f.scan(/#{@p.dir.pwd}\/#{dir_get}\/(\S+)/).join
    place="#{dir_put}/#{stub}"
    action=case
    when File.file?(f)
      unless f =~/#{exclude_files.inspect}/
        cp(f,place)
        chmod_file(place)
        "->  #{dir_put}/"
      end
    when File.directory?(f)
      FileUtils.mkpath(place) unless FileTest.directory?(place)
      "./#{dir_get}/"
    else '?'
    end
    puts "#{action}#{stub}"
  end
end
def setup_find_cp_r(dir_get,dir_put)                       #secondary, using recursive copy
  Find.find("#{@p.dir.pwd}/#{dir_get}") do |f|
    stub=f.scan(/#{@p.dir.pwd}\/#{dir_get}\/(\S+)/).join
    place="#{dir_put}/#{stub}"
    case
    when File.file?(f)
      cp_r(f,place)
      chmod_util(place)
    when File.directory?(f)
      mkdir(place) unless FileTest.directory?(place)
    end
  end
end
def system_info
  puts <<WOK
  #{@p.platform_notice}

  Host
    host:             #{@p.host}
    arch:             #{@p.dir.arch}
    sitearch:         #{@p.dir.sitearch}

  Directories for installation
    bin:                                          #{@p.dir.bin}
    lib (site-ruby):                              #{@p.dir.lib}/#{@p.dir.proj}/v*
    conf [etc]:                                   #{@p.dir.conf}/#{@p.dir.proj}
    data (odf, shared images):                    #{@p.dir.share}
    vim  (vim syntax, highlighting, ftplugin):    #{@p.dir.data}/sisu/vim
    data (README, version_manifest):              #{@p.dir.data}/doc/#{@p.dir.proj}
    man (manual pages):                           #{@p.dir.man}
    output:                                       #{@p.dir.out}
      processing:                                 #{@p.dir.out}/processing
      www:                                        #{@p.dir.out}/www

    rubylib:          #{@p.dir.rubylib}

WOK
end
def sisu_version_info
  def version_file
    def v4
      'data/sisu/v4/v/version.yml'
      #"#{Dir.pwd}/data/sisu/v4/v/version.yml"
    end
    def v5
      'data/sisu/v5/v/version.yml'
    end
    self
  end
  def v4
    v="#{Dir.pwd}/#{version_file.v4}"
    if File.exist?(v)
      YAML::load(File::open(v))
    else ''
    end
  end
  def v5
    v="#{Dir.pwd}/#{version_file.v5}"
    if File.exist?(v)
      YAML::load(File::open(v))
    else ''
    end
  end
  def current
    puts v4
    puts v5
  end
  def system_date
    `date "+%Y-%m-%d"`.strip
  end
  def system_date_stamp
    `date "+%Yw%W/%u"`.strip
  end
  def set
    def v4
      {
        project:        'SiSU',
        version:        '4.2.13',
        date:           "#{system_date}",
        date_stamp:     "#{system_date_stamp}",
      }
    end
    def v5
      {
        project:        'SiSU',
        version:        '5.0.26',
        date:           "#{system_date}",
        date_stamp:     "#{system_date_stamp}",
      }
    end
    def version_info_commit(filename,versioninfo,newversioninfo,existingversioninfo,version_file_is)
      ans=%{update sisu version info replacing:
  #{existingversioninfo.sort}
with:
  #{newversioninfo.sort}

#{version_file_is} becoming:
#{versioninfo}
proceed? }
      resp=answer?(ans)
      exit unless resp
      fn="#{Dir.pwd}/#{filename}"
      if File.writable?("#{Dir.pwd}/.")
        file_version=File.new(fn,'w+')
        file_version << versioninfo
        file_version.close
      else
        puts %{*WARN* is the file or directory writable? could not create #{filename}}
      end
    end
    def commit_v4
      versioninfo= <<-WOK
---
:version: #{sisu_version_info.v4[:version]}
:date_stamp: #{sisu_version_info.v4[:date_stamp]}
:date: "#{sisu_version_info.v4[:date]}"
:project: #{sisu_version_info.v4[:project]}
      WOK
      puts version_file.v4
      version_info_commit(version_file.v4,versioninfo,set.v4,sisu_version_info.v4,version_file.v4)
    end
    def commit_v5
      versioninfo= <<-WOK
---
:version: #{sisu_version_info.v5[:version]}
:date_stamp: #{sisu_version_info.v5[:date_stamp]}
:date: "#{sisu_version_info.v5[:date]}"
:project: #{sisu_version_info.v5[:project]}
      WOK
      puts version_file.v5
      version_info_commit(version_file.v5,versioninfo,set.v5,sisu_version_info.v5,version_file.v5)
    end
    def date_info
    end
    def changelog_header
      def v4
        <<-WOK
%% #{sisu_version_info.v4[:version]}.orig.tar.xz (#{sisu_version_info.v4[:date]}:#{sisu_version_info.v4[:date_stamp]})
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v4[:version]}
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v4[:version]}-1
http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz
  sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz
  sisu_#{sisu_version_info.v4[:version]}-1.dsc
        WOK
      end
      def v5
        <<-WOK
%% #{sisu_version_info.v5[:version]}.orig.tar.xz (#{sisu_version_info.v5[:date]}:#{sisu_version_info.v5[:date_stamp]})
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v5[:version]}
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v5[:version]}-1
http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz
  sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz
  sisu_#{sisu_version_info.v5[:version]}-1.dsc
        WOK
      end
      self
    end
    self
  end
  self
end
def version_update_manual
  puts 'date:       ' + `date "+%Y-%m-%d"`
  puts 'date_stamp: ' + `date "+%Yw%W/%u"`
end
def gemspecs
  def sisu4
    <<-WOK
Gem::Specification.new do |s|
  s.name           = '#{sisu_version_info.v4[:project].downcase}'
  s.version        = '#{sisu_version_info.v4[:version]}'
  s.date           = '#{sisu_version_info.v4[:date]}'
  s.summary        = '#{sisu_version_info.v4[:project]}'
  s.description    = 'SiSU gem'
  s.authors        = ["Ralph Amissah"]
  s.email          = 'ralph.amissah@gmail.com'
  s.files          = Dir['lib/sisu/v4/*.rb'] +
                     Dir['lib/sisu/v5/*.rb'] +
                     Dir['data/sisu/v4/v/version.yml'] +
                     Dir['data/sisu/v5/v/version.yml'] +
                     Dir['bin/sisugem'] +
                     Dir['bin/sisu']
  s.license        = 'GPL3'
  s.executables << 'sisugem' << 'sisu'
end
    WOK
  end
  def sisu5
    <<-WOK
Gem::Specification.new do |s|
  s.name           = '#{sisu_version_info.v5[:project].downcase}'
  s.version        = '#{sisu_version_info.v5[:version]}'
  s.date           = '#{sisu_version_info.v5[:date]}'
  s.summary        = '#{sisu_version_info.v5[:project]}'
  s.description    = 'SiSU gem'
  s.authors        = ["Ralph Amissah"]
  s.email          = 'ralph.amissah@gmail.com'
  s.files          = Dir['lib/sisu/v4/*.rb'] +
                     Dir['lib/sisu/v5/*.rb'] +
                     Dir['data/sisu/v4/v/version.yml'] +
                     Dir['data/sisu/v5/v/version.yml'] +
                     Dir['bin/sisugem'] +
                     Dir['bin/sisu']
  s.license        = 'GPL3'
  s.executables << 'sisugem' << 'sisu'
end
    WOK
  end
  def gemspec_create(filename,gemspec)
    fn="#{Dir.pwd}/#{filename}"
    if File.writable?("#{Dir.pwd}/.")
      file_sisu_gemspec=File.new(fn,'w+')
      file_sisu_gemspec << gemspec
      file_sisu_gemspec.close
    else
      puts %{*WARN* is the file or directory writable? could not create #{filename}}
    end
  end
  def sisu4_gemspec_create
    filename='sisu4.gemspec'
    gemspec_create(filename,sisu4)
  end
  def sisu5_gemspec_create
    filename='sisu5.gemspec'
    gemspec_create(filename,sisu5)
  end
  def sisu4_build
    system(%{ gem build sisu4.gemspec })
  end
  def sisu5_build
    system(%{ gem build sisu5.gemspec })
  end
  def sisu4_install
    system(%{
      sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v4[:version]}.gem
    })
  end
  def sisu5_install
    system(%{
      sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v5[:version]}.gem
    })
  end
  self
end
def project_help
  puts <<WOK

#{@p.name}
  #{@p.rake_rant}
  #{@p.platform_notice}

Commands quick start list

  #{@p.name} Rake/Rant Help: (Rakefile or Rantfile)
    rake -T or rant -T          # a task list, (generated by Rake or Rant) for more complete and up to date help
    rake system or rant system  # system info used

  Quick start install and remove project #{@p.name}
   as root:
    rake or rant                                # install #{@p.name}
    rake base

    rake setup                                  # install #{@p.name} (larger install)

    rake install                                # reinstall #{@p.name}

    rake remove                                 # clobber/remove #{@p.name}, current version: #{@p.version}
    rake remove_package                         # clobber/remove #{@p.name}, all versions

For a more detailed and up to date list of command options use:
  rake -T
  rant -T

WOK
end
def tasks
  system('rake -T')
end
#% tasks
desc "rake/rant sisu install (as root type 'rake' or 'rant')"
task :default => [:default_notice,:setup_base]
#task :default => [:help,:notice,:project]
desc "Setup/Install #{@p.name} and try generate a file"
task :project=> [:setup_bin,:setup_lib,:setup_conf,:setup_share,:setup_data,:setup_man,:setup_vim,:post_install_note]
desc "Setup/Install #{@p.name}"
task :setup=> [:setup_bin, :setup_lib,:setup_conf,:setup_share,:setup_data] #, :help]
desc "Setup/Install #{@p.name}: bin, lib and conf (no data)"
task :setup_base=> [:setup_bin,:setup_lib,:setup_conf,:setup_share,:setup_man,:setup_vim]
desc "Setup/Install #{@p.name} bin, lib and conf (no data and no attempt to do postinstall setup)"
task :base=> [:setup_base]
desc "check package version"
task :sisuversion => [:sisu_version]
desc "set package version"
task :sisuversionset => [:sisu_version_set]
desc "check gempsec info"
task :gemspec => [:gemspec_info]
desc "create gempsec"
task :gemspecscreate => [:gemspecs_create]
desc "build gem"
task :gembuild => [:gem_build]
desc "install gem"
task :geminstall => [:gem_install]
desc "build and install gem"
task :gembuildinstall => [:gem_build,:gem_install]
desc "create, build and install sisu gem"
task :gemcbi => [:gemspecs_create,:gem_build,:gem_install]
desc "check changelog headers"
task :changelogheaders => [:changelog_headers]
if File.directory?('bin')                                       #bin
  desc "Setup #{@p.name} bin only, synonym :bin"
  task :bin => [:setup_bin]
end
if File.directory?('lib')                                       #lib
  desc "Setup #{@p.name} lib only, synonym :lib"
  task :lib => [:setup_lib]
end
if File.directory?('conf')                                      #conf or etc
  desc "Setup #{@p.name} conf only, synonyms :conf & :etc"
  task :conf => [:setup_conf]
  task :setup_etc => [:setup_conf]
  task :etc => [:setup_conf]
end
if File.directory?('data')                                      #data
  desc "Setup #{@p.name} data only, synonyms :data & :examples"
  task :data => [:setup_data]
  task :setup_examples => [:setup_data]
  task :examples => [:setup_data]
end
if File.directory?('data/sisu')                                      #share (odf shared-images)
  desc "Setup #{@p.name} shared data only (odf & shared images)"
  task :share => [:setup_share]
end
if File.directory?('man')                                  #man pages
  desc "Setup #{@p.name} man pages only, synonyms :man"
  task :man => [:setup_man]
end
if File.directory?('data/vim')                                  #man pages
  desc "Setup #{@p.name} vim config files only, synonyms :vim"
  task :setup_vim => [:setup_vim]
  task :vim => [:setup_vim]
end
desc "Setup/Install #{@p.name}: bin, lib, conf and data (no attempt to do postinstall setup)"
task :setup_only=> [:setup_bin,:setup_lib,:setup_conf,:setup_share,:setup_data,:help]
desc "Remove #{@p.name} (all versions)"                   #remove project
task :remove_package => [:remove_bin, :remove_lib, :remove_conf]
if File.directory?('bin')                                       #bin
  desc "Remove #{@p.name} bin only"                       #remove bin
  task :remove_bin => [:remove_bin]
end
if File.directory?('lib')                                       #lib
  desc "Remove #{@p.name} lib only"                       #remove lib
  task :remove_lib => [:remove_lib]
end
if File.directory?('conf')                                      #conf
  desc "Remove #{@p.name} conf only"                      #remove conf
  task :remove_conf => [:remove_conf]
end
desc "Re-setup #{@p.name}, synonym :reinstall"            #resetup reinstall
task :resetup => [:remove, :setup]
task :reinstall => [:remove, :setup]
desc "Re-setup #{@p.name}: bin, lib, conf (ignore data), synonym :reinstall"  #partial reinstall
task :resetup_base => [:remove, :setup_base]
task :reinstall_base => [:remove, :setup_base]
if File.directory?('bin')                                       #bin
  desc "Re-setup #{@p.name} bin, synonym :reinstall"
  task :resetup_bin => [:remove_bin, :setup_bin]
  task :reinstall_bin => [:remove_bin, :setup_bin]
end
if File.directory?('lib')                                       #lib
  desc "Re-setup #{@p.name} lib, synonym :reinstall_lib"
  task :resetup_lib => [:remove_lib, :setup_lib]
  task :reinstall_lib => [:remove_lib, :setup_lib]
end
if File.directory?('conf')                                       #conf
  desc "Re-setup #{@p.name} conf, synonyms :reinstall_conf & :resetup_etc"
  task :resetup_conf => [:remove_conf, :setup_conf]
  task :reinstall_conf => [:remove_conf, :setup_conf]
  task :resetup_etc => [:remove_conf, :setup_conf]
  task :reinstall_etc => [:remove_conf, :setup_conf]
end
if File.directory?('data/sisu')                                       #share
  desc "Re-setup #{@p.name} shared data, (odf & images)"
  task :resetup_share => [:remove_share, :setup_share]
  task :reinstall_share => [:remove_share, :setup_share]
end
if File.directory?('man')                                    #man
  desc "Re-setup #{@p.name} man, synonym :reinstall_man"
  task :resetup_man => [:remove_man, :setup_man]
  task :reinstall_man => [:remove_man, :setup_man]
end
desc 'Setup Note'
task :setup_note => [:help]
desc "System information used by #{@p.name}"
task :system => [:system_info,:project_help,:post_install_note]
desc "show all system info available - parameters found"
task :system_param => [:system_param]
desc 'Help'
task :help => [:project_help,:system_info,:tasks]
#desc "Setup/Install #{@p.name} (uses filelist)"
task :install => [:default_notice,:project]
task :install_bin => [:setup_bin]
                                                           #%% setup/install tasks
task :rant_independence do                                 #notice
  resp=''
  while resp.length < 4
    resp='sisu-install'                                     #default name install
    print %{#{@p.rake_rant}
  Create a rant dependency independent file
  provide filename default name is "install"
    [Warning, will overwrite file of name provided
      provide name or "quit" to exit]: }
    exit if resp =~/^(?:n|quit|exit)$/
  end
  remove='y' #remove='n'
 if remove =~/y/
   system("rant-import --force --auto #{resp};
     chmod 755 #{resp}
   ")
 else #puts "#{resp} not replaced"
 end
end

task :default_notice do                                    #notice
  default_notice
end
task :default2 do                                     #secondary
  setup_find_cp_r('bin',@p.dir.bin) if File.directory?('bin')
  setup_find_cp_r('lib',@p.dir.lib) if File.directory?('lib')
  setup_find_cp_r('conf',@p.dir.conf) if File.directory?('conf')
  setup_find_cp_r('data/sisu',@p.dir.share) if File.directory?('data/sisu') #
  setup_find_cp_r('data',@p.dir.data) if File.directory?('data')
  setup_find_cp_r('data/vim',"#{@p.dir.data}/vim") if File.directory?('data/vim')
  setup_find_cp_r('man',@p.dir.man) if File.directory?('man')
end
task :setup_bin do                                         #bin
  exclude_files=['sisugem']
  setup_find_create('bin',@p.dir.bin,exclude_files) if File.directory?('bin')
end
task :setup_lib do                                         #lib
  setup_find_create('lib',@p.dir.lib) if File.directory?('lib')
end
task :setup_conf do                                        #conf
  setup_find_create('conf',@p.dir.conf) if File.directory?('conf')
end
task :setup_share do                                        #share
  setup_find_create('data/sisu',@p.dir.share) if File.directory?('data/sisu')
end
task :setup_data do                                        #data
  setup_find_create('data',@p.dir.data) if File.directory?('data')
end
task :setup_man do                                         #man
  setup_find_create('man',@p.dir.man) if File.directory?('man') #man pages
  setup_find_create('man.deb/man',@p.dir.man) if File.directory?('man.deb/man') #man pages
end
task :setup_vim do                                         #man
  setup_find_create('data/vim',@p.dir.vim) if File.directory?('data/vim') #man pages
end
task :gemspec_info do                                         #man
  version_update_manual
  gemspecs.sisu4
  gemspecs.sisu5
end
task :gemspecs_create do                                         #man
  gemspecs.sisu4_gemspec_create
  gemspecs.sisu5_gemspec_create
end
task :gem_build do                                         #man
  gemspecs.sisu4_build
  gemspecs.sisu5_build
end
task :gem_install do                                         #man
  gemspecs.sisu4_install
  gemspecs.sisu5_install
end
task :changelog_headers do                                         #man
  puts '---'
  puts sisu_version_info.set.changelog_header.v4
  puts '---'
  puts sisu_version_info.set.changelog_header.v5
end
task :sisu_version do                                         #man
  puts sisu_version_info.set.v4
  puts sisu_version_info.set.v5
  puts sisu_version_info.current
  #version.current.each do |x|
  #  puts x
  #end
  puts sisu_version_info.v4[:project]
  puts sisu_version_info.v4[:version]
  puts sisu_version_info.v4[:date]
  puts sisu_version_info.v4[:date_stamp]
  puts '---'
  puts sisu_version_info.v5[:project]
  puts sisu_version_info.v5[:version]
  puts sisu_version_info.v5[:date]
  puts sisu_version_info.v5[:date_stamp]
end
task :sisu_version_set do                                         #man
  sisu_version_info.set.commit_v4
  sisu_version_info.set.commit_v5
end
                                                           #%% post install
                                                           #%% clobber/remove tasks
task :remove_bin do
  rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
end
task :remove_lib do
  rm_r "#{@p.dir.lib}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}")
end
task :remove_conf do
  rm_r "#{@p.dir.conf}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :remove_man do
  rm_r "#{@p.dir.man}/**/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.man}/man1/#{@p.dir.proj}")
end
task :remove_version do
  rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
  rm_r "#{@p.dir.lib}/#{@p.dir.proj}/#{@p.version}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}/#{@p.version}")
  rm_r "#{@p.dir.conf}/#{@p.dir.proj} if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :remove_package do
  rm_r "#{@p.dir.bin}/#{@p.dir.proj}" if FileTest.file?("#{@p.dir.bin}/#{@p.dir.proj}")
  rm_r "#{@p.dir.lib}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.lib}/#{@p.dir.proj}")
  rm_r "#{@p.dir.conf}/#{@p.dir.proj}" if FileTest.directory?("#{@p.dir.conf}/#{@p.dir.proj}")
end
task :post_install_note do
  puts <<WOK

  sisu markup samples are now packaged separately in sisu-markup-samples
    visit:
      <http://www.jus.uio.no/sisu>
      <http://search.sisudoc.org>
    and:
      <http://www.jus.uio.no/sisu/SiSU/download>

WOK
end
task :system_info do                                       #%% system info
  system_info
end
task :system_param do
  @env.each {|c| puts c.inspect }
end
task :project_help do                                       #%% help
  project_help
end
task :tasks do                                       #%% help
  tasks
end