A simple Sinatra web application with Rake tasks and testing setup.
-
Install Ruby 3.3.5 (check
.ruby-version
for the exact version) -
Install dependencies:
bundle install
bundle exec rackup config.ru
The app will be available at http://localhost:9292
The app is configured to run on Heroku using the Procfile. Heroku automatically runs:
bundle exec puma config.ru -p $PORT
Run the full test suite:
bundle exec rspec
Run specific test files:
bundle exec rspec spec/app_spec.rb
bundle exec rspec spec/tasks/greeting_spec.rb
This project uses Standard Ruby for code formatting and linting.
Check for style violations:
bundle exec standardrb
Auto-fix style violations:
bundle exec standardrb --fix
GET /
- Returns "Hello, world!"GET /h12
- Demonstrates Heroku H12 timeout (sleeps for 31 seconds)
The application includes custom Rake tasks:
# List all available tasks
bundle exec rake -T
# English greeting
bundle exec rake greeting:english
# Japanese greeting
bundle exec rake greeting:japanese
- Create a new
.rake
file inlib/tasks/
- Define your task using the standard Rake syntax:
namespace :your_namespace do task :your_task do # Task implementation end end
- Tasks are automatically loaded via the
Rakefile
├── app/
│ ├── controllers/ # Application controllers
│ ├── views/ # View templates
│ └── public/ # Static assets
├── lib/
│ └── tasks/ # Custom Rake tasks
├── spec/ # Test files
├── app.rb # Main application file
├── config.ru # Rack configuration
└── Rakefile # Rake configuration