Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ArchUnit.project_files.in_folder('app/api/**')
ArchUnitRuby analyzes source with Prism without booting your application. It is the Ruby member
of the [ArchUnitEverything family](#community), inspired by—but not affiliated with—ArchUnit.

[Quickstart](#quickstart) · [Capabilities](#capabilities) · [User guide](GUIDE.md) ·
[Quickstart](#quickstart) · [Demo](#demo) · [Capabilities](#capabilities) · [User guide](GUIDE.md) ·
[API contract](API.md) · [Documentation site](https://dragonsec-ai.github.io/ArchUnitRuby/) ·
[Example project](#example-project) · [Limitations](#limitations)

Expand Down Expand Up @@ -123,7 +123,20 @@ Remove that dependency in this small fixture to return to green. In an applicati
the interaction through your intended service boundary instead of merely suppressing the test.
In a long-lived process, clear the graph cache after source edits; separate RSpec runs start fresh.

[Complete workflows](GUIDE.md) · [Watch the recorded demo](https://github.com/user-attachments/assets/9b7305a0-deee-454d-b99e-f8fac63d06ab)
[Complete workflows](GUIDE.md)

<a id="demo"></a>

## Demo

Watch a real RSpec architecture test fail when the API reaches directly into the database,
then pass after the API goes through a service. The test itself never changes.

[![ArchUnitRuby demo preview: a forbidden dependency fails, then the unchanged test passes](assets/archunitruby-demo-preview.gif)](https://dragonsec-ai.github.io/ArchUnitRuby/demo.html)

[Watch the full demo (34 seconds, captioned)](https://dragonsec-ai.github.io/ArchUnitRuby/demo.html) ·
[Download the MP4](assets/archunitruby-demo.mp4) ·
[Try the quickstart](#quickstart)

<a id="capabilities"></a>

Expand Down Expand Up @@ -272,6 +285,7 @@ has normal Ruby behavior.
The [Ruby RAG example](https://github.com/TristanKruse/ArchUnitRuby-TestRepo-RAG) is a small layered
application with intentional architecture violations. Use it for a hands-on walkthrough;
its tests also run against the current checkout in our CI.
[Watch the longer RAG walkthrough](https://github.com/user-attachments/assets/9b7305a0-deee-454d-b99e-f8fac63d06ab).

The library dogfoods its own architecture. CI checks Ruby 3.3/3.4/4.0 on Linux and Ruby 4.0 on
Windows, gates runtime-library coverage at 98% line / 90% branch, validates docs and package
Expand Down
Binary file added assets/archunitruby-demo-preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/archunitruby-demo.mp4
Binary file not shown.
8 changes: 8 additions & 0 deletions docs-assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ tt {
font-family: var(--au-mono);
}

.archunit-demo-video {
display: block;
width: 100%;
height: auto;
background: var(--au-code);
border-radius: var(--au-radius);
}

pre,
.source_code {
background: var(--au-code) !important;
Expand Down
28 changes: 28 additions & 0 deletions docs-assets/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ArchUnitRuby demo: from failing to passing</title>
</head>
<body>
<div id="main">
<main id="content">
<h1>One rule. One fix. Back to green.</h1>
<p>
Watch an RSpec architecture test fail on a direct API-to-database dependency,
then pass after the API goes through a service. The test itself never changes.
</p>
<video class="archunit-demo-video" controls playsinline preload="metadata"
aria-label="ArchUnitRuby red-to-green RSpec demo">
<source src="assets/archunitruby-demo.mp4" type="video/mp4">
<a href="assets/archunitruby-demo.mp4">Download the captioned demo (MP4)</a>
</video>
<p>34 seconds. The video includes captions and has no audio.</p>
<p>
<a href="index.html#quickstart">Try the quickstart</a> ·
<a href="assets/archunitruby-demo.mp4" download>Download the MP4</a>
</p>
</main>
</div>
</body>
</html>
7 changes: 7 additions & 0 deletions scripts/check_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
REQUIRED_FILES = %w[
index.html file.API.html file.GUIDE.html _index.html class_list.html css/archunit.css
js/archunit.js assets/logo-rounded.png assets/social-preview.png .nojekyll robots.txt sitemap.xml
demo.html assets/archunitruby-demo-preview.gif assets/archunitruby-demo.mp4
].freeze

def internal_target(page, href)
Expand Down Expand Up @@ -64,6 +65,12 @@ def check_reference_navigation(page, content)
raise "Broken document anchors:\n#{fragments.join("\n")}" unless fragments.empty?

guide = OUTPUT.join('index.html').binread.force_encoding(Encoding::UTF_8)
demo = OUTPUT.join('demo.html').binread.force_encoding(Encoding::UTF_8)
unless guide.include?('href="demo.html"') && demo.match?(/<video\b[^>]*\bcontrols\b/) &&
demo.include?('src="assets/archunitruby-demo.mp4"')
raise 'The demo link must open a page with a playable captioned MP4'
end

unrendered = {
'GitHub badge Markdown' => '[![',
'backtick code fence' => "#{96.chr * 3}ruby"
Expand Down
10 changes: 7 additions & 3 deletions scripts/prepare_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
STYLESHEET = OUTPUT.join('css', 'archunit.css')
THEME_SCRIPT = OUTPUT.join('js', 'archunit.js')
LOGO = OUTPUT.join('assets', 'logo-rounded.png')
SOCIAL_PREVIEW = OUTPUT.join('assets', 'social-preview.png')
SITE_ASSETS = %w[
logo-rounded.png social-preview.png archunitruby-demo-preview.gif archunitruby-demo.mp4
].freeze
SITE_URL = 'https://dragonsec-ai.github.io/ArchUnitRuby/'
DEMO_URL = "#{SITE_URL}demo.html".freeze
SOURCE_URL = 'https://github.com/dragonsec-ai/ArchUnitRuby/blob/main/'
DOCUMENT_PAGES = {
'README.md' => 'index.html', 'GUIDE.md' => 'file.GUIDE.html', 'API.md' => 'file.API.html'
Expand Down Expand Up @@ -86,6 +89,7 @@ def prepare_page(path)
content = page.binread.force_encoding(Encoding::UTF_8)

rewrite_source_links(content, page)
content.gsub!(%(href="#{DEMO_URL}"), %(href="#{relative_href(OUTPUT.join('demo.html'), page)}"))
if page.basename.to_s.match?(/\A(?:class|method|file)_list\.html\z/)
content.sub!('<body>', '<body class="archunit-list">')
end
Expand All @@ -95,8 +99,8 @@ def prepare_page(path)
end

FileUtils.mkdir_p(LOGO.dirname)
FileUtils.cp(ROOT.join('assets', 'logo-rounded.png'), LOGO)
FileUtils.cp(ROOT.join('assets', 'social-preview.png'), SOCIAL_PREVIEW)
FileUtils.cp(SITE_ASSETS.map { |asset| ROOT.join('assets', asset) }, LOGO.dirname)
FileUtils.cp(ROOT.join('docs-assets', 'demo.html'), OUTPUT.join('demo.html'))

raise 'YARD did not generate the documentation stylesheet' unless STYLESHEET.file?
raise 'YARD did not copy the documentation theme script' unless THEME_SCRIPT.file?
Expand Down