BashRC: Separated development/ruby helpers and added Cocoapods helpers, added more Git shortcuts.

Signed-off-by: Hermann Mayer's avatarHermann Mayer <hermann.mayer92@gmail.com>
parent 75ca083a
......@@ -24,6 +24,7 @@ bashrcComponent['helper/development/docker']=1
bashrcComponent['helper/development/aws']=1
bashrcComponent['helper/development/git']=1
bashrcComponent['helper/development/svn']=0
bashrcComponent['helper/development/ruby']=1
bashrcComponent['helper/archives']=1
bashrcComponent['helper/features']=1
bashrcComponent['helper/distro/slackware']=0
......
......@@ -52,6 +52,8 @@
l = log
d = diff
weg = push -u
ab = "!sh -c 'git a; git ci -am \"one of many\"; git weg'"
steil = "!sh -c 'git a; git ci -am \"one of many [ci skip]\"; git weg'"
[merge]
tool = meld
......
......@@ -26,44 +26,3 @@ function generateMAC()
echo $(dd bs=1 count=6 if=/dev/random 2>/dev/null \
| hexdump -v -e '/1 "-%02X"' | sed 's/^-//g')
}
function gemlock()
{
grep -P "^\s*${@} \(\d" Gemfile.lock \
| cut -d '(' -f2 \
| grep -oP '[^)]+'
}
function gemdesc()
{
curl -s "https://rubygems.org/gems/${@}" \
| pup -p '.gem__intro p text{}' \
| tr "\n" ' ' \
| sed 's/ */ /g' \
| fold -s -w78 - \
| sed 's/^/# /g' \
| sed 's/[ \t]*$//'
echo
}
function gemspec()
{
curl -s "https://rubygems.org/gems/${@}" \
| pup -p '#gemfile_text attr{value}'
}
function gemline()
{
SPEC="gem '${1}', '~> ${2}'"
if [ -z "${2}" ]; then
SPEC="$(gemspec ${@})"
fi
gemdesc ${1}
echo ${SPEC}
}
function gemlockline()
{
gemline "${@}" $(gemlock "${@}")
}
#!/bin/bash
#
# @author Hermann Mayer <hermann.mayer92@gmail.com>
# @name development.sh
# +-------------------------------------------------
# | Development/Ruby Helper
# +-------------------------------------------------
function gemlock()
{
grep -P "^\s*${@} \(\d" Gemfile.lock \
| cut -d '(' -f2 \
| grep -oP '[^)]+'
}
function gemdesc()
{
curl -s "https://rubygems.org/gems/${@}" \
| pup -p '.gem__intro p text{}' \
| tr "\n" ' ' \
| sed 's/ */ /g' \
| fold -s -w78 - \
| sed 's/^/# /g' \
| sed 's/[ \t]*$//'
echo
}
function gemspec()
{
curl -s "https://rubygems.org/gems/${@}" \
| pup -p '#gemfile_text attr{value}'
}
function gemline()
{
SPEC="gem '${1}', '~> ${2}'"
if [ -z "${2}" ]; then
SPEC="$(gemspec ${@})"
fi
gemdesc ${1}
echo ${SPEC}
}
function gemlockline()
{
gemline "${@}" $(gemlock "${@}")
}
function podlock()
{
(
grep -F " ${@}" Podfile.lock;
grep -F "\"${@}" Podfile.lock;
) \
| grep -P "\(\d" \
| cut -d '(' -f2 \
| grep -oP '[^):"]+'
}
function poddesc()
{
SPEC_URL=$(curl -s "https://cocoapods.org/pods/${@}" \
| pup -p '.links a:contains("See Podspec") attr{href}')
RAW_URL=$(curl -s "${SPEC_URL}" \
| pup -p '#raw-url attr{href}' \
| sed 's/^/https:\/\/github.com/g')
curl -sL "${RAW_URL}" \
| jq -r '.description // .summary' \
| tr "\n" ' ' \
| sed 's/ */ /g' \
| fold -s -w78 - \
| sed 's/^/# /g' \
| sed 's/[ \t]*$//'
echo
}
function podspec()
{
curl -s "https://cocoapods.org/pods/${@}" \
| pup -p '#installation_guide pre:nth-of-type(1) code text{}' \
| grep -oP 'pod .*'
}
function podline()
{
SPEC="pod '${1}', '~> ${2}'"
if [ -z "${2}" ]; then
SPEC="$(podspec ${@})"
fi
poddesc ${1}
echo ${SPEC}
}
function podlockline()
{
podline "${@}" $(podlock "${@}")
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment