Skip to content

Commit

Permalink
New features: badge generator, jemalloc-check, yaml tools (#137)
Browse files Browse the repository at this point in the history
* Adding installation workflow

* Adding `bashmatic is-installed` directive

* Adding the Install CI badge

* Adding insgall to CI

* Adding bin/badge + yaml utilities

* Remove return

* Bump version 3.2.0

* Updating auto-generated files
  • Loading branch information
kigster authored Mar 24, 2023
1 parent 80e848f commit 8fc74f4
Show file tree
Hide file tree
Showing 16 changed files with 572 additions and 22 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Install
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule: # run once a day to make sure
- cron: "30 17 * * *"

jobs:
install:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: install using curl
run: |
rm -rf ~/.bashmatic
bash -c "$(curl -fsSL https://bashmatic.re1.re); bashmatic-install -q"
- name: verify bashmatic is there
run: |
bash -c "[[ -d ~/.bashmatic && -f ~/.bashmatic/init.sh ]]"
- name: install bashmatic into an alternative location with a given tag
run: |
mkdir -p ~/workspace
rm -rfv ~/workspace/bashmatic
bash -c "$(curl -fsSL https://bashmatic.re1.re); \
bashmatic-install -p -d -q -f -b v3.1.2 -H ~/workspace/bashmatic"
- name: finally source bashmatic init.sh on CI
run: |
set +ex
source ~/.bashmatic/init.sh
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.5
3.2.0
Empty file added README.ad
Empty file.
3 changes: 2 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[separator=—]
= Bashmatic® — BASH-based DSL helpers for humans, sysadmins, and fun.
// vim: ft=asciidoc
:author: Version v3.1.5
:author: Version v3.2.0
:doctype: book
:source-highlighter: rouge
:rouge-style: base16.monokai
Expand All @@ -20,6 +20,7 @@
| | Badges | FOSSA Scanning
| FOSSSA | image:https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkigster%2Fbashmatic.svg?type=shield[License Status,link=https://app.fossa.com/projects/git%2Bgithub.com%2Fkigster%2Fbashmatic?ref=badge_shield] .7+<.>| image:https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkigster%2Fbashmatic.svg?type=large[FOSSA License Scan,link=https://app.fossa.com/projects/git%2Bgithub.com%2Fkigster%2Fbashmatic?ref=badge_large]
| CI Tests | image:https://github.com/kigster/bashmatic/actions/workflows/tests.yml/badge.svg[Test,link=https://github.com/kigster/bashmatic/actions/workflows/tests.yml]
| CI Install | image:https://github.com/kigster/bashmatic/actions/workflows/install.yml/badge.svg[Install,link=https://github.com/kigster/bashmatic/actions/workflows/install.yml]
| ShellCheck | image:https://github.com/kigster/bashmatic/actions/workflows/lint.yml/badge.svg[Lint,link=https://github.com/kigster/bashmatic/actions/workflows/lint.yml]
| Gitter | image:https://badges.gitter.im/kigster/bashmatic.svg[link="https://gitter.im/kigster/bashmatic?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
|==========================
Expand Down
Binary file modified README.pdf
Binary file not shown.
1 change: 0 additions & 1 deletion bin/.ruby-version

This file was deleted.

58 changes: 58 additions & 0 deletions bin/badge
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env ruby
# vim: ft=ruby

class SvgFormatter
attr_reader :left, :right, :color

def initialize(left, right, color = "#007ec6")
@left = left
@right = right
@color = color
end

def write!
$stdout.puts svg
rescue RuntimeError => e
@output.puts e.message
@output.puts 'SvgFormatter was unable to generate a badge.'
end

private

def svg
file_content = <<~SVGTEMPLATE
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="30">
<linearGradient id="a" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<rect rx="3" width="90" height="20" fill="#555"/>
<rect rx="3" x="51" width="39" height="20" fill="#{color}"/>
<rect rx="3" width="90" height="20" fill="url(#a)"/>
<g fill="#fff" text-anchor="middle" font-family="Cairo,DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="24.5" y="15" fill="#010101" fill-opacity=".3">#{left}</text>
<text x="24.5" y="14">#{left}</text>
<text x="68.5" y="15" fill="#010101" fill-opacity=".3">#{right}</text>
<text x="69.5" y="14">#{right}</text>
</g>
</svg>
SVGTEMPLATE
file_content
end
end

if ARGV.size < 2
puts "
USAGE:
badge left-word right-word [ right hex-color ] > badge.svg
EXAMPLE:
badge Ruby-API Docs > ruby-api.svg
"
exit 1
end

SvgFormatter.new(*ARGV).write!

2 changes: 1 addition & 1 deletion bin/bashmatic
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# shellcheck disable=2046
[[ -z ${BASHMATIC_HOME} ]] && export BASHMATIC_HOME="$(dirname $(cd $(dirname "${BASH_SOURCE[0]:-${(%):-%x}}") || exit 1; pwd -P))"
source "${BASHMATIC_HOME}/init.sh"
source "${BASHMATIC_HOME}/init.sh" -q

__func="$1"
shift
Expand Down
Loading

0 comments on commit 8fc74f4

Please sign in to comment.