Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created October 18, 2008 16:36
Show Gist options
  • Save practicingruby/17695 to your computer and use it in GitHub Desktop.
Save practicingruby/17695 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "pathname"
WORKING_DIR = Pathname.new(".").realpath
LOADER = %Q{
require "pathname"
Pathname.glob("#{WORKING_DIR}/vendor/**/**") do |dir|
lib = dir + "lib"
$LOAD_PATH.push(lib.directory? ? lib : dir)
end
}
if ARGV[0] == "init"
lib = Pathname.new(ARGV[1])
lib.mkpath
(lib + 'dependencies.rb').open("w") do |file|
file.write LOADER
end
else
vendor = Pathname.new("vendor")
vendor.mkpath
Dir.chdir(vendor.realpath)
system("git clone git://github.com/#{ARGV[0]}.git #{ARGV[0]}")
if ARGV[1]
Dir.chdir(ARGV[0])
system("git checkout #{ARGV[1]}")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment