From 3b93c725a3a6c914720ded5df98938bd2adc288f Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Sun, 3 Nov 2019 11:33:16 +0300 Subject: [PATCH] Init project --- .dockerignore | 3 +++ .editorconfig | 14 ++++++++++++++ .gitignore | 11 +++++++++++ Dockerfile | 10 ++++++++++ LICENSE | 21 +++++++++++++++++++++ Makefile | 32 ++++++++++++++++++++++++++++++++ README.md | 27 +++++++++++++++++++++++++++ shard.yml | 13 +++++++++++++ spec/dayoff_spec.cr | 9 +++++++++ spec/spec_helper.cr | 2 ++ src/dayoff.cr | 6 ++++++ tools/ameba | 9 +++++++++ tools/crystal | 15 +++++++++++++++ tools/shards | 9 +++++++++ 14 files changed, 181 insertions(+) create mode 100644 .dockerignore create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 shard.yml create mode 100644 spec/dayoff_spec.cr create mode 100644 spec/spec_helper.cr create mode 100644 src/dayoff.cr create mode 100755 tools/ameba create mode 100755 tools/crystal create mode 100755 tools/shards diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a3607bc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +/.crystal/ +/.shards/ +/coverage/ diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..499b0f7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +root = true + +[*.cr] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.md] +indent_style = tab +indent_size = 2 +insert_final_newline = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0709f70 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/.crystal/ +/.shards/ +/bin/ +/build/ +/coverage/ +/docs/ +/lib/ +/tmp/ +*.dwarf +*.sublime* +spec_cov_* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c423429 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:edge as builder + +# Install crystal and dev libs +RUN apk add -u \ + crystal \ + shards \ + make \ + tzdata \ + libc-dev \ + yaml-dev diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b23896f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Anton Vakhrushev + +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/Makefile b/Makefile new file mode 100644 index 0000000..8475c18 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +PATH := tools:$(PATH) +APP_NAME := dayoff +ENTRY_POINT = ./src/$(APP_NAME).cr + +.PHONY: build-docker +build-docker: + docker pull alpine:edge + docker build -t $(APP_NAME)-crystal . + +.PHONY: install +install: build-docker + +.PHONY: build +build: + mkdir -p build + crystal build $(ENTRY_POINT) --release --no-debug --static -o build/$(APP_NAME) + +.PHONY: format +format: + crystal tool format ./src ./spec + +.PHONY: run +run: format + crystal run $(ENTRY_POINT) + +.PHONY: spec +spec: format + crystal spec --warnings all --error-on-warnings --error-trace + +.PHONY: ameba +ameba: + ameba src/ || true diff --git a/README.md b/README.md new file mode 100644 index 0000000..987939c --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Can I take a daya off? + +TODO: Write a description here + +## Installation + +TODO: Write installation instructions here + +## Usage + +TODO: Write usage instructions here + +## Development + +TODO: Write development instructions here + +## Contributing + +1. Fork it () +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 + +- [your-name-here](https://github.com/your-github-user) - creator and maintainer diff --git a/shard.yml b/shard.yml new file mode 100644 index 0000000..f38e6a6 --- /dev/null +++ b/shard.yml @@ -0,0 +1,13 @@ +name: dayoff +version: 0.1.0 + +authors: + - Anton Vakhrushev + +targets: + dayoff: + main: src/dayoff.cr + +crystal: 0.31.1 + +license: MIT diff --git a/spec/dayoff_spec.cr b/spec/dayoff_spec.cr new file mode 100644 index 0000000..5cfe5ef --- /dev/null +++ b/spec/dayoff_spec.cr @@ -0,0 +1,9 @@ +require "./spec_helper" + +describe Dayoff do + # TODO: Write tests + + 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..f1e1665 --- /dev/null +++ b/spec/spec_helper.cr @@ -0,0 +1,2 @@ +require "spec" +require "../src/dayoff" diff --git a/src/dayoff.cr b/src/dayoff.cr new file mode 100644 index 0000000..589b05f --- /dev/null +++ b/src/dayoff.cr @@ -0,0 +1,6 @@ +# TODO: Write documentation for `Dayoff` +module Dayoff + VERSION = "0.1.0" + + # TODO: Put your code here +end diff --git a/tools/ameba b/tools/ameba new file mode 100755 index 0000000..6438c43 --- /dev/null +++ b/tools/ameba @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -eu + +docker run -it \ + -u "$(id -u):$(id -g)" \ + -v "$PWD:/app" \ + -w "/app" \ + dayoff-crystal ./bin/ameba "$@" diff --git a/tools/crystal b/tools/crystal new file mode 100755 index 0000000..bce4169 --- /dev/null +++ b/tools/crystal @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -eu + +TTY= + +if [ -t 1 ] ; then + TTY=-t +fi + +docker run -i $TTY \ + -u "$(id -u):$(id -g)" \ + -v "$PWD:/app" \ + -w "/app" \ + dayoff-crystal crystal "$@" diff --git a/tools/shards b/tools/shards new file mode 100755 index 0000000..454cfe2 --- /dev/null +++ b/tools/shards @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -eu + +docker run -it \ + -u "$(id -u):$(id -g)" \ + -v "$PWD:/app" \ + -w "/app" \ + dayoff-crystal shards "$@"