#! /usr/bin/env ruby require ENV['TM_SUPPORT_PATH'] + '/lib/ui' require ENV['TM_BUNDLE_SUPPORT'] + '/lib/configuration.rb' config = Configuration.new(nil) conf_file = File.join(ENV['TM_BUNDLE_SUPPORT'], "/lib/p4.conf") if File.exists?(conf_file) File.open(conf_file) do |f| begin config = Marshal.load(f) rescue EOFError config.config_hash = nil end end end p config.config_hash output = [] if config.config_hash p config.config_hash plist = Hash.new plist['p4user'] = config.config_hash['p4user'].to_s plist['p4client'] = config.config_hash['p4client'].to_s plist['p4port'] = config.config_hash['p4port'].to_s plist['p4pass'] = config.config_hash['p4pass'].to_s p plist TextMate::UI.dialog(:nib => ENV['TM_BUNDLE_SUPPORT'] + '/nibs/conn.nib', :parameters => plist, :center => true) { |window| output = window.wait_for_input } else TextMate::UI.dialog(:nib => ENV['TM_BUNDLE_SUPPORT'] + '/nibs/conn.nib', :parameters => { }, :center => true) { |window| output = window.wait_for_input } end config.config_hash = {'p4user' => output['p4user'] , 'p4client' => output['p4client'], 'p4port' => output['p4port'], 'p4pass' => output['p4pass']} File.open(conf_file, "w+") do |f| Marshal.dump(config, f) end