Commit 5eb3df2a9fbcf927fd5fd2e04b58a912774f488b
Merge remote-tracking branch 'origin/credential-cache' into enable_puppet
Showing 1 changed file Side-by-side Diff
script/boxen-git-credential
1 | +#!/usr/bin/ruby | |
2 | +# Provide git credentials using Boxen's config. | |
3 | + | |
4 | +unless command = ARGV.shift | |
5 | + this = File.basename $0 | |
6 | + abort "Usage: #{this} <get|store|erase>" | |
7 | +end | |
8 | + | |
9 | +# We only support get. | |
10 | + | |
11 | +exit 0 unless command == "get" | |
12 | + | |
13 | +# Make sure we're looking for github.com stuff. | |
14 | + | |
15 | +attrs = Hash[$stdin.read.split($/).map { |l| l.split("=") }] | |
16 | +exit 1 unless attrs["host"] == "github.com" | |
17 | + | |
18 | +require "pathname" | |
19 | + | |
20 | +# Put us where we belong, in the root dir of our boxen repo. | |
21 | + | |
22 | +Dir.chdir Pathname.new(__FILE__).realpath + "../.." | |
23 | + | |
24 | +# Set up our local configuration, deps, and load path. | |
25 | + | |
26 | +load "config/basic.rb" | |
27 | + | |
28 | +require "boxen/config" | |
29 | + | |
30 | +config = Boxen::Config.load | |
31 | + | |
32 | +puts "username=#{config.login}" | |
33 | +puts "password=#{config.password}" |