From 9a0da55e76f097b623ec9fec3e2ba38097174cc5 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Tue, 17 Oct 2023 13:49:33 -0400 Subject: [PATCH] fix: ameba + gh actions --- .github/workflows/ci.yml | 7 +++++-- .github/workflows/docs.yml | 23 --------------------- README.md | 2 +- shard.yml | 3 --- spec/support/with_project_cleanup.cr | 2 +- src/breeze/actions/mixins/action_helpers.cr | 17 ++++++++------- src/breeze/components/breeze/panel.cr | 2 +- 7 files changed, 17 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 686ae3c..1629648 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,11 @@ jobs: run: shards install - name: Format run: crystal tool format --check - - name: Lint - run: ./bin/ameba + - name: Crystal Ameba Linter + id: crystal-ameba + uses: crystal-ameba/github-action@v0.8.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} specs: strategy: fail-fast: false diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 450bb30..0000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Deploy docs - -on: - push: - branches: [main] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - uses: crystal-lang/install-crystal@v1 - - name: "Install shards" - run: shards install - - name: "Generate docs" - run: crystal docs - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs diff --git a/README.md b/README.md index 3069c1d..526941a 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ For more examples on creating a Breeze extension, look at the `BreezeCarbon` ext ## Development -Install shards `shards install`, and start making changes. Be sure to run `./bin/ameba`, and the crystal formatter `crystal tool format spec src`. +Install shards `shards install`, and start making changes. Be sure to run [`ameba`](https://github.com/crystal-ameba/ameba), and the crystal formatter `crystal tool format spec src`. Read through the issues for things you can work on. If you have an idea, feel free to open a new issue! diff --git a/shard.yml b/shard.yml index 608afca..6fa2891 100644 --- a/shard.yml +++ b/shard.yml @@ -30,9 +30,6 @@ dependencies: version: ~> 0.1 development_dependencies: - ameba: - github: crystal-ameba/ameba - version: ~> 1.5 lucky_cli: github: luckyframework/lucky_cli version: ~> 1.0 diff --git a/spec/support/with_project_cleanup.cr b/spec/support/with_project_cleanup.cr index 4249cfd..8290a2a 100644 --- a/spec/support/with_project_cleanup.cr +++ b/spec/support/with_project_cleanup.cr @@ -1,5 +1,5 @@ module WithProjectCleanup - private def with_project_cleanup(project_directory = "test-project", skip_db_drop = false) + private def with_project_cleanup(project_directory = "test-project", skip_db_drop = false, &) yield FileUtils.cd(project_directory) { diff --git a/src/breeze/actions/mixins/action_helpers.cr b/src/breeze/actions/mixins/action_helpers.cr index 5bf67fe..5b08547 100644 --- a/src/breeze/actions/mixins/action_helpers.cr +++ b/src/breeze/actions/mixins/action_helpers.cr @@ -72,14 +72,15 @@ module Breeze::ActionHelpers private def store_breeze_response if allow_breeze(context) - req = Fiber.current.breeze_request.not_nil! - spawn(name: "Create Breeze::SaveBreezeResponse") do - Breeze::SaveBreezeResponse.create!( - breeze_request_id: req.id, - status: response.status_code, - session: JSON.parse(session.to_json), - headers: JSON.parse(response.headers.to_h.to_json) - ) + if req = Fiber.current.breeze_request + spawn(name: "Create Breeze::SaveBreezeResponse") do + Breeze::SaveBreezeResponse.create!( + breeze_request_id: req.id, + status: response.status_code, + session: JSON.parse(session.to_json), + headers: JSON.parse(response.headers.to_h.to_json) + ) + end end end diff --git a/src/breeze/components/breeze/panel.cr b/src/breeze/components/breeze/panel.cr index 1401ae6..c35f912 100644 --- a/src/breeze/components/breeze/panel.cr +++ b/src/breeze/components/breeze/panel.cr @@ -1,5 +1,5 @@ class Breeze::Panel < Breeze::BreezeComponent - def render + def render(&) div class: "mb-12 bg-white rounded-lg shadow-lg overflow-hidden" do yield end