From 9e1fcf2d48eff55d5d85b577155474084eb524cd Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Date: Sun, 12 May 2024 15:08:09 +0200 Subject: [PATCH] chore: kemal + crystal setup --- .browserslistrc | 1 - .dockerignore | 6 ---- .editorconfig | 9 +++++ .github/config/rubocop_linter_action.yml | 7 ---- .github/workflows/main.yml | 24 ------------- .gitignore | 45 +++-------------------- .rubocop.yml | 9 ----- .ruby-version | 1 - Dockerfile | 46 ------------------------ Dockerfile.db | 3 -- Dockerfile.dev | 31 ---------------- LICENSE | 21 +++++++++++ README.md | 27 ++++++++++++++ shard.yml | 13 +++++++ spec/spec_helper.cr | 2 ++ spec/url-shortener_spec.cr | 9 +++++ src/url-shortener.cr | 6 ++++ 17 files changed, 92 insertions(+), 168 deletions(-) delete mode 100644 .browserslistrc delete mode 100644 .dockerignore create mode 100644 .editorconfig delete mode 100644 .github/config/rubocop_linter_action.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .rubocop.yml delete mode 100644 .ruby-version delete mode 100644 Dockerfile delete mode 100644 Dockerfile.db delete mode 100644 Dockerfile.dev create mode 100644 LICENSE create mode 100644 README.md create mode 100644 shard.yml create mode 100644 spec/spec_helper.cr create mode 100644 spec/url-shortener_spec.cr create mode 100644 src/url-shortener.cr diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index e94f814..0000000 --- a/.browserslistrc +++ /dev/null @@ -1 +0,0 @@ -defaults diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 54f09b5..0000000 --- a/.dockerignore +++ /dev/null @@ -1,6 +0,0 @@ -.git -.gitignore - -config/master.key - -README.md 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/config/rubocop_linter_action.yml b/.github/config/rubocop_linter_action.yml deleted file mode 100644 index 4cb4f7e..0000000 --- a/.github/config/rubocop_linter_action.yml +++ /dev/null @@ -1,7 +0,0 @@ -check_name: RuboCop Results - -versions: - - rubocop - - rubocop-rails - -rubocop_fail_level: error \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index d36066f..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Deploy production to donado.co -on: - push: - branches: - - master -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: RuboCop Linter Action - uses: andrewmcodes/rubocop-linter-action@v3.3.0 - with: - action_config_path: .github/config/rubocop_linter_action.yml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Push to dokku - uses: dokku/github-action@master - with: - git_remote_url: "ssh://dokku@ssh.donado.co:22/url-shortener" - ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} diff --git a/.gitignore b/.gitignore index 4943a40..0bb75ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,40 +1,5 @@ -# See https://help.github.com/articles/ignoring-files for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile '~/.gitignore_global' - -# Ignore bundler config. -/.bundle - -# Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep - -# Ignore uploaded files in development -/storage/* -!/storage/.keep - -/node_modules -/yarn-error.log - -/public/assets -.byebug_history - -# Ignore master key for decrypting credentials and more. -/config/master.key - -# Ignore coverage reports -/coverage/* - -/public/packs -/public/packs-test -/node_modules -/yarn-error.log -yarn-debug.log* -.yarn-integrity - -# Ignore keys -*.key +/docs/ +/lib/ +/bin/ +/.shards/ +*.dwarf diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 5c14707..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,9 +0,0 @@ -require: rubocop-rails - -AllCops: - NewCops: enable -Style/Documentation: - Enabled: false -Style/MixinUsage: - Exclude: - - 'bin/*' \ No newline at end of file diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index fe30cc1..0000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -ruby-2.6.6 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d1a2be3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,46 +0,0 @@ -FROM ruby:2.6.3-alpine - -ARG RAILS_MASTER_KEY='' -ENV RAILS_MASTER_KEY ${RAILS_MASTER_KEY} - -ENV RAILS_ENV production -ENV APP_PATH /usr/src/app -ENV BUNDLE_VERSION 2.1.4 - -WORKDIR $APP_PATH - -EXPOSE 3000 - -ENV ALPINE_MIRROR "http://dl-cdn.alpinelinux.org/alpine" -RUN echo "${ALPINE_MIRROR}/v3.11/main/" >> /etc/apk/repositories - -RUN apk -U add --no-cache \ -build-base \ -postgresql-dev \ -postgresql-client \ -tzdata \ -nodejs --repository="http://dl-cdn.alpinelinux.org/alpine/v3.11/main/" \ -yarn - -COPY ./entrypoint.sh /usr/bin/entrypoint.sh -RUN chmod +x /usr/bin/entrypoint.sh - -ENTRYPOINT ["entrypoint.sh"] - -RUN gem install bundler --version "$BUNDLE_VERSION" - -COPY ./Gemfile . -COPY ./Gemfile.lock . - -RUN bundle install --binstubs - -COPY ./package.json . -COPY ./yarn.lock . - -RUN yarn --production - -COPY . . - -RUN RAILS_ENV=production bundle exec rails assets:precompile - -CMD ["bundle", "exec", "rails", "s", "-b", "0.0.0.0"] diff --git a/Dockerfile.db b/Dockerfile.db deleted file mode 100644 index b4d0d6a..0000000 --- a/Dockerfile.db +++ /dev/null @@ -1,3 +0,0 @@ -FROM postgres:12.5-alpine - -COPY docker-entrypoint-initdb.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev deleted file mode 100644 index ed42131..0000000 --- a/Dockerfile.dev +++ /dev/null @@ -1,31 +0,0 @@ -FROM ruby:2.6.3-alpine - -ENV APP_PATH /usr/src/app -ENV BUNDLE_VERSION 2.1.4 -ENV BUNDLE_PATH /usr/local/bundle/gems -ENV RAILS_LOG_TO_STDOUT true -ENV RAILS_PORT 3000 - -WORKDIR $APP_PATH - -EXPOSE $RAILS_PORT - -ENV ALPINE_MIRROR "http://dl-cdn.alpinelinux.org/alpine" -RUN echo "${ALPINE_MIRROR}/v3.11/main/" >> /etc/apk/repositories - -RUN apk -U add --no-cache \ -build-base \ -postgresql-dev \ -postgresql-client \ -tzdata \ -nodejs --repository="http://dl-cdn.alpinelinux.org/alpine/v3.11/main/" \ -yarn - -COPY ./entrypoint.dev.sh /usr/bin/entrypoint.sh -RUN chmod +x /usr/bin/entrypoint.sh - -RUN gem install bundler --version "$BUNDLE_VERSION" - -COPY . . - -ENTRYPOINT ["entrypoint.sh"] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0563a13 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Juan Rodriguez + +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..3910786 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# url-shortener + +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 + +- [Juan Rodriguez](https://github.com/your-github-user) - creator and maintainer diff --git a/shard.yml b/shard.yml new file mode 100644 index 0000000..8941591 --- /dev/null +++ b/shard.yml @@ -0,0 +1,13 @@ +name: url-shortener +version: 0.1.0 + +authors: + - Juan Rodriguez + +targets: + url-shortener: + main: src/url-shortener.cr + +crystal: '>= 1.12.1' + +license: MIT diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr new file mode 100644 index 0000000..c8fda01 --- /dev/null +++ b/spec/spec_helper.cr @@ -0,0 +1,2 @@ +require "spec" +require "../src/url-shortener" diff --git a/spec/url-shortener_spec.cr b/spec/url-shortener_spec.cr new file mode 100644 index 0000000..21781a0 --- /dev/null +++ b/spec/url-shortener_spec.cr @@ -0,0 +1,9 @@ +require "./spec_helper" + +describe Url::Shortener do + # TODO: Write tests + + it "works" do + false.should eq(true) + end +end diff --git a/src/url-shortener.cr b/src/url-shortener.cr new file mode 100644 index 0000000..50e157f --- /dev/null +++ b/src/url-shortener.cr @@ -0,0 +1,6 @@ +# TODO: Write documentation for `Url::Shortener` +module Url::Shortener + VERSION = "0.1.0" + + # TODO: Put your code here +end