lib/setup/config.rb in setup-4.1.0 vs lib/setup/config.rb in setup-4.2.0

- old
+ new

@@ -32,12 +32,12 @@ [:sodir , :path, 'directory for ruby extentions'], [:rubypath , :prog, 'path to set to #! line'], [:rubyprog , :prog, 'ruby program used for installation'], [:makeprog , :prog, 'make program to compile ruby extentions'], [:extconfopt , :name, 'options to pass-thru to extconf.rb'], - [:without_ext , :bool, 'do not compile/install ruby extentions'], - [:without_doc , :bool, 'do not generate html documentation'], + [:withoutext , :bool, 'do not compile/install ruby extentions'], + [:withoutdoc , :bool, 'do not generate documentation'], [:shebang , :pick, 'shebang line (#!) editing mode (all,ruby,never)'], [:doctemplate , :pick, 'document template to use (html|xml)'], [:testrunner , :pick, 'Runner to use for testing (auto|console|tk|gtk|gtk2)'], [:installdirs , :pick, 'install location mode (std,site,home :: libruby,site_ruby,$HOME)'] ] @@ -51,14 +51,14 @@ class_eval %{ def #{name} @#{name}.gsub(%r<\\$([^/]+)>){ self[$1] } end def #{name}=(path) - raise SetupError, "bad config: #{name.to_s.upcase} requires argument" unless path + raise Error, "bad config: #{name.to_s.upcase} requires argument" unless path @#{name} = (path[0,1] == '$' ? path : File.expand_path(path)) end - } + } end # List of pathnames. These are not expanded though. def self.attr_pathlist(name) class_eval %{ @@ -71,11 +71,11 @@ @#{name} = pathlist else @#{name} = pathlist.to_s.split(/[:;,]/) end end - } + } end # Adds boolean support. def self.attr_accessor(*names) bools, attrs = names.partition{ |name| name.to_s =~ /\?$/ } @@ -100,11 +100,11 @@ when 'y', 'yes', 't', 'true' @#{name} = true when 'n', 'no', 'f', 'false' @#{name} = false else - raise SetupError, "bad config: use #{name.upcase}=(yes|no) [\#{val}]" + raise Error, "bad config: use #{name.upcase}=(yes|no) [\#{val}]" end end end } class_eval code @@ -131,11 +131,11 @@ # shebang has only three options. def shebang=(val) if %w(all ruby never).include?(val) @shebang = val else - raise SetupError, "bad config: use SHEBANG=(all|ruby|never) [#{val}]" + raise Error, "bad config: use SHEBANG=(all|ruby|never) [#{val}]" end end # installdirs has only three options; and it has side-effects. def installdirs=(val) @@ -146,16 +146,16 @@ self.sodir = '$librubyverarch' when 'site' self.rbdir = '$siterubyver' self.sodir = '$siterubyverarch' when 'home' - raise SetupError, 'HOME is not set.' unless ENV['HOME'] + raise Error, 'HOME is not set.' unless ENV['HOME'] self.prefix = ENV['HOME'] self.rbdir = '$libdir/ruby' self.sodir = '$libdir/ruby' else - raise SetupError, "bad config: use INSTALLDIRS=(std|site|home|local) [#{val}]" + raise Error, "bad config: use INSTALLDIRS=(std|site|home|local) [#{val}]" end end # New ConfigTable def initialize(values=nil) @@ -268,14 +268,14 @@ self.rubypath = rubypath self.rubyprog = rubypath self.makeprog = makeprog self.extconfopt = '' self.shebang = 'ruby' - self.without_ext = 'no' - self.without_doc = 'yes' - self.doctemplate = 'html' - self.testrunner = 'auto' + self.withoutext = 'no' + self.withoutdoc = 'no' + self.doctemplate = nil + self.testrunner = 'auto' # needed? self.installdirs = 'site' end # Get configuration from environment. def env_config @@ -294,11 +294,11 @@ k, v = *line.split(/=/, 2) k.gsub!('-','_') __send__("#{k}=",v.strip) #self[k] = v.strip end rescue Errno::ENOENT - raise SetupError, $!.message + "\n#{File.basename($0)} config first" + raise Error, $!.message + "\n#{File.basename($0)} config first" end #end end # Save configuration. @@ -328,11 +328,10 @@ printf fmt, name, reslv end end # - def extconfs @extconfs ||= Dir['ext/**/extconf.rb'] end def extensions @@ -360,10 +359,10 @@ # self[name].gsub(%r<\\$([^/]+)>){ self[$1] } #end # Metaconfig file is '.config/setup/metaconfig{,.rb}'. def load_meta_config - path = Dir.glob('.config/setup/metaconfig{,.rb}').first + path = Dir.glob('.config/setup/metaconfig{,.rb}').first if path && File.file?(path) MetaConfigEnvironment.new(self).instance_eval(File.read(path), path) end end