mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
devscript: line-terminations, continuations
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
# develop_brew_cask
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
cd_to_project_root () {
|
||||
local script_dir="$(/usr/bin/dirname $0)"
|
||||
@@ -13,7 +13,7 @@ cd_to_project_root () {
|
||||
local git_root="$(git rev-parse --show-toplevel)"
|
||||
if [[ -z "$git_root" ]]; then
|
||||
printf "Could not find git project root"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
cd "$git_root"
|
||||
}
|
||||
@@ -22,8 +22,8 @@ cd_to_version_dir () {
|
||||
local cellar_dir="$1"
|
||||
local version_dir="$2"
|
||||
if [[ -z "$version_dir" ]]; then
|
||||
printf "Can't get version dir under $cellar_dir/\n";
|
||||
exit 1;
|
||||
printf "Can't get version dir under $cellar_dir/\n"
|
||||
exit 1
|
||||
fi
|
||||
cd "$cellar_dir/$version_dir"
|
||||
}
|
||||
@@ -48,7 +48,7 @@ _develop_brew_cask () {
|
||||
local tap_subdir="Library/Taps/phinze-cask"
|
||||
|
||||
# initialization
|
||||
cd_to_project_root;
|
||||
cd_to_project_root
|
||||
local git_root="$(pwd)"
|
||||
local brew_prefix="$(brew --prefix)"
|
||||
local cellar_dir="$brew_prefix/Cellar/brew-cask"
|
||||
@@ -57,17 +57,17 @@ _develop_brew_cask () {
|
||||
|
||||
# sanity check
|
||||
if [[ "$(/usr/bin/stat -L -f '%i' "$tap_dir")" -eq "$(/usr/bin/stat -L -f '%i' "$git_root")" ]]; then
|
||||
printf "\nERROR: run this script in your private repo, not inside Homebrew.\n";
|
||||
exit 1;
|
||||
printf "\nERROR: run this script in your private repo, not inside Homebrew.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# action
|
||||
cd_to_version_dir "$cellar_dir" "$version_dir";
|
||||
cd_to_version_dir "$cellar_dir" "$version_dir"
|
||||
if [[ -e "production_rubylib" ]]; then
|
||||
printf "brew-cask is already set up for development\n";
|
||||
printf "brew-cask is already set up for development\n"
|
||||
exit 1
|
||||
else
|
||||
create_dev_links "$git_root" "$tap_dir";
|
||||
create_dev_links "$git_root" "$tap_dir"
|
||||
printf "brew-cask is now in development mode\n"
|
||||
printf "Note: it is not safe to run 'brew update' while in development mode\n"
|
||||
fi
|
||||
@@ -92,6 +92,6 @@ mode is in effect.
|
||||
exit
|
||||
fi
|
||||
|
||||
_develop_brew_cask "$@";
|
||||
_develop_brew_cask "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
# get_release_tag
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
opt_next='';
|
||||
opt_latest='';
|
||||
opt_verbose='';
|
||||
opt_next=''
|
||||
opt_latest=''
|
||||
opt_verbose=''
|
||||
|
||||
die () {
|
||||
local message="$@";
|
||||
local message="$@"
|
||||
if ! [[ $message =~ "\n"$ ]]; then
|
||||
message="${message}\n"
|
||||
fi
|
||||
@@ -71,7 +71,7 @@ generate_next_major_tag () {
|
||||
|
||||
generate_next_minor_tag () {
|
||||
local -a version_elts
|
||||
IFS='.' read -a version_elts <<< "$1";
|
||||
IFS='.' read -a version_elts <<< "$1"
|
||||
sanity_check_parsed_version "${version_elts[@]}"
|
||||
(( version_elts[1] += 1 )) # increment minor field
|
||||
version_elts[2]='0' # reset patch field
|
||||
@@ -123,12 +123,12 @@ See RELEASING.md for more information.
|
||||
fi
|
||||
elif [[ $arg =~ ^-+patch$ ]]; then
|
||||
if [[ "$opt_next" == 'major' ]]; then
|
||||
die "Error: -patch is incompatible with -major";
|
||||
die "Error: -patch is incompatible with -major"
|
||||
fi
|
||||
opt_next='patch'
|
||||
elif [[ $arg =~ ^-+major$ ]]; then
|
||||
if [[ "$opt_next" == 'patch' ]]; then
|
||||
die "Error: -patch is incompatible with -major";
|
||||
die "Error: -patch is incompatible with -major"
|
||||
fi
|
||||
opt_next='major'
|
||||
elif [[ $arg =~ ^-+latest$ ]]; then
|
||||
@@ -143,7 +143,7 @@ See RELEASING.md for more information.
|
||||
}
|
||||
|
||||
_get_release_tag () {
|
||||
cd_to_project_root;
|
||||
cd_to_project_root
|
||||
local latest_tag="$(git describe --tags --abbrev=0 2>/dev/null)"
|
||||
if [[ -z "$latest_tag" ]]; then
|
||||
die "Error: no recent tag found"
|
||||
@@ -163,8 +163,8 @@ _get_release_tag () {
|
||||
fi
|
||||
}
|
||||
|
||||
process_args "$@";
|
||||
process_args "$@"
|
||||
|
||||
_get_release_tag;
|
||||
_get_release_tag
|
||||
|
||||
#
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# list_apps_in_pkg
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
_list_apps_in_pkg () {
|
||||
|
||||
@@ -22,7 +22,7 @@ _list_apps_in_pkg () {
|
||||
# source 2
|
||||
/usr/bin/find "$tmpdir" -name PackageInfo -print0 | \
|
||||
/usr/bin/xargs -0 /usr/bin/perl -0777 -ne \
|
||||
'while (m{<pkg-info[^\n]*install-location="/".*?path\s*=\s*"./Applications/([^"]+)"}sg) { my $p = $1; $p =~ s{\A.*/}{}; print "$p\n" }';
|
||||
'while (m{<pkg-info[^\n]*install-location="/".*?path\s*=\s*"./Applications/([^"]+)"}sg) { my $p = $1; $p =~ s{\A.*/}{}; print "$p\n" }'; \
|
||||
# source 3
|
||||
/usr/bin/find "$tmpdir" -type d -name '*.app' | \
|
||||
perl -pe 's{\A.*/}{}'; \
|
||||
@@ -59,6 +59,6 @@ See CONTRIBUTING.md and 'man pkgutil' for more information.
|
||||
exit
|
||||
fi
|
||||
|
||||
_list_apps_in_pkg "$@";
|
||||
_list_apps_in_pkg "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# list_ids_in_pkg
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
_list_ids_in_pkg () {
|
||||
|
||||
@@ -55,6 +55,6 @@ See CONTRIBUTING.md and 'man pkgutil' for more information.
|
||||
exit
|
||||
fi
|
||||
|
||||
_list_ids_in_pkg "$@";
|
||||
_list_ids_in_pkg "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -3,12 +3,15 @@
|
||||
# list_loaded_kext_ids
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
_list_loaded_kext_ids () {
|
||||
/usr/sbin/kextstat -kl | /usr/bin/cut -c53- | /usr/bin/cut -f1 -d' ' | /usr/bin/egrep -v '^com\.apple\.'
|
||||
/usr/sbin/kextstat -kl | \
|
||||
/usr/bin/cut -c53- | \
|
||||
/usr/bin/cut -f1 -d' ' | \
|
||||
/usr/bin/egrep -v '^com\.apple\.'
|
||||
}
|
||||
|
||||
if [[ $1 =~ ^-+h(elp)?$ ]]; then
|
||||
@@ -27,6 +30,6 @@ See CONTRIBUTING.md for more information.
|
||||
exit
|
||||
fi
|
||||
|
||||
_list_loaded_kext_ids "$@";
|
||||
_list_loaded_kext_ids "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# list_recent_pkg_ids
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
_list_recent_pkg_ids () {
|
||||
/bin/ls -t /var/db/receipts | \
|
||||
@@ -31,6 +31,6 @@ See CONTRIBUTING.md for more information.
|
||||
exit
|
||||
fi
|
||||
|
||||
_list_recent_pkg_ids "$@";
|
||||
_list_recent_pkg_ids "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
# production_brew_cask
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
cd_to_project_root () {
|
||||
local script_dir="$(/usr/bin/dirname $0)"
|
||||
@@ -13,7 +13,7 @@ cd_to_project_root () {
|
||||
local git_root="$(git rev-parse --show-toplevel)"
|
||||
if [[ -z "$git_root" ]]; then
|
||||
printf "Could not find git project root"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
cd "$git_root"
|
||||
}
|
||||
@@ -22,8 +22,8 @@ cd_to_version_dir () {
|
||||
local cellar_dir="$1"
|
||||
local version_dir="$2"
|
||||
if [[ -z "$version_dir" ]]; then
|
||||
printf "Can't get version dir under $cellar_dir/\n";
|
||||
exit 1;
|
||||
printf "Can't get version dir under $cellar_dir/\n"
|
||||
exit 1
|
||||
fi
|
||||
cd "$cellar_dir/$version_dir"
|
||||
}
|
||||
@@ -45,7 +45,7 @@ _production_brew_cask () {
|
||||
local tap_subdir="Library/Taps/phinze-cask"
|
||||
|
||||
# initialization
|
||||
cd_to_project_root;
|
||||
cd_to_project_root
|
||||
local git_root="$(pwd)"
|
||||
local brew_prefix="$(brew --prefix)"
|
||||
local cellar_dir="$brew_prefix/Cellar/brew-cask"
|
||||
@@ -55,13 +55,13 @@ _production_brew_cask () {
|
||||
# sanity check
|
||||
if [[ "$(/usr/bin/stat -L -f '%i' "$tap_dir")" -eq "$(/usr/bin/stat -L -f '%i' "$git_root")" ]]; then
|
||||
printf "\nERROR: run this script in your private repo, not inside Homebrew.\n"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# action
|
||||
cd_to_version_dir "$cellar_dir" "$version_dir";
|
||||
cd_to_version_dir "$cellar_dir" "$version_dir"
|
||||
if [[ -e "production_rubylib" ]]; then
|
||||
remove_dev_links "$tap_dir";
|
||||
remove_dev_links "$tap_dir"
|
||||
printf "brew-cask is now in production mode\n"
|
||||
printf "It is safe to run 'brew update'\n"
|
||||
else
|
||||
@@ -84,6 +84,6 @@ After running this command it is safe to run 'brew update'.
|
||||
exit
|
||||
fi
|
||||
|
||||
_production_brew_cask "$@";
|
||||
_production_brew_cask "$@"
|
||||
|
||||
#
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
# stats on project/release from git database
|
||||
#
|
||||
|
||||
set -e; # exit on any uncaught error
|
||||
set +o histexpand; # don't expand history expressions
|
||||
shopt -s nocasematch; # case-insensitive regular expressions
|
||||
set -e # exit on any uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
cd_to_project_root () {
|
||||
local script_dir="$(/usr/bin/dirname $0)"
|
||||
@@ -15,7 +15,7 @@ cd_to_project_root () {
|
||||
local git_root="$(git rev-parse --show-toplevel)"
|
||||
if [[ -z "$git_root" ]]; then
|
||||
printf "Could not find git project root"
|
||||
exit 1;
|
||||
exit 1
|
||||
fi
|
||||
cd "$git_root"
|
||||
}
|
||||
@@ -49,15 +49,15 @@ _homebrew_cask_project_stats () {
|
||||
local code_paths="bin developer lib test brew-cask.rb Rakefile Gemfile Gemfile.lock"
|
||||
local doc_paths="LICENSE *.md"
|
||||
|
||||
cd_to_project_root;
|
||||
warn_if_off_branch 'master';
|
||||
cd_to_project_root
|
||||
warn_if_off_branch 'master'
|
||||
|
||||
if [[ "$1" = 'release' ]]; then
|
||||
start_object="$(git describe --tags --abbrev=0)"
|
||||
elif [[ -n "$1" ]]; then
|
||||
start_object="$1"
|
||||
fi
|
||||
verify_git_object "$start_object";
|
||||
verify_git_object "$start_object"
|
||||
|
||||
printf "Unique contributors"
|
||||
if [[ "$start_object" != "$initial_commit" ]]; then
|
||||
@@ -119,6 +119,6 @@ Without argument, show statistics since first commit.
|
||||
exit
|
||||
fi
|
||||
|
||||
_homebrew_cask_project_stats "$@";
|
||||
_homebrew_cask_project_stats "$@"
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user