Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x committed Oct 12, 2022
0 parents commit fe5eee2
Show file tree
Hide file tree
Showing 25 changed files with 837 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ARG VARIANT="3"

FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT}

USER vscode
WORKDIR /home/vscode

RUN mkdir -p .config/git \
&& echo ".vscode/*" >> .config/git/ignore \
&& echo "*.code-workspace" >> .config/git/ignore \
&& echo ".history/" >> .config/git/ignore
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Ruby",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "3"
}
},
"extensions": [
"rebornix.Ruby",
"ms-vsliveshare.vsliveshare",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode"
],
"postCreateCommand": "bundle install",
"remoteUser": "vscode"
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
17 changes: 17 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Setup
description: Setup Ruby and install dependencies.

inputs:
node_version:
description: The Ruby version.
required: false
default: '3.1.2'

runs:
using: composite
steps:
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
42 changes: 42 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: format

on:
pull_request:
branches:
- master
workflow_dispatch: {}
repository_dispatch:
types:
- format

jobs:
fix:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: ${{ secrets.GIT_USER_NAME }}
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Format
run: bundle exec rake format
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Run format
commit_user_name: ${{ secrets.GIT_USER_NAME }}
commit_user_email: ${{ secrets.GIT_USER_EMAIL }}
commit_author: ${{ secrets.GIT_USER_NAME }} <${{ secrets.GIT_USER_EMAIL }}>
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: main

on:
push:
branches:
- '**'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Test
run: bundle exec rake test
lint:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Lint
run: bundle exec rake lint
49 changes: 49 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: publish

on:
push:
tags:
- v*

jobs:
rubygems:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Setup credentials
run: |
mkdir -p ~/.gem
echo ":rubygems: Bearer $TOKEN" > ~/.gem/credentials
chmod 640 ~/.gem/credentials
env:
TOKEN: ${{ secrets.RUBYGEMS_API_KEY }}
- name: Publish
run: bundle exec gem release
env:
GEM_RELEASE_KEY: rubygems
GEM_RELEASE_HOST: https://rubygems.org
github:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: ./.github/actions/setup
- name: Setup credentials
run: |
mkdir -p ~/.gem
echo ":rubygems: Bearer $TOKEN" > ~/.gem/credentials
chmod 640 ~/.gem/credentials
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: bundle exec gem release
env:
GEM_RELEASE_KEY: github
GEM_RELEASE_HOST: https://rubygems.pkg.github.com/${{ github.repository_owner }}
49 changes: 49 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: version

run-name: ${{ github.event.inputs.version }}${{ github.event.client_payload.version }}

on:
workflow_dispatch:
inputs:
version:
description: Version to cut
repository_dispatch:
types:
- version

jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Git config
env:
GH_USER: ${{ secrets.GH_USER }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
run: |
git remote set-url --push origin "https://${GH_USER}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git config user.name "$GIT_USER_NAME"
git config user.email "$GIT_USER_EMAIL"
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
git_user_signingkey: true
git_commit_gpgsign: true
git_committer_name: ${{ secrets.GIT_USER_NAME }}
git_committer_email: ${{ secrets.GIT_USER_EMAIL }}
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Setup
uses: ./.github/actions/setup
- name: Cut ${{ github.event.inputs.version }}${{ github.event.client_payload.version }} version
run: bundle exec gem bump --sign --push --version ${{ github.event.inputs.version }}${{ github.event.client_payload.version }}
- name: Tag ${{ github.event.inputs.version }}${{ github.event.client_payload.version }} version
run: bundle exec gem tag --sign --push
66 changes: 66 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Parts of this file were adapted from
# GitHub’s collection of .gitignore file templates
# which are Copyright (c) 2022 GitHub, Inc.
# and released under the MIT License.
# For more details, visit the project page:
# https://github.com/github/gitignore

# rspec failure tracking
.rspec_status

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

# Ignore Byebug command history file.
.byebug_history

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*
4 changes: 4 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--format documentation
--color
--require spec_helper
--pattern "{spec,lib}/**/*_spec.rb"
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Change Log

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## Unreleased
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in makenew-rbgem.gemspec.
gemspec
Loading

0 comments on commit fe5eee2

Please sign in to comment.