-
Notifications
You must be signed in to change notification settings - Fork 0
/
brew_scripts
44 lines (28 loc) · 4.26 KB
/
brew_scripts
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
41
42
43
44
# Taken from http://gist.github.com/ilovezfs
prs(){(brew ruby -e "formula=Formula[\"$1\"] ; GitHub.issues_for_formula(formula.name, :tap => formula.tap).each { |i| puts i[\"$2\"] }")}
prurls(){(prs "$1" "html_url")}
prtitles(){(prs "$1" "title")}
bfpr_old(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!" && return; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --url="$(brew ruby -e "puts Formula[\""$F"\"].stable.url"|sed -e s/$R/g)" $F)}
bfprd_old(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!" && return; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --url="$(brew ruby -e "puts Formula[\""$F"\"].stable.url"|sed -e s/$R/g)" --dry-run $F)}
bfprd_write_old(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!"; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --url="$(brew ruby -e "puts Formula[\""$F"\"].stable.url"|sed -e s/$R/g)" --dry-run --write $F)}
formula_and_replacement_to_url(){
stable_url="$(brew ruby -e "puts Formula[\""$1"\"].stable.url")"
repl="$2";
before="$(echo "$repl"|awk -F '/' '{print $1}')"
after="$(echo "$repl"|awk -F '/' '{print $2}')"
after="$(brew ruby -e "puts (\""$stable_url"\".include? \""$before"\") ? \""$after"\" : Version.detect(\""$after"\", {})")"
new="$(echo "$stable_url"|sed -e s/$before/$after/g)"
echo "$new"
}
# override duplicate and audit instead of audit strict
bfprfff(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!"; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --audit --url="$(formula_and_replacement_to_url "$F" "$R")" $F)}
# override duplicate
bfprf(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!"; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --strict --url="$(formula_and_replacement_to_url "$F" "$R")" $F)}
bfprdf(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!"; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --strict --url="$(formula_and_replacement_to_url "$F" "$R")" --dry-run $F)}
# audit instead of audit strict
bfprff(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!" && return; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --audit --url="$(formula_and_replacement_to_url "$F" "$R")" $F)}
bfpr(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!" && return; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --strict --url="$(formula_and_replacement_to_url "$F" "$R")" $F)}
bfprd(){(prtitles $1 | grep -i $1; [[ $? -eq 0 ]] && echo "$1: possible duplicate!" && return; blc=$(brew livecheck $1|awk -F ':' '{print $2}'|awk '{print $1" "$NF}'); export F=$1 R=$(echo $blc|awk '{print $1}')/$(echo $blc|awk '{print $NF}'); brew bump-formula-pr --strict --url="$(formula_and_replacement_to_url "$F" "$R")" --dry-run $F)}
pb(){(urls="$(prurls "$1")" ; [[ $(echo "$urls" | wc -l) -eq 1 ]] && brew pull --bottle $urls)}
livecheck_to_core_list(){(grep '==>' $1|sed -e 's/(guessed) //'|awk '{print $1" "$3" "$5}'|awk '($2 != $3) {print}'|grep -v php|awk '{print $1}'|sed -e "s/\(.*\)/\1.rb/"|xargs -n1 -I % stat $(brew --repo homebrew/core)/Formula/"%" 2>/dev/null|awk -F '/' '{print $NF}'|xargs -n1 basename -s .rb)}
new(){(f=$(ls -tr|grep -v txt|tail -2|tr '\n' ' '); A=$(echo $f|awk '{print $1}'); B=$(echo $f|awk '{print $2}'); diff $A $B|grep '>')}