-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-world
executable file
·41 lines (35 loc) · 987 Bytes
/
git-world
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env ruby
require 'open3'
include Open3
# TODO: use colors in output
def gitworld(command)
home = ENV["PWD"]
paths = [ \
"vendor/bundles/Cordova/Bundle/FormModelBundle", \
"vendor/phpspec", \
"vendor/phpspec-symfony2", \
"vendor/PHPAutotest", \
]
paths.each do |path|
fullpath = "#{home}/#{path}"
if File.directory? fullpath
Dir.chdir("#{fullpath}")
popen3("git #{command}") do |stdin, stdout, stderr, wait_thr|
output = stdout.read
error = stderr.read
printf "============================[ %30s ]=======\n%s", path, output
puts "" if output.length > 0
print stderr.read
puts "" if error.length > 0
end
end
end
end
if ARGV[0].nil?
command = "git"
else
command = ARGV
end
puts "Running `git #{command}` on all repositories..."
gitworld command
# vim: set ft=ruby