diff --git a/README.md b/README.md index e7dbfae..8a2027c 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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) + + + +## 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) @@ -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 diff --git a/assets/archunitruby-demo-preview.gif b/assets/archunitruby-demo-preview.gif new file mode 100644 index 0000000..1f7adb9 Binary files /dev/null and b/assets/archunitruby-demo-preview.gif differ diff --git a/assets/archunitruby-demo.mp4 b/assets/archunitruby-demo.mp4 new file mode 100644 index 0000000..4bc73f4 Binary files /dev/null and b/assets/archunitruby-demo.mp4 differ diff --git a/docs-assets/custom.css b/docs-assets/custom.css index 8f2b13f..edbeb70 100644 --- a/docs-assets/custom.css +++ b/docs-assets/custom.css @@ -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; diff --git a/docs-assets/demo.html b/docs-assets/demo.html new file mode 100644 index 0000000..3e5c06f --- /dev/null +++ b/docs-assets/demo.html @@ -0,0 +1,28 @@ + + + + + ArchUnitRuby demo: from failing to passing + + +
+
+

One rule. One fix. Back to green.

+

+ 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. +

+ +

34 seconds. The video includes captions and has no audio.

+

+ Try the quickstart · + Download the MP4 +

+
+
+ + diff --git a/scripts/check_docs.rb b/scripts/check_docs.rb index 6ec22ed..1e72777 100644 --- a/scripts/check_docs.rb +++ b/scripts/check_docs.rb @@ -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) @@ -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?(/]*\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" diff --git a/scripts/prepare_docs.rb b/scripts/prepare_docs.rb index d567997..7781cdb 100644 --- a/scripts/prepare_docs.rb +++ b/scripts/prepare_docs.rb @@ -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' @@ -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!('', '') end @@ -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?