Add rvm sources directory if available.

This commit is contained in:
Adam Sanderson 2011-01-01 13:20:47 -07:00
parent 84d60ae661
commit 237ff7df55
2 changed files with 18 additions and 1 deletions

View File

@ -14,9 +14,16 @@ module Qwandry
builders[name] << block
end
# Registers a configuration is a specific binary is available. If `binary` is not specified,
# it is assumed to be the same as the configuration name.
def register_if_present name, binary=nil, &block
binary ||= name
register(name, &block) if system("which #{binary}")
register(name, &block) if present? binary
end
# Returns true if binary `name` is present.
def present? name
system("which #{name}", STDOUT=>"/dev/null")
end
# Sets the default configuration to launch, if no `configurations` are passed

View File

@ -52,6 +52,16 @@ register_if_present :node do
add node_paths
end
# If we can figure out where the user's ruby source directory is, add it.
register_if_present :ruby_src, :rvm do
# If present, use the current rvm's ruby source, this will probably be MRI
# though you never know. We could later try to be smarter about jruby, etc.
path = File.join(ENV['rvm_src_path'], ENV['rvm_ruby_string'])
# Add the sources, use a LibraryRepository to bundle .h and .c files
add path, :reject=>/\.(o|a|dylib)$/, :class=>Qwandry::LibraryRepository
end
# Qwandry is a ruby app after all, so activate ruby and gem by default. Other defaults can be set
# with a custom init.rb
default :ruby, :gem