require 'odbc_connection_finder' include OdbcConnectionFinder def mkdir( path ) Dir.mkdir path unless File.exists? path end def clean_odbc_names( odbc_names ) default = ["change_me_to_odbc_name"] return default if odbc_names.empty? print "\nDo you want to import ALL of your pre-configures odbc connections for testing? " print "\n\n" print odbc_names.join( ', ' ) print "\n\ny/n " if( gets.rstrip.downcase.eql? 'y' ) return odbc_names end print "\nDo you want to import ANY of your pre-configures odbc connections for testing? " print "\n\n" print odbc_names.join( ', ' ) print "\n\ny/n " if( !gets.rstrip.downcase.eql? 'y' ) return default end #clean result = [] odbc_names.each do |name| print "Import #{name}? y/n " if( gets.rstrip.downcase.eql? 'y' ) result << name end end if( !result.empty? ) return result else return default end end # # Allow the user to decide if they want to create dirs for ALL odbc connections, if not let them choose. # # print "Please enter the dir of your project root: " project_root = gets.rstrip marj_dir = "#{project_root}/marjoree_tests" test_dir = "#{marj_dir}/tests" odbc_config_dir = "#{marj_dir}/odbc_config" fixtures_dir = "#{marj_dir}/fixtures" mkdir marj_dir mkdir test_dir mkdir odbc_config_dir mkdir fixtures_dir all_odbc_names = get_odbc_names desired_odbc_names = clean_odbc_names( all_odbc_names ) desired_odbc_names.each do |odbc_name| mkdir "#{fixtures_dir}/#{odbc_name}" end file = File.new( "#{odbc_config_dir}/connections.yml", "w+" ) file << create_yml_for( desired_odbc_names ) file.close #create odbc_config dir #create connections.yml #create fixtures dir # using the odbc_name create fixtures dirs