forked from pelegb/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33d60c7
commit 2caf39a
Showing
5 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Commit all modified files in commits with one modified file per commit | ||
for FILENAME in $(git ls-files --modified --others) | ||
do | ||
MESSAGE="$(echo "$FILENAME" | sed -e 's|^Library/Homebrew/||' \ | ||
-e 's|^Formula/||' \ | ||
-e 's|^Casks/||' \ | ||
-e 's/\.rb//' \ | ||
-e 's/$/: /')" | ||
git add "$FILENAME" | ||
git commit "$FILENAME" --message="${MESSAGE}${*}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
# Garbage collect all Git repositories under the current directory. | ||
|
||
CURRENT=$PWD | ||
# Set to newline to loop over find output correctly on spaced paths. | ||
IFS=" | ||
" | ||
|
||
echorun() { | ||
echo + "$@" | ||
"$@" | ||
} | ||
|
||
find -L "$CURRENT" -name .git -print0 | while read -d '' -r SCM | ||
do | ||
DIRECTORY="$(dirname "$SCM")" | ||
cd "$DIRECTORY" || continue | ||
echo "== Garbage collecting $(basename "$DIRECTORY")" | ||
if [ -d .git ] | ||
then | ||
echorun git gc --aggressive | ||
fi | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "pathname" | ||
require "fileutils" | ||
|
||
@rbenv_versions = Pathname("#{ENV["HOME"]}/.rbenv/versions") | ||
homebrew_ruby_versions = Pathname.glob("/usr/local/Cellar/ruby") | ||
homebrew_ruby_versions += Pathname.glob("/usr/local/Cellar/ruby@*") | ||
|
||
def link_rbenv_version_without_revision(version) | ||
basename_without_revision = version.basename | ||
.to_s | ||
.gsub(/_\d+$/, "") | ||
FileUtils.ln_sf version, @rbenv_versions / basename_without_revision | ||
end | ||
|
||
def gem_like_version(version) | ||
Gem::Version.new(version.basename | ||
.to_s | ||
.tr("_", ".")) | ||
end | ||
|
||
@rbenv_versions.mkpath | ||
|
||
homebrew_ruby_versions.flat_map(&:children) | ||
.sort_by(&method(:gem_like_version)) | ||
.each(&method(:link_rbenv_version_without_revision)) | ||
|
||
@rbenv_versions.children | ||
.select(&:symlink?) | ||
.reject(&:exist?) | ||
.each { |path| FileUtils.rm_f path } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
# Update all Git and Subversion repositories under the current directory. | ||
|
||
CURRENT=$PWD | ||
# Set to newline to loop over find output correctly on spaced paths. | ||
IFS=" | ||
" | ||
|
||
echorun() { | ||
echo + "$@" | ||
"$@" | ||
} | ||
|
||
find -L "$CURRENT" \( -name .git -or -name .svn \) -print0 | while read -d '' -r SCM | ||
do | ||
DIRECTORY="$(dirname "$SCM")" | ||
cd "$DIRECTORY" || continue | ||
if [ -d ../.svn ] || echo "$DIRECTORY" | grep -q "vendor/ruby" | ||
then | ||
continue | ||
fi | ||
echo "== Updating $(basename "$DIRECTORY")" | ||
if [ -d .git/svn ] | ||
then | ||
echorun git svn fetch | ||
echorun git svn rebase | ||
elif [ -d .git ] | ||
then | ||
echorun git fetch --all | ||
if [ -n "$(git remote -v)" ]; then | ||
echorun git checkout --quiet master | ||
echorun git merge --no-edit --ff-only origin/master | ||
git branch --merged | grep -v '\*' | xargs -n 1 git branch -d | ||
fi | ||
elif [ -d .svn ] | ||
then | ||
echorun svn update | ||
fi | ||
echo | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters