lib/setup/configuration.rb in setup-5.1.0 vs lib/setup/configuration.rb in setup-5.2.0

- old
+ new

@@ -11,11 +11,11 @@ # Stores platform information and general install settings. # class Configuration # Ruby System Configuration - RBCONFIG = ::Config::CONFIG + RBCONFIG = ::RbConfig::CONFIG ## Confgiuration file #CONFIG_FILE = 'SetupConfig' # '.cache/setup/config' # Custom configuration file. @@ -24,11 +24,13 @@ # def self.options @@options ||= [] end + # # TODO: better methods for path type + # def self.option(name, *args) #type, description) options << [name.to_s, *args] #type, description] attr_accessor(name) end @@ -74,20 +76,20 @@ option :installdirs , :pick, 'install location mode (site,std,home)' #, local) option :type , :pick, 'install location mode (site,std,home)' # Turn all of CONFIG into methods. - ::Config::CONFIG.each do |key,val| + ::RbConfig::CONFIG.each do |key,val| next if key == "configure_args" name = key.to_s.downcase #name = name.sub(/^--/,'') #name = name.gsub(/-/,'_') define_method(name){ val } end # Turn all of CONFIG["configure_args"] into methods. - config_args = Shellwords.shellwords(::Config::CONFIG["configure_args"]) + config_args = Shellwords.shellwords(::RbConfig::CONFIG["configure_args"]) config_args.each do |ent| if ent.index("=") key, val = *ent.split("=") else key, val = ent, true @@ -591,11 +593,12 @@ end # Save configuration. def save_config out = to_yaml - if not File.exist?(File.dirname(CONFIG_FILE)) - FileUtils.mkdir_p(File.dirname(CONFIG_FILE)) + dir = File.dirname(CONFIG_FILE) + unless File.exist?(dir) + FileUtils.mkdir_p(dir) end if File.exist?(CONFIG_FILE) txt = File.read(CONFIG_FILE) return nil if txt == out end