bin/gemsync in gemsync-0.1.5 vs bin/gemsync in gemsync-0.1.6

- old
+ new

@@ -6,11 +6,11 @@ require 'trollop' # Setup arguments from the command line. # This uses the trollop library on github. opts = Trollop::options do - version "gemsync 0.1.5 (c) 2010 Josh Ellithorpe" + version "gemsync 0.1.6 (c) 2010 Josh Ellithorpe" banner <<-EOS Small gem to sync multiple gem installations. Usage: gemsync [options] @@ -130,11 +130,16 @@ current_gem_versions = current_gem_details.match(/(.*) \((.*)\)/)[2].split(", ") end for version in (gem_versions.split(", ") - current_gem_versions) if gem_name == "mysql" # Also look for mysql5 type binaries that some package managers use - mysql_config = `which mysql_config` || `which mysql_config5` - mysql_dir = `which mysql` || `which mysql5` + # The array below is a list of mysql suffixes + mysql_config = '' + mysql_dir = '' + ['', '5'].each do |v| + mysql_config = `which mysql_config#{v}` if mysql_config == '' + mysql_dir = `which mysql#{v}` if mysql_dir == '' + end mysql_dir = mysql_dir.split('/')[0..-3].join('/') system("#{@sudostring}#{@sync_dir}/bin/gem install #{gem_name} -v #{version} -- --with-mysql-dir=#{mysql_dir} --with-mysql-config=#{mysql_config} #{@docstring}") else system("#{@sudostring}#{@sync_dir}/bin/gem install #{gem_name} -v #{version} #{@docstring}") end