Skip to content

Latest commit

 

History

History
134 lines (110 loc) · 6 KB

COMMANDS.md

File metadata and controls

134 lines (110 loc) · 6 KB

Development Commands

Note: This application runs in Docker. All commands should be executed using docker compose.

Initial Setup

docker compose up -d                                 # Start Docker environment (postgres, app, worker)
docker compose exec -u root --rm app bundle install  # Install Ruby gems
docker compose exec -u root --rm app yarn install    # Install JS dependencies
docker compose exec app bundle exec rails db:setup   # Setup database

Docker Services:

  • app - Rails application (runs Foreman with web, js, css processes)
  • postgres - PostgreSQL 18
  • worker - Background job processor

Running the App

docker compose up            # Start all services (app runs foreman with web, js, css watch)
docker compose up -d         # Start all services in background
docker compose logs -f app   # Follow app logs
docker compose down          # Stop all services

Accessing the App Container

docker compose exec app bash              # Open shell in running app container
docker compose run --rm app bash          # Run one-off command in new container
docker compose run -u root --rm app bash  # Run as root (for system changes)

Database

docker compose exec app bundle exec rails db:setup                   # Create, migrate, seed database
docker compose exec app bundle exec rails db:migrate                 # Run migrations
docker compose exec app bundle exec rails database:seed              # Run all seeds (production + development)
docker compose exec app bundle exec rails database:seed:production   # Production seeds only
docker compose exec app bundle exec rails database:seed:development  # Development seeds only
docker compose exec app bundle exec rails db:reset                   # Drop, create, migrate, seed

See docs/DATABASE.md for detailed database conventions and patterns.

Testing

docker compose exec app bundle exec rspec                                # Run all specs
docker compose exec app bundle exec rspec spec/models/                   # Run all model specs
docker compose exec app bundle exec rspec spec/models/model_spec.rb      # Run model model specs
docker compose exec app bundle exec rspec spec/path/to/file_spec.rb:12   # Run specific test at line 12

See docs/TESTING.md for comprehensive testing documentation.

Linting & Security

docker compose exec app bundle exec rubocop     # Run Rubocop linter
docker compose exec app bundle exec rubocop -A  # Auto-correct safe and unsafe offenses
docker compose exec app bundle exec brakeman    # Security vulnerability scan

See docs/STYLE.md for code style conventions.

ERB Tooling (Herb)

docker compose exec app bundle exec herb analyze app  # Analyze all ERB templates
docker compose exec app bundle exec herb parse [file] # Parse a specific ERB file
docker compose exec app bundle exec herb lex [file]   # Lex a specific ERB file
docker compose exec app bundle exec herb ruby [file]  # Extract Ruby from ERB file
docker compose exec app bundle exec herb html [file]  # Extract HTML from ERB file

Configuration is in .herb.yml in the project root.

Bundle/Dependency Management

docker compose exec -u root --rm app bundle install   # Install gems (requires root)
docker compose exec -u root --rm app bundle update    # Update gems (requires root)
docker compose exec -u root --rm app yarn install     # Install JS dependencies (requires root)
docker compose exec -u root --rm app yarn upgrade     # Update JS dependencies (requires root)

Asset Compilation

docker compose exec app yarn build           # Build both JS and CSS
docker compose exec app yarn build:js        # Build JavaScript with esbuild
docker compose exec app yarn build:css       # Build CSS with Tailwind

Icons

bin/icons                                    # Convert all public/icon*.svg to PNG (requires librsvg on the host)
bin/icons public/icon-black.svg              # Convert a single icon
SIZE=1024 bin/icons                          # Override the output size (default: 512)

Releasing

bin/release v1.2.3                           # Bump version, update changelog, commit, tag, and push (after confirmation)
bin/release v1.2.3-rc.1                      # Release a pre-release version
bin/version v1.2.3                           # Only write version 1.2.3 to lib/rsync_ui/version.rb
bin/changelog v1.2.3                         # Only move "Unreleased" entries to v1.2.3 (today), update links, print release notes
bin/changelog v1.2.3 2026-01-31              # Same, with an explicit release date

The CI workflow runs bin/changelog on the pushed tag to extract the release notes for the GitHub release.

Annotations

docker compose exec app bundle exec annotaterb models     # Annotate models with schema info
docker compose exec app bundle exec annotaterb routes     # Annotate routes

Rails Console & Other Rails Commands

docker compose exec app bundle exec rails console           # Open Rails console
docker compose exec app bundle exec rails routes            # View routes
docker compose exec app bundle exec rails about             # View Rails/Ruby versions
docker compose exec app bundle exec rails routes -g models  # View routes for models controller

Background Job Management

docker compose exec app bundle exec rails mission_control:jobs  # Access job management UI (runs on separate port)
docker compose logs -f worker                                   # View background worker logs
docker compose restart worker                                   # Restart background worker

SSH Config Management

The application manages ~/.ssh/config and per-server key/password files automatically via Servers::SSHConfigService. The config is regenerated on server create/update/destroy and at application startup.

Prerequisites (included in Docker image):

  • sshpass — used to pass SSH passwords non-interactively for rsync jobs with password authentication