Class: ToplevelInstallerMulti

Inherits:
ToplevelInstaller show all
Includes:
FileOperations
Defined in:
lib/priority-queue/setup.rb

Constant Summary

Constants included from FileOperations

FileOperations::DIR_REJECT

Constants inherited from ToplevelInstaller

ToplevelInstaller::Copyright, ToplevelInstaller::TASKS, ToplevelInstaller::Version

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileOperations

#command, #diff?, #directories_of, #extdir?, #files_of, #force_remove_file, #install, #make, #mkdir_p, #move_file, #remove_file, #remove_tree, #remove_tree0, #rm_f, #rm_rf, #ruby

Methods inherited from ToplevelInstaller

#config, #exec_show, #inspect, invoke, #invoke, load_rbconfig, multipackage?, #objdir_root, #parsearg_config, #parsearg_global, #parsearg_install, #parsearg_no_options, #relpath, #srcdir_root, #valid_task?, #valid_task_re

Constructor Details

#initialize(ardir_root, config) ⇒ ToplevelInstallerMulti

Returns a new instance of ToplevelInstallerMulti.



1028
1029
1030
1031
1032
1033
# File 'lib/priority-queue/setup.rb', line 1028

def initialize(ardir_root, config)
  super
  @packages = directories_of("#{@ardir}/packages")
  raise 'no package exists' if @packages.empty?
  @root_installer = Installer.new(@config, @ardir, File.expand_path('.'))
end

Instance Attribute Details

#packagesObject

Returns the value of attribute packages.



1042
1043
1044
# File 'lib/priority-queue/setup.rb', line 1042

def packages
  @packages
end

Instance Method Details

#each_selected_installersObject

lib



1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/priority-queue/setup.rb', line 1130

def each_selected_installers
  Dir.mkdir 'packages' unless File.dir?('packages')
  @selected.each do |pack|
    $stderr.puts "Processing the package `#{pack}' ..." if verbose?
    Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
    Dir.chdir "packages/#{pack}"
    yield @installers[pack]
    Dir.chdir '../..'
  end
end

#exec_cleanObject



1112
1113
1114
1115
1116
1117
# File 'lib/priority-queue/setup.rb', line 1112

def exec_clean
  rm_f @config.savefile
  run_hook 'pre-clean'
  each_selected_installers {|inst| inst.exec_clean }
  run_hook 'post-clean'
end

#exec_configObject

Task Handlers



1087
1088
1089
1090
1091
1092
# File 'lib/priority-queue/setup.rb', line 1087

def exec_config
  run_hook 'pre-config'
  each_selected_installers {|inst| inst.exec_config }
  run_hook 'post-config'
  @config.save   # must be final
end

#exec_distcleanObject



1119
1120
1121
1122
1123
1124
# File 'lib/priority-queue/setup.rb', line 1119

def exec_distclean
  rm_f @config.savefile
  run_hook 'pre-distclean'
  each_selected_installers {|inst| inst.exec_distclean }
  run_hook 'post-distclean'
end

#exec_installObject



1100
1101
1102
1103
1104
# File 'lib/priority-queue/setup.rb', line 1100

def exec_install
  run_hook 'pre-install'
  each_selected_installers {|inst| inst.exec_install }
  run_hook 'post-install'
end

#exec_setupObject



1094
1095
1096
1097
1098
# File 'lib/priority-queue/setup.rb', line 1094

def exec_setup
  run_hook 'pre-setup'
  each_selected_installers {|inst| inst.exec_setup }
  run_hook 'post-setup'
end

#exec_testObject



1106
1107
1108
1109
1110
# File 'lib/priority-queue/setup.rb', line 1106

def exec_test
  run_hook 'pre-test'
  each_selected_installers {|inst| inst.exec_test }
  run_hook 'post-test'
end

#extract_selection(list) ⇒ Object



1068
1069
1070
1071
1072
1073
1074
# File 'lib/priority-queue/setup.rb', line 1068

def extract_selection(list)
  a = list.split(/,/)
  a.each do |name|
    setup_rb_error "no such package: #{name}"  unless @installers.key?(name)
  end
  a
end

#init_installersObject



1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/priority-queue/setup.rb', line 1053

def init_installers
  @installers = {}
  @packages.each do |pack|
    @installers[pack] = Installer.new(@config,
                                     "#{@ardir}/packages/#{pack}",
                                     "packages/#{pack}")
  end
  with    = extract_selection(config('with'))
  without = extract_selection(config('without'))
  @selected = @installers.keys.select {|name|
                (with.empty? or with.include?(name)) \
                    and not without.include?(name)
              }
end

#no_harm?Boolean

module FileOperations requires this

Returns:

  • (Boolean)


1151
1152
1153
# File 'lib/priority-queue/setup.rb', line 1151

def no_harm?
  @config.no_harm?
end


1076
1077
1078
1079
1080
1081
# File 'lib/priority-queue/setup.rb', line 1076

def print_usage(f)
  super
  f.puts 'Inluded packages:'
  f.puts '  ' + @packages.sort.join(' ')
  f.puts
end

#run_hook(id) ⇒ Object



1141
1142
1143
# File 'lib/priority-queue/setup.rb', line 1141

def run_hook(id)
  @root_installer.run_hook id
end

#run_metaconfigsObject



1035
1036
1037
1038
1039
1040
# File 'lib/priority-queue/setup.rb', line 1035

def run_metaconfigs
  @config.load_script "#{@ardir}/metaconfig", self
  @packages.each do |name|
    @config.load_script "#{@ardir}/packages/#{name}/metaconfig"
  end
end

#verbose?Boolean

module FileOperations requires this

Returns:

  • (Boolean)


1146
1147
1148
# File 'lib/priority-queue/setup.rb', line 1146

def verbose?
  @config.verbose?
end