Class: ToplevelInstallerMulti

Inherits:
ToplevelInstaller show all
Includes:
FileOperations
Defined in:
lib/vendor/xmpp4r/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.



1029
1030
1031
1032
1033
1034
# File 'lib/vendor/xmpp4r/setup.rb', line 1029

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.



1043
1044
1045
# File 'lib/vendor/xmpp4r/setup.rb', line 1043

def packages
  @packages
end

Instance Method Details

#each_selected_installersObject

lib



1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/vendor/xmpp4r/setup.rb', line 1131

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



1113
1114
1115
1116
1117
1118
# File 'lib/vendor/xmpp4r/setup.rb', line 1113

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



1088
1089
1090
1091
1092
1093
# File 'lib/vendor/xmpp4r/setup.rb', line 1088

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



1120
1121
1122
1123
1124
1125
# File 'lib/vendor/xmpp4r/setup.rb', line 1120

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



1101
1102
1103
1104
1105
# File 'lib/vendor/xmpp4r/setup.rb', line 1101

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

#exec_setupObject



1095
1096
1097
1098
1099
# File 'lib/vendor/xmpp4r/setup.rb', line 1095

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

#exec_testObject



1107
1108
1109
1110
1111
# File 'lib/vendor/xmpp4r/setup.rb', line 1107

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

#extract_selection(list) ⇒ Object



1069
1070
1071
1072
1073
1074
1075
# File 'lib/vendor/xmpp4r/setup.rb', line 1069

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



1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
# File 'lib/vendor/xmpp4r/setup.rb', line 1054

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)


1152
1153
1154
# File 'lib/vendor/xmpp4r/setup.rb', line 1152

def no_harm?
  @config.no_harm?
end


1077
1078
1079
1080
1081
1082
# File 'lib/vendor/xmpp4r/setup.rb', line 1077

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

#run_hook(id) ⇒ Object



1142
1143
1144
# File 'lib/vendor/xmpp4r/setup.rb', line 1142

def run_hook(id)
  @root_installer.run_hook id
end

#run_metaconfigsObject



1036
1037
1038
1039
1040
1041
# File 'lib/vendor/xmpp4r/setup.rb', line 1036

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)


1147
1148
1149
# File 'lib/vendor/xmpp4r/setup.rb', line 1147

def verbose?
  @config.verbose?
end