Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
* development:
  avoid adding two periods to possible executable filesnames when searching PATH on Windows. Fixes RR3 #350 - Cannot debug ruby file on Windows
  add missing libs necessary to get YAML to work
  • Loading branch information
ashebanow committed Apr 13, 2010
2 parents 750f120 + 6dd2253 commit 9244045
Show file tree
Hide file tree
Showing 277 changed files with 55,745 additions and 13 deletions.
43 changes: 30 additions & 13 deletions plugins/com.aptana.util/src/com/aptana/util/ExecutableUtil.java
Expand Up @@ -26,23 +26,30 @@ public abstract class ExecutableUtil
*/
public static IPath find(String executableName, boolean appendExtension, IPath preferencesPath, List<IPath> searchLocations)
{
if (preferencesPath != null) {
if (isExecutable(preferencesPath)) {
if (preferencesPath != null)
{
if (isExecutable(preferencesPath))
{
return preferencesPath;
}
}

if (Platform.OS_WIN32.equals(Platform.getOS())) {
if (Platform.OS_WIN32.equals(Platform.getOS()))
{
// Grab PATH and search it!
String[] paths = System.getenv("PATH").split(File.pathSeparator); //$NON-NLS-1$
for (String pathString : paths) {
for (String pathString : paths)
{
IPath path = Path.fromOSString(pathString).append(executableName);
IPath result = findExecutable(path, appendExtension);
if (result != null) {
if (result != null)
{
return result;
}
}
} else {
}
else
{
// No explicit path. Try it with "which"
String whichResult = ProcessUtil.outputForCommand("/usr/bin/which", null, executableName); //$NON-NLS-1$
if (whichResult != null && whichResult.trim().length() > 0) {
Expand All @@ -53,31 +60,41 @@ public static IPath find(String executableName, boolean appendExtension, IPath p
}

// Still no path. Let's try some default locations.
for (IPath location : searchLocations) {
for (IPath location : searchLocations)
{
IPath result = findExecutable(location.append(executableName), appendExtension);
if (result != null)
return result;
}
return null;
}

private static IPath findExecutable(IPath basename, boolean appendExtension) {
if (Platform.OS_WIN32.equals(Platform.getOS()) && appendExtension) {
private static IPath findExecutable(IPath basename, boolean appendExtension)
{
if (Platform.OS_WIN32.equals(Platform.getOS()) && appendExtension)
{
String[] extensions = System.getenv("PATHEXT").split(File.pathSeparator); //$NON-NLS-1$
for (String ext : extensions) {
for (String ext : extensions)
{
if (ext.startsWith("."))
ext = ext.substring(1);
IPath pathWithExt = basename.addFileExtension(ext);
if (isExecutable(pathWithExt)) {
if (isExecutable(pathWithExt))
{
return pathWithExt;
}
}

} else if (isExecutable(basename)) {
}
else if (isExecutable(basename))
{
return basename;
}
return null;
}

private static boolean isExecutable(IPath path) {
private static boolean isExecutable(IPath path)
{
File file = path.toFile();
return file.exists() && file.canExecute();
}
Expand Down
50 changes: 50 additions & 0 deletions plugins/org.jruby/lib/ruby/site_ruby/1.8/gauntlet_rubygems.rb
@@ -0,0 +1,50 @@
require 'rubygems'
require 'gauntlet'

##
# GemGauntlet validates all current gems. Currently these packages are
# borked:
#
# Asami-0.04 : No such file or directory - bin/Asami.rb
# ObjectGraph-1.0.1 : No such file or directory - bin/objectgraph
# evil-ruby-0.1.0 : authors must be Array of Strings
# fresh_cookies-1.0.0 : authors must be Array of Strings
# plugems_deploy-0.2.0 : authors must be Array of Strings
# pmsrb-0.2.0 : authors must be Array of Strings
# pqa-1.6 : authors must be Array of Strings
# rant-0.5.7 : authors must be Array of Strings
# rvsh-0.4.5 : No such file or directory - bin/rvsh
# xen-0.1.2.1 : authors must be Array of Strings

class GemGauntlet < Gauntlet
def run(name)
warn name

spec = begin
Gem::Specification.load 'gemspec'
rescue SyntaxError
Gem::Specification.from_yaml File.read('gemspec')
end
spec.validate

self.data[name] = false
self.dirty = true
rescue SystemCallError, Gem::InvalidSpecificationException => e
self.data[name] = e.message
self.dirty = true
end

def should_skip?(name)
self.data[name] == false
end

def report
self.data.sort.reject { |k,v| !v }.each do |k,v|
puts "%-21s: %s" % [k, v]
end
end
end

gauntlet = GemGauntlet.new
gauntlet.run_the_gauntlet ARGV.shift
gauntlet.report
24 changes: 24 additions & 0 deletions plugins/org.jruby/lib/ruby/site_ruby/1.8/gemconfigure.rb
@@ -0,0 +1,24 @@
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

module Gem

# Activate the gems specfied by the gem_pairs list.
#
# gem_pairs ::
# List of gem/version pairs.
# Eg. [['rake', '= 0.8.15'], ['RedCloth', '~> 3.0']]
# options ::
# options[:verbose] => print gems as they are required.
#
def self.configure(gem_pairs, options={})
gem_pairs.each do |name, version|
require 'rubygems'
puts "Activating gem #{name} (version #{version})" if options[:verbose]
gem name, version
end
end
end
24 changes: 24 additions & 0 deletions plugins/org.jruby/lib/ruby/site_ruby/1.8/rbconfig/datadir.rb
@@ -0,0 +1,24 @@
#!/usr/bin/env ruby
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++


module Config

# Only define datadir if it doesn't already exist.
unless Config.respond_to?(:datadir)

# Return the path to the data directory associated with the given
# package name. Normally this is just
# "#{Config::CONFIG['datadir']}/#{package_name}", but may be
# modified by packages like RubyGems to handle versioned data
# directories.
def Config.datadir(package_name)
File.join(CONFIG['datadir'], package_name)
end

end
end

0 comments on commit 9244045

Please sign in to comment.