lib/rbcli/util/config.rb in rbcli-0.1.3 vs lib/rbcli/util/config.rb in rbcli-0.1.4

- old
+ new

@@ -112,11 +112,12 @@ self.load unless @loaded (@config.nil?) ? @config_defaults : @config end def self.generate_userconf filename - filepath = "#{(filename) ? filename : "#{Dir.pwd}/config.yml"}" + filepath = File.expand_path "#{(filename) ? filename : "#{Dir.pwd}/config.yml"}" + FileUtils.touch filepath File.write filepath, @config_text File.open(filepath, 'a') do |f| f.puts "# Individual Settings" @config_individual_lines.each { |l| f.puts l } end if @config_individual_lines @@ -126,10 +127,10 @@ text = '' @categorized_defaults.each do |name, opts| text += "\n# #{opts[:description]}\n" text += "#{name.to_s}:\n" opts[:config].each do |opt, v| - text += " #{opt.to_s}: #{v[:value]}".ljust(30) + " # #{v[:description]}\n" + text += " #{opt.to_s}: #{(v[:value].nil?) ? '~' : v[:value]}".ljust(30) + " # #{v[:description]}\n" end end File.open(filepath, 'a') do |f| f.puts text end