Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add segmented Scarpe app files, reuse more of exe/scarpe #369

Merged
merged 5 commits into from
Aug 26, 2023
Merged

Conversation

noahgibbs
Copy link
Collaborator

Description

Two changes here. One, I extracted a lot of the interesting functionality in exe/scarpe into a scarpe_cli.rb file in Lacci. We can keep this pattern up for anything else that wants to be abstracted across multiple display libraries, but it doesn't actually need a command in Lacci. Probably better.

The other, as I've been saying for awhile, is that we want a way to start packaging multiple different chunks of code (in this case app and test) into a single combined Scarpe-specific app file. This is the simple version: add YAML front matter, divide chunks with a line containing at least 5 dashes. But we now have a really obvious way to add more test langs (identify which test lang in the front matter) and a really simple default (just eval the test code inside the Shoes::App object) that is still enough to package tests with the app if we want.

Eventually this should open up interesting options like a properly hosted-in-child reported-in-parent version of Minitest, which would be cleaner than the current jury-rigged assertion and reporting systems we use for most Scarpe Webview tests.

Image(if needed, helps for a faster review)

      ---
      a: 1
      b: 2
      ----- app code
        Shoes.app do
          button "clicky"
        end
      ----- test code
        require "scarpe/cats_cradle"
        self.class.include Scarpe::Test::CatsCradle
        event_init

        on_heartbeat do
          assert_include button().text, "clicky"

          test_finished
        end

Checklist

  • Run tests locally
  • Run linter(check for linter errors)

@noahgibbs
Copy link
Collaborator Author

Here's a wiki page with the current format and reasoning for segmented apps: https://github.com/scarpe-team/scarpe/wiki/SegmentedApps.md

If the code changes, obviously the wiki is subject to change (or deletion, if appropriate) as well.

@noahgibbs noahgibbs force-pushed the lacci_exe branch 2 times, most recently from d28bebc to 88f3ecc Compare August 25, 2023 06:43
@noahgibbs noahgibbs force-pushed the lacci_exe branch 5 times, most recently from e685c8c to 57ff64d Compare August 25, 2023 15:41
Copy link
Collaborator

@Schwad Schwad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting discussion and thank you for the documentation.

I think the -.scas- approach, including frontmatter, how we'll throw in tests and metadata, is a mature move and a few of these things we've talked about for a while

Initially I was like "why can't we find a cutesy ruby way to store this with END, conventions and maybe a comment block (=begin style) at the top?"

But reading through this properly yeah, I like this direction and let's run with it.

As long as we keep our support for boring .rb style shoes apps we have as much room as we want to experiment with more stuff. And I'd love having the test right there.

I wonder if the syntax highlighter would complain?

I might as @vinistock at some point for tips and tricks on that.

@noahgibbs
Copy link
Collaborator Author

noahgibbs commented Aug 26, 2023

And if you look at the loader approach, nothing stops us from doing both. We only do the segmented YAML thing for .scas files, and only for display services that opt into that. But it does a tiered approach where it will keep trying until some loader says yes. So if there was a way to recognise the __END__ thing, a loader could do that and do it for any non-scas files it felt like.

@noahgibbs noahgibbs merged commit e2bc73c into main Aug 26, 2023
@noahgibbs noahgibbs deleted the lacci_exe branch August 26, 2023 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants