2012-10-05 00:09:40 -04:00
|
|
|
#!/usr/bin/ruby
|
|
|
|
# Provide git credentials using Boxen's config.
|
|
|
|
|
|
|
|
unless command = ARGV.shift
|
|
|
|
this = File.basename $0
|
|
|
|
abort "Usage: #{this} <get|store|erase>"
|
|
|
|
end
|
|
|
|
|
|
|
|
# We only support get.
|
|
|
|
|
|
|
|
exit 0 unless command == "get"
|
|
|
|
|
|
|
|
# Make sure we're looking for github.com stuff.
|
|
|
|
|
|
|
|
attrs = Hash[$stdin.read.split($/).map { |l| l.split("=") }]
|
|
|
|
exit 1 unless attrs["host"] == "github.com"
|
|
|
|
|
|
|
|
require "pathname"
|
|
|
|
|
|
|
|
# Put us where we belong, in the root dir of our boxen repo.
|
|
|
|
|
|
|
|
Dir.chdir Pathname.new(__FILE__).realpath + "../.."
|
|
|
|
|
2012-12-06 19:02:49 -05:00
|
|
|
# Because we can be called from inside other Ruby processes, unset any
|
|
|
|
# `BUNDLE_` environment variables.
|
|
|
|
|
|
|
|
ENV.keys.select { |k| /^BUNDLE_/i }.each { |k| ENV.delete k }
|
|
|
|
|
2012-10-05 00:09:40 -04:00
|
|
|
# Set up our local configuration, deps, and load path.
|
|
|
|
|
|
|
|
load "config/basic.rb"
|
|
|
|
|
|
|
|
require "boxen/config"
|
|
|
|
|
|
|
|
config = Boxen::Config.load
|
|
|
|
|
|
|
|
puts "username=#{config.login}"
|
|
|
|
puts "password=#{config.password}"
|