From 34c8539eadc00bb4d73844a26cc6a0a297fdb867 Mon Sep 17 00:00:00 2001 From: George Dietrich Date: Mon, 21 Dec 2020 23:21:53 -0500 Subject: [PATCH] Initial commit --- .editorconfig | 9 ++++ .github/workflows/ci.yml | 44 +++++++++++++++++++ .github/workflows/deployment.yml | 25 +++++++++++ .gitignore | 9 ++++ LICENSE | 21 +++++++++ README.md | 59 ++++++++++++++++++++++++++ shard.yml | 22 ++++++++++ spec/athena-COMPONENT_TEMPLATE_spec.cr | 7 +++ spec/spec_helper.cr | 2 + src/athena-COMPONENT_NAME.cr | 6 +++ 10 files changed, 204 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deployment.yml create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 shard.yml create mode 100644 spec/athena-COMPONENT_TEMPLATE_spec.cr create mode 100644 spec/spec_helper.cr create mode 100644 src/athena-COMPONENT_NAME.cr diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..163eb75 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*.cr] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2296d37 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI + +on: + pull_request: + branches: + - 'master' + schedule: + - cron: '0 21 * * *' + +jobs: + check_format: + runs-on: ubuntu-latest + container: + image: crystallang/crystal:latest-alpine + steps: + - uses: actions/checkout@v2 + - name: Format + run: crystal tool format --check + coding_standards: + runs-on: ubuntu-latest + container: + image: crystallang/crystal:latest-alpine + steps: + - uses: actions/checkout@v2 + - name: Install Dependencies + run: shards install + - name: Ameba + run: ./bin/ameba + test_latest: + runs-on: ubuntu-latest + container: + image: crystallang/crystal:latest-alpine + steps: + - uses: actions/checkout@v2 + - name: Specs + run: crystal spec --order random --error-on-warnings + test_nightly: + runs-on: ubuntu-latest + container: + image: crystallang/crystal:nightly-alpine + steps: + - uses: actions/checkout@v2 + - name: Specs + run: crystal spec --order random --error-on-warnings diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..d63dbbc --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,25 @@ +name: Deployment + +on: + push: + branches: + - master + +jobs: + deploy_docs: + runs-on: ubuntu-latest + container: + image: crystallang/crystal:latest-alpine + steps: + - name: Install Build Dependencies + run: apk add --update rsync + - uses: actions/checkout@v2 + - name: Build + run: crystal docs + - name: Deploy + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: docs + SINGLE_COMMIT: true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0bbd4a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/docs/ +/lib/ +/bin/ +/.shards/ +*.dwarf + +# Libraries don't need dependency lock +# Dependencies will be locked in applications that use them +/shard.lock diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..eb807d9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 CREATOR_NAME + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ffcb657 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# README + +Template repo for creating a new Athena component. Scaffolds the Crystal shard's structure as well as define CI etc. + +**NOTE:** This repo assumes the component will be in the `athena-framework` org. If it is to be used outside of the org, be sure to update URLs accordingly. + +1. Find/replace `COMPONENT_NAME` with the name of the component. This is used as the shard's name. E.x. `logger`. + 1.1 Be sure to rename the file in `./src`, and `./spec` as well. + +1. Replace `NAMESPACE_NAME` with the name of the component's namespace. Documentation for this component will be grouped under this. E.x. `Logger`. + +1. Find/replace `CREATOR_NAME` with your Github display name. E.x. `George Dietrich`. + +1. Find/replace `CREATOR_USERNAME` with your Github username. E.x. `blacksmoke16`. + +1. Find/replace `CREATOR_EMAIL` with your desired email + + 5.1 Can remove this if you don't wish to expose an email. + +1. Find/replace `ALIAS_NAME` with the three letter alias for this component; A + 2 letter shortcut to `NAMESPACE_NAME`. E.x. `ALG`. + +1. Find/replace `DESCRIPTION` with a short description of what the component does. + +Delete from here up +# NAMESPACE_NAME + +[![CI](https://github.com/athena-framework/COMPONENT_NAME/workflows/CI/badge.svg)](https://github.com/athena-framework/COMPONENT_NAME/actions?query=workflow%3ACI) +[![Latest release](https://img.shields.io/github/release/athena-framework/COMPONENT_NAME.svg)](https://github.com/athena-framework/COMPONENT_NAME/releases) + +DESCRIPTION + +## Installation + +1. Add the dependency to your `shard.yml`: + +```yaml +dependencies: + athena-COMPONENT_NAME: + github: athena-framework/COMPONENT_NAME + version: ~> 1.0.0 +``` + +2. Run `shards install` + +## Documentation + +Everything is documented in the [API Docs](https://athena-framework.github.io/COMPONENT_NAME/Athena/NAMESPACE_NAME.html). + +## Contributing + +1. Fork it (https://github.com/athena-framework/COMPONENT_NAME/fork) +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create a new Pull Request + +## Contributors + +- [CREATOR_NAME](https://github.com/CREATOR_USERNAME) - creator and maintainer diff --git a/shard.yml b/shard.yml new file mode 100644 index 0000000..a61d40e --- /dev/null +++ b/shard.yml @@ -0,0 +1,22 @@ +name: athena-COMPONENT_NAME + +version: 0.1.0 + +crystal: '>= 0.35.0' + +license: MIT + +repository: https://github.com/athena-framework/COMPONENT_NAME + +documentation: https://athena-framework.github.io/COMPONENT_NAME/Athena/NAMESPACE_NAME.html + +description: | + DESCRIPTION. + +authors: + - CREATOR_NAME + +development_dependencies: + ameba: + github: crystal-ameba/ameba + version: ~> 0.13.0 diff --git a/spec/athena-COMPONENT_TEMPLATE_spec.cr b/spec/athena-COMPONENT_TEMPLATE_spec.cr new file mode 100644 index 0000000..49018fc --- /dev/null +++ b/spec/athena-COMPONENT_TEMPLATE_spec.cr @@ -0,0 +1,7 @@ +require "./spec_helper" + +describe Athena::NAMESPACE_NAME do + it "works" do + false.should eq(true) + end +end diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr new file mode 100644 index 0000000..2514e53 --- /dev/null +++ b/spec/spec_helper.cr @@ -0,0 +1,2 @@ +require "spec" +require "../src/athena-COMPONENT_NAME" diff --git a/src/athena-COMPONENT_NAME.cr b/src/athena-COMPONENT_NAME.cr new file mode 100644 index 0000000..a778877 --- /dev/null +++ b/src/athena-COMPONENT_NAME.cr @@ -0,0 +1,6 @@ +# Convenience alias to make referencing `Athena::NAMESPACE_NAME` types easier. +alias ALIAS_NAME = Athena::NAMESPACE_NAME + +module Athena::NAMESPACE_NAME + VERSION = "0.1.0" +end