Compare commits
No commits in common. "master" and "release2" have entirely different histories.
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
name: Roda Project
|
||||
description: describes this project for AI to better understand
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Project Architecture
|
||||
|
||||
This is a Roda application using:
|
||||
|
||||
- Roda web framework
|
||||
- Bundler for dependency management
|
||||
- Puma for the application server
|
||||
- systemd for process management
|
||||
|
||||
## Coding Standards
|
||||
|
||||
- Use Context7
|
||||
- Follow the existing naming conventions.
|
||||
- Testing should use minitest.
|
||||
- Tests should be unit tests, not spec tests.
|
||||
- Any database access should use sequel, never use raw sql.
|
||||
- Prioritize **simplicity, clarity, and performance** over cleverness.
|
||||
- Ask clarifying questions if the goal is ambiguous (e.g., “Are you building a REST API or a full web app?”).
|
||||
15
Gemfile
15
Gemfile
|
|
@ -1,20 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
source "https://rubygems.org"
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rake'
|
||||
gem 'roda'
|
||||
gem "roda"
|
||||
|
||||
# change to gunicorn or passenger if you prefer:
|
||||
gem 'puma'
|
||||
gem "puma"
|
||||
|
||||
group :development do
|
||||
gem 'rerun'
|
||||
gem 'rubocop'
|
||||
group :development, :test do
|
||||
gem "rerun"
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'capybara'
|
||||
gem 'minitest'
|
||||
gem 'minitest-reporters'
|
||||
end
|
||||
|
|
|
|||
61
Gemfile.lock
61
Gemfile.lock
|
|
@ -3,9 +3,6 @@ GEM
|
|||
specs:
|
||||
addressable (2.8.7)
|
||||
public_suffix (>= 2.0.2, < 7.0)
|
||||
ansi (1.5.0)
|
||||
ast (2.4.3)
|
||||
builder (3.3.0)
|
||||
capybara (3.40.0)
|
||||
addressable
|
||||
matrix
|
||||
|
|
@ -18,85 +15,51 @@ GEM
|
|||
ffi (1.17.2)
|
||||
ffi (1.17.2-arm64-darwin)
|
||||
ffi (1.17.2-x86_64-darwin)
|
||||
ffi (1.17.2-x86_64-linux-gnu)
|
||||
json (2.15.1)
|
||||
language_server-protocol (3.17.0.5)
|
||||
lint_roller (1.1.0)
|
||||
listen (3.9.0)
|
||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||
rb-inotify (~> 0.9, >= 0.9.10)
|
||||
matrix (0.4.3)
|
||||
mini_mime (1.1.5)
|
||||
minitest (5.26.0)
|
||||
minitest-reporters (1.7.1)
|
||||
ansi
|
||||
builder
|
||||
minitest (>= 5.0)
|
||||
ruby-progressbar
|
||||
mini_portile2 (2.8.9)
|
||||
minitest (5.25.5)
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.10-arm64-darwin)
|
||||
nokogiri (1.18.8)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.10-x86_64-darwin)
|
||||
nokogiri (1.18.8-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.18.10-x86_64-linux-gnu)
|
||||
nokogiri (1.18.8-x86_64-darwin)
|
||||
racc (~> 1.4)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.9.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prism (1.6.0)
|
||||
public_suffix (6.0.2)
|
||||
puma (7.1.0)
|
||||
puma (6.6.0)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.8.1)
|
||||
rack (3.2.3)
|
||||
rack (3.1.16)
|
||||
rack-test (2.2.0)
|
||||
rack (>= 1.3)
|
||||
rainbow (3.1.1)
|
||||
rake (13.3.0)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.11.1)
|
||||
ffi (~> 1.0)
|
||||
regexp_parser (2.11.3)
|
||||
regexp_parser (2.10.0)
|
||||
rerun (0.14.0)
|
||||
listen (~> 3.0)
|
||||
roda (3.97.0)
|
||||
roda (3.93.0)
|
||||
rack
|
||||
rubocop (1.81.1)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (~> 3.17.0.2)
|
||||
lint_roller (~> 1.1.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 2.9.3, < 3.0)
|
||||
rubocop-ast (>= 1.47.1, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 4.0)
|
||||
rubocop-ast (1.47.1)
|
||||
parser (>= 3.3.7.2)
|
||||
prism (~> 1.4)
|
||||
ruby-progressbar (1.13.0)
|
||||
unicode-display_width (3.2.0)
|
||||
unicode-emoji (~> 4.1)
|
||||
unicode-emoji (4.1.0)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin
|
||||
ruby
|
||||
x86_64-darwin
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
capybara
|
||||
minitest
|
||||
minitest-reporters
|
||||
puma
|
||||
rake
|
||||
rerun
|
||||
roda
|
||||
rubocop
|
||||
|
||||
BUNDLED WITH
|
||||
2.7.1
|
||||
2.6.9
|
||||
|
|
|
|||
19
README.md
19
README.md
|
|
@ -1,22 +1,3 @@
|
|||
# Roda step 1 - Single File app (sort of)
|
||||
|
||||
Example single file Roda web app. There are extra files for launching the server, running tests, the license, etc, but the app itself is all in app.rb.
|
||||
|
||||
Prepare the environment with:
|
||||
|
||||
```bash
|
||||
bundle install
|
||||
# could do "bundle update" instead if you want to fetch new versions of packages
|
||||
```
|
||||
|
||||
Run tests with:
|
||||
|
||||
```bash
|
||||
bundle exec rake test
|
||||
```
|
||||
|
||||
Run the app with:
|
||||
|
||||
```bash
|
||||
bundle exec puma
|
||||
```
|
||||
7
Rakefile
7
Rakefile
|
|
@ -1,7 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rake/testtask'
|
||||
|
||||
Rake::TestTask.new do |task|
|
||||
task.pattern = '*_test.rb'
|
||||
end
|
||||
12
app.rb
12
app.rb
|
|
@ -1,16 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
require "roda"
|
||||
|
||||
require 'roda'
|
||||
|
||||
# A simple Roda app all in one file.
|
||||
class App < Roda
|
||||
route do |r|
|
||||
|
||||
r.root do
|
||||
'My Homepage'
|
||||
"My Homepage"
|
||||
end
|
||||
|
||||
r.get 'about' do
|
||||
'About This Site'
|
||||
end
|
||||
"About This Site"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require './app'
|
||||
require "./app"
|
||||
|
||||
run App.freeze.app
|
||||
|
|
|
|||
|
|
@ -1,17 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'minitest/autorun'
|
||||
require 'capybara/minitest'
|
||||
|
||||
require_relative 'app'
|
||||
|
||||
# make test report prettier
|
||||
require 'minitest/reporters'
|
||||
Minitest::Reporters.use!
|
||||
|
||||
Capybara.app = App
|
||||
|
||||
# Run tests for my simple Roda app.
|
||||
class AppTest < Minitest::Test
|
||||
include Capybara::DSL
|
||||
include Capybara::Minitest::Assertions
|
||||
|
|
@ -40,12 +33,13 @@ class AppTest < Minitest::Test
|
|||
# Can change the checked content as your site evolves:
|
||||
def test_home_page_has_content
|
||||
visit '/'
|
||||
assert_content 'My Homepage'
|
||||
assert_content "My Homepage"
|
||||
end
|
||||
|
||||
def test_about_page_exists_and_has_content
|
||||
visit '/about'
|
||||
assert_equal 200, page.status_code
|
||||
assert_content 'About This Site'
|
||||
assert_content "About This Site"
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Reference in a new issue