Class | ConfigTable |
In: |
lib/mime-types-1.16/setup.rb
|
Parent: | Object |
ALIASES | = | { 'std-ruby' => 'librubyver', 'stdruby' => 'librubyver', 'rubylibdir' => 'librubyver', 'archdir' => 'librubyverarch', 'site-ruby-common' => 'siteruby', # For backward compatibility 'site-ruby' => 'siterubyver', # For backward compatibility 'bin-dir' => 'bindir', 'bin-dir' => 'bindir', 'rb-dir' => 'rbdir', 'so-dir' => 'sodir', 'data-dir' => 'datadir', 'ruby-path' => 'rubypath', 'ruby-prog' => 'rubyprog', 'ruby' => 'rubyprog', 'make-prog' => 'makeprog', 'make' => 'makeprog' |
config_opt | [RW] | |
install_prefix | [RW] | |
no_harm | [W] | |
verbose | [W] |
# File lib/mime-types-1.16/setup.rb, line 49 def initialize(rbconfig) @rbconfig = rbconfig @items = [] @table = {} # options @install_prefix = nil @config_opt = nil @verbose = true @no_harm = false end
# File lib/mime-types-1.16/setup.rb, line 99 def add(item) @items.push item @table[item.name] = item end
# File lib/mime-types-1.16/setup.rb, line 295 def fixup ALIASES.each do |ali, name| @table[ali] = @table[name] end @items.freeze @table.freeze @options_re = /\A--(#{@table.keys.join('|')})(?:=(.*))?\z/ end
# File lib/mime-types-1.16/setup.rb, line 260 def load_multipackage_entries multipackage_entries().each do |ent| add ent end end
# File lib/mime-types-1.16/setup.rb, line 121 def load_savefile begin File.foreach(savefile()) do |line| k, v = *line.split(/=/, 2) self[k] = v.strip end rescue Errno::ENOENT setup_rb_error $!.message + "\n#{File.basename($0)} config first" end end
# File lib/mime-types-1.16/setup.rb, line 111 def load_script(path, inst = nil) if File.file?(path) MetaConfigEnvironment.new(self, inst).instance_eval File.read(path), path end end
# File lib/mime-types-1.16/setup.rb, line 141 def load_standard_entries standard_entries(@rbconfig).each do |ent| add ent end end
# File lib/mime-types-1.16/setup.rb, line 95 def lookup(name) @table[name] or setup_rb_error "no such config item: #{name}" end
# File lib/mime-types-1.16/setup.rb, line 304 def parse_opt(opt) m = @options_re.match(opt) or setup_rb_error "config: unknown option #{opt}" m.to_a[1,2] end
# File lib/mime-types-1.16/setup.rb, line 104 def remove(name) item = lookup(name) @items.delete_if {|i| i.name == name } @table.delete_if {|name, i| i.name == name } item end
# File lib/mime-types-1.16/setup.rb, line 132 def save @items.each {|i| i.value } File.open(savefile(), 'w') {|f| @items.each do |i| f.printf "%s=%s\n", i.name, i.value if i.value? and i.value end } end