Lua on Beans

Lua on Beans CLI Commands

Available Commands

Lua on Beans provides several CLI commands to help you manage your application. Here are some of the most commonly used commands:


# Create a new controller
beans create controller posts

# Create a new model
beans create model post

# Create a scaffold (controller, model, and views)
beans create scaffold posts

# Create a new migration
beans create migration add_indexes_to_posts

# Set up the database
beans db:setup

# Run pending migrations
beans db:migrate

# Rollback the last migration
beans db:rollback

# Run tests
beans specs
      

Command Descriptions

  • create controller: Generates a new controller file with basic CRUD actions.
  • create model: Creates a new model file with standard database operations.
  • create scaffold: Generates a complete set of files for a resource, including controller, model, and views.
  • create migration: Creates a new migration file for database schema changes.
  • db:setup: Sets up the database according to your configuration.
  • db:migrate: Runs any pending database migrations.
  • db:rollback: Reverts the last applied migration.
  • specs: Runs the test suite for your application.

Usage Tips

  • Always run beans db:migrate after creating a new migration or pulling changes that include new migrations.
  • Use beans create scaffold for rapid prototyping of new features.
  • Run beans specs regularly to ensure your changes haven't broken existing functionality.
  • If you need to undo a migration, use beans db:rollback before making changes and re-running the migration.

Development Mode


# Start development mode with file watching
beans -w
      

Command Description

  • -w (watch): Watches for file changes, automatically rebuilding Tailwind CSS and Riot.js files.

Usage Tips

  • Use beans -w during development to automatically recompile assets when you make changes.
  • This command is particularly useful for real-time updates to your Tailwind CSS styles and Riot.js components.
  • Ensure you have Tailwind CSS and Riot.js properly configured in your project for this feature to work effectively.
  • Remember to restart the watcher if you make changes to your build configuration files.