Sha256: cc07d4d143d6d9da6b4c84e97236d1e8eb61d0b6356abfde549c94fa14f04594
Contents?: true
Size: 735 Bytes
Versions: 27
Compression:
Stored size: 735 Bytes
Contents
require 'yaml' def saveConfig(action, type, data) # Load the yaml file config_file = File.join(ENV['HOME'], ".negroku") config = getConfig # If I need to add some multiple values if action === :add newData = config[type] || [] newData.push(data) newData.uniq! config = config.merge({ type => newData }) elsif action === :remove #.. elsif action === :replace #.. end File.open(config_file, 'w') do |f| f.write config.to_yaml end end def getConfig # load config from file config_file = File.join(ENV['HOME'], ".negroku") # create an empty .negroku file unless File.exist?(config_file) %x(touch #{config_file}) end # base config YAML.load_file(config_file) || {} end
Version data entries
27 entries across 27 versions & 1 rubygems