Commit 28d13c35c9f361c633e4dd0bf45b92db0b867cad
1 parent
765f58f412
Add script/boxen-git-credential
boxen/puppet-git will need to be taught about this file.
Showing 1 changed file with 33 additions and 0 deletions Inline Diff
script/boxen-git-credential
| File was created | 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. |