Skip to content

Commit

Permalink
Add binstube (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkon authored May 26, 2022
1 parent 35af140 commit 885cd05
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
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 'invalid_model/serializer'
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="invalid_model-serializer"

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

0 comments on commit 885cd05

Please sign in to comment.