Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add binstubs #147

Merged
merged 1 commit into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
irb -I ./lib -r 'bundler' -r 'rubygems' -r 'db_lock'
31 changes: 31 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash -le

name="db_lock"

git fetch origin
current=`bin/version`
sha=`git rev-parse HEAD`

read -p "Which version? (${current}) " version
version=${version:=$current}

VERSION=$version gem build ${name}.gemspec

echo "Creating GitHub release"
link=`gh release create v${version} --target $sha --generate-notes`
echo $link

file="${name}-${version}.gem"
read -p "Push to rubygems? (y/n) " yn
case $yn in
y ) echo Pushing to rubygems ...;;
n ) echo Aborting.;
exit;;
* ) echo invalid response;
exit 1;;
esac

gem push $file
rm $file

open $link
16 changes: 16 additions & 0 deletions bin/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash -le

branch=`git rev-parse --abbrev-ref HEAD`
version=`git describe --tags --match "v*" | sed -e "s/^v//"`
ref=`git rev-parse --short HEAD`

# 0.0.0-i-sha or 0.0-i-sha
if [[ "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)-([a-z0-9]+) ]]; then
minor=$((${BASH_REMATCH[3]}+1))
version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${minor}.${branch}.${BASH_REMATCH[4]}.$ref"
elif [[ "$version" =~ ^([0-9]+)\.([0-9]+)-([0-9]+)-([a-z0-9]+) ]]; then
minor=1
version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${minor}.${branch}.${BASH_REMATCH[3]}.$ref"
fi

echo $version