aboutsummaryrefslogtreecommitdiffhomepage
path: root/qi
blob: f5711eaf1a186d8673f4cb141d0f747e7b9409f2 (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
#!/usr/bin/env ruby
=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")
#% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file)
begin
  require 'thor'
rescue LoadError
  puts 'thor (package ruby-thor) not found'
end
require_relative 'setup/sisu_version'   # setup/sisu_version.rb
  include SiSUversion
require_relative 'setup/qi_libs'        # setup/qi_libs.rb
require 'find'
require 'fileutils'
  include FileUtils
require 'pathname'
require 'rbconfig.rb'
require 'yaml'
module SiSUconf
  class Configure < Thor
    class_option :verbose, :type => :boolean
    desc 'setup --all --bin --lib --conf --data --alt',
      'setup sisu'
    options \
      :all => :boolean,
      :bin => :boolean,
      :lib => :boolean,
      :conf => :boolean,
      :data => :boolean,
      :share => :boolean,
      :man => :boolean,
      :vim => :boolean,
      :alt => :boolean
    def setup
      unless options.length >= 1 \
      and not (options[:bin] \
      or options[:lib] \
      or options[:conf] \
      or options[:data] \
      or options[:share] \
      or options[:man] \
      or options[:vim])
        puts 'setup --all --bin --lib --conf --data --share --man --vim'
      end
      if not options[:alt]
        if options[:all] \
        or options[:bin]
          exclude_files=['sisugem']
          Install.setup_find_create('bin',Project_details.dir.bin,exclude_files) \
            if File.directory?('bin')
        end
        if options[:all] \
        or options[:lib]
          Install.setup_find_create('lib',Project_details.dir.lib) \
            if File.directory?('lib')
        end
        if options[:all] \
        or options[:conf]
          Install.setup_find_create('conf',Project_details.dir.conf) \
            if File.directory?('conf')
        end
        if options[:all] \
        or options[:data]
          Install.setup_find_create('data',Project_details.dir.data) \
            if File.directory?('data')
        end
        if options[:all] \
        or options[:share]
          Install.setup_find_create('data/sisu',Project_details.dir.share) \
            if File.directory?('data/sisu')
        end
        if options[:all] \
        or options[:man]
          Install.setup_find_create('man',Project_details.dir.man) \
            if File.directory?('man')
        end
        if options[:all] \
        or options[:vim]
          Install.setup_find_create('data/vim',Project_details.dir.vim) \
            if File.directory?('data/vim')
        end
      else
        if options[:all] \
        or options[:bin]
          Install.setup_find_cp_r('bin',Project_details.dir.bin) \
            if File.directory?('bin')
        end
        if options[:all] \
        or options[:bin]
          Install.setup_find_cp_r('lib',Project_details.dir.lib) \
            if File.directory?('lib')
        end
        if options[:all] \
        or options[:conf]
          Install.setup_find_cp_r('conf',Project_details.dir.conf) \
            if File.directory?('conf')
        end
        if options[:all] \
        or options[:data]
          Install.setup_find_cp_r('data',Project_details.dir.data) \
            if File.directory?('data')
        end
        if options[:all] \
        or options[:share]
          Install.setup_find_cp_r('data/sisu',Project_details.dir.share) \
            if File.directory?('data/sisu') #
        end
        if options[:all] \
        or options[:man]
          Install.setup_find_cp_r('man',Project_details.dir.man) \
            if File.directory?('man')
        end
        #if options[:all] \
        #or options[:vim]
        #  Install.setup_find_cp_r('data/vim',"#{Project_details.dir.data}/vim") \
        #    if File.directory?('data/vim')
        #end
      end
    end
    desc 'gem --create --build --install --stable --unstable',
      'gem create build and install'
    options \
      :stable => :boolean,
      :unstable => :boolean,
      :create => :boolean,
      :build => :boolean,
      :install => :boolean
    def gem
      if options[:unstable]
        if options[:create]
          Gemspecs::Current.create_unstable
          #Gemspecs::Next.create_unstable
          puts 'created gemspec, version: unstable' \
            if options[:verbose]
        end
        if options[:build]
          Gemspecs::Current.build_unstable
          #Gemspecs::Next.build_unstable
          puts 'built gem, version: unstable' \
            if options[:verbose]
        end
        if options[:install]
          Gemspecs::Current.install_unstable
          #Gemspecs::Next.install_unstable
          puts 'installed gem, version: unstable' \
            if options[:verbose]
        end
      end
      if options[:stable] \
      or not options[:unstable]
        if options[:create]
          Gemspecs::Current.create_stable
          #Gemspecs::Current.create_unstable
          puts 'created gemspec, version: stable' \
            if options[:verbose]
        end
        if options[:build]
          Gemspecs::Current.build_stable
          #Gemspecs::Next.build_stable
          puts 'built gem, version: stable' \
            if options[:verbose]
        end
        if options[:install]
          Gemspecs::Current.install_stable
          #Gemspecs::Next.install_stable
          puts 'installed gem, version: stable' \
            if options[:verbose]
        end
      end
      if options.length < 2
        system("#{$called_as} help gem")
      end
    end
    desc 'pkg',
      'package maintenance tasks, of no general interest (maintainer specific for package maintainer\'s convenience)'
    options \
      :update_version=> :boolean,
      :tip => :boolean
    def pkg
      if options[:tip]
        Package.sequence
      end
      if options[:update_version]
        Version_info::Update.update_stable
        Version_info::Update.update_unstable
        puts "\n" + Version_info::Update.changelog_header_stable
        puts "\n" + Version_info::Update.changelog_header_unstable
      end
      if options.length == 0
        system("#{$called_as} help pkg")
        system("#{$called_as} pkg --tip")
      end
    end
  end
end
begin
  $called_as,$argv=$0,$*
  SiSUconf::Configure.start(ARGV)
rescue
end
__END__