Skip to content

Commit 66d2ca0

Browse files
cirdesclaude
andcommitted
Add root README/CONTRIBUTING, update gem docs, add gemspec test
- New root README.md describes the monorepo layout (gem/ + docs/) and links the per-subproject READMEs. - New root CONTRIBUTING.md covers the unified workflow: a single PR can touch the component (gem/) and its docs example (docs/) since the docs app consumes the local gem via path: "../gem". - gem/AGENTS.md gains a "Monorepo context" section noting that component changes should be paired with docs/app/views/docs/ updates in the same PR. - gem/CONTRIBUTING.md drops the obsolete instruction to also open a PR on ruby-ui/web — that repo is being archived. - gem/test/gemspec_test.rb is a new regression test that builds the .gem and verifies its contents are limited to README, LICENSE, and lib/. Catches accidental changes to s.files that would leak docs/, test/, or .github/ into the published gem. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a11536e commit 66d2ca0

5 files changed

Lines changed: 177 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contributing to RubyUI
2+
3+
Thanks for your interest in contributing! This repository is a monorepo containing two sibling projects:
4+
5+
- [`gem/`](gem/) — the `ruby_ui` gem published to rubygems.org.
6+
- [`docs/`](docs/) — the Rails app that powers https://rubyui.com.
7+
8+
The big advantage of the monorepo: **a single PR can touch both the component and the docs example**. The docs app consumes the local gem via `path: "../gem"`, so any change in `gem/lib/ruby_ui/` is reflected in the running site immediately.
9+
10+
## Development setup
11+
12+
We recommend using the devcontainer for either subproject (each has its own `.devcontainer/`).
13+
14+
```bash
15+
git clone git@github.com:ruby-ui/ruby_ui.git
16+
cd ruby_ui
17+
18+
# For gem-only work:
19+
cd gem
20+
bundle install
21+
bundle exec rake
22+
23+
# For docs work:
24+
cd docs
25+
bundle install
26+
pnpm install
27+
bin/dev
28+
```
29+
30+
## Workflow
31+
32+
1. Fork and create a feature branch.
33+
2. Make your changes:
34+
- Component or generator changes → `gem/lib/...`, with tests in `gem/test/...`.
35+
- Documentation page changes → `docs/app/views/docs/...` or `docs/app/components/...`.
36+
- If a component change affects how it's documented, update **both** in the same PR.
37+
3. Run the relevant test suites:
38+
- `cd gem && bundle exec rake` (tests + standardrb).
39+
- `cd docs && bin/rails test` and `bundle exec standardrb`.
40+
4. Open a Pull Request against `main`. Use the PR template and prefix the title with a category in brackets, e.g. `[Feature] Add new variant to Button`.
41+
42+
## Focus areas
43+
44+
We prioritize:
45+
46+
- Improving existing components rather than adding new ones.
47+
- Preserving the shadcn look and feel.
48+
- Enhancing documentation.
49+
- Fixing bugs.
50+
51+
## Code style
52+
53+
- Ruby: [Standard Ruby](https://github.com/standardrb/standard)`bundle exec standardrb --fix` to auto-fix.
54+
- JavaScript: kept minimal; Stimulus controllers live alongside the components they belong to.
55+
56+
## Documentation files
57+
58+
The gem ships per-component `*_docs.rb` files (rendering examples) under `gem/lib/ruby_ui/<component>/`. Consumers of the gem can install these into their own Rails app with:
59+
60+
```bash
61+
bin/rails g ruby_ui:install:docs
62+
```
63+
64+
Within this monorepo, the **docs app does not run that generator** — it has its own richer view implementations in `docs/app/views/docs/` and `docs/app/components/docs/`. If you change a component's API, update the relevant view in `docs/app/views/docs/<component>.rb` to keep the documentation site accurate.
65+
66+
Thanks for helping make RubyUI better!

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# RubyUI
2+
3+
[![CI](https://github.com/ruby-ui/ruby_ui/actions/workflows/ci.yml/badge.svg)](https://github.com/ruby-ui/ruby_ui/actions/workflows/ci.yml)
4+
[![Gem Version](https://badge.fury.io/rb/ruby_ui.svg)](https://rubygems.org/gems/ruby_ui)
5+
6+
Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
7+
8+
This repository is a **monorepo** with two sibling projects:
9+
10+
```
11+
ruby_ui/
12+
├── gem/ # the ruby_ui gem (lib/, generators, tests, gemspec)
13+
└── docs/ # the Rails app that powers https://rubyui.com
14+
```
15+
16+
## Quick links
17+
18+
- **Use the gem in your app:** see [`gem/README.md`](gem/README.md).
19+
- **Documentation site:** https://rubyui.com/docs/introduction
20+
- **Contributing guide:** [`CONTRIBUTING.md`](CONTRIBUTING.md)
21+
22+
## Layout
23+
24+
| Path | What lives here |
25+
| --- | --- |
26+
| [`gem/`](gem/) | The `ruby_ui` gem (`gem build`, `gem release` from this folder). |
27+
| [`docs/`](docs/) | Rails 8 app for the documentation site. Consumes the local gem via `path: "../gem"`. |
28+
| [`.github/workflows/ci.yml`](.github/workflows/ci.yml) | Unified CI: gem tests on Ruby 3.3 + 3.4, Rails docs app tests, and a docker-build job that publishes the docs devcontainer to ghcr.io. |
29+
30+
## Development
31+
32+
The two projects are independent for everyday work — pick the one you need:
33+
34+
```bash
35+
# Gem work
36+
cd gem
37+
bundle install
38+
bundle exec rake # tests + standardrb
39+
40+
# Docs work (consumes the local gem via path: "../gem")
41+
cd docs
42+
bundle install
43+
pnpm install
44+
bin/dev # http://localhost:3000
45+
```
46+
47+
Editing files under `gem/lib/ruby_ui/` is reflected immediately when running the docs app — no `bundle update`, no rebuild, no PR coordination across two repos.
48+
49+
## License
50+
51+
Released under the [MIT License](gem/LICENSE.txt).

gem/AGENTS.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# AGENTS.md
22

3-
This file provides guidance to AI coding agents when working with code in this repository.
3+
This file provides guidance to AI coding agents working in `gem/` (the gem subproject of the RubyUI monorepo).
4+
5+
## Monorepo context
6+
7+
This file lives in `gem/`, one of two sibling projects in the `ruby-ui/ruby_ui` monorepo:
8+
9+
- `gem/` — this directory; the `ruby_ui` gem (Phlex components, generators, tests).
10+
- `docs/` — Rails 8 app that powers https://rubyui.com. Consumes the local gem via `path: "../gem"`.
11+
12+
When you change a component here (`gem/lib/ruby_ui/<component>/`), update the matching documentation view in `docs/app/views/docs/<component>.rb` in the same PR.
413

514
## Project Overview
615

gem/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ While we don't have specific test coverage requirements, all contributions shoul
3939

4040
## Documentation
4141

42-
If your changes include new components, modify how components should be used, or add new behaviors, it is highly recommended to also open a PR on the [ruby-ui/web](https://github.com/ruby-ui/web) repository. This ensures the documentation website stays up-to-date with the latest component changes.
42+
If your changes include new components, modify how components should be used, or add new behaviors, please update the corresponding view in `docs/app/views/docs/<component>.rb` in the same PR the docs Rails app lives in this same monorepo and consumes the local gem via `path: "../gem"`.
4343

4444
### Installing Documentation Files
4545

gem/test/gemspec_test.rb

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# frozen_string_literal: true
2+
3+
require "test_helper"
4+
require "rubygems/package"
5+
require "tmpdir"
6+
7+
class GemspecTest < Minitest::Test
8+
GEM_ROOT = File.expand_path("..", __dir__)
9+
10+
def test_packaged_files_match_allowlist
11+
files = build_and_list_files
12+
13+
refute_empty files, "expected the .gem to ship some files"
14+
15+
offenders = files.reject { |f| allowed?(f) }
16+
assert_empty offenders, <<~MSG
17+
ruby_ui.gemspec packaged unexpected files. The gemspec's
18+
s.files allowlist must keep these out of the published gem
19+
(e.g. files from docs/, test/, .github/, Gemfile, etc.):
20+
21+
#{offenders.join("\n ")}
22+
MSG
23+
end
24+
25+
def test_includes_readme_and_license_and_lib
26+
files = build_and_list_files
27+
28+
assert_includes files, "README.md"
29+
assert_includes files, "LICENSE.txt"
30+
assert files.any? { |f| f.start_with?("lib/") }, "expected lib/ files in the gem"
31+
end
32+
33+
private
34+
35+
def allowed?(path)
36+
path == "README.md" || path == "LICENSE.txt" || path.start_with?("lib/")
37+
end
38+
39+
def build_and_list_files
40+
Dir.mktmpdir do |tmpdir|
41+
gem_path = File.join(tmpdir, "ruby_ui.gem")
42+
Dir.chdir(GEM_ROOT) do
43+
output = `gem build ruby_ui.gemspec --output #{gem_path} 2>&1`
44+
raise "gem build failed:\n#{output}" unless $?.success?
45+
end
46+
Gem::Package.new(gem_path).map { |entry| entry.full_name }
47+
end
48+
end
49+
end

0 commit comments

Comments
 (0)