RailsMate - VSCode Extension
Description
RailsMate is a Visual Studio Code extension designed to simplify your workflow when working with Ruby on Rails projects. It provides a set of commands to automate tasks such as generating new projects, creating migrations, scaffolding API components, running tests, and more—all directly from VSCode.
Whether you're new to Rails or an experienced developer, RailsMate helps you stay productive by providing key Rails commands at your fingertips.
Features
- Create New Rails Project: Quickly create a new Rails project.
- Create New Rails API Project: Generate a new API-only Rails project.
- Generate and Run Migrations: Generate migrations, run database migrations, and manage database schema.
- Generate API Controllers, Models, and Serializers: Scaffold API controllers, models, and serializers for your Rails application.
- Run Tests: Execute your Rails test cases right from VSCode.
- Reset and Seed Database: Easily reset or seed your database.
- Rollback Migrations: Undo the most recent migration.
Installation
To install RailsMate:
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
- Search for "RailsMate".
- Click Install on the RailsMate extension.
Alternatively, you can install it manually from the marketplace by following this link:
RailsMate Extension on VSCode Marketplace.
Usage
Command Palette
To access RailsMate commands, open the Command Palette:
- On Windows/Linux:
Ctrl+Shift+P
- On macOS:
Cmd+Shift+P
Type any of the following commands to interact with the extension:
Available Commands
Create New Rails Project
Command: railsMate.createNewProject
Description: Quickly generate a new Rails project.
Create New Rails API Project
Command: railsMate.createNewApiProject
Description: Create a new Rails API-only project.
Generate Migration to Add Column
Command: railsMate.generateAddColumnMigration
Description: Generate a migration to add a new column to an existing table.
Toggle Rails API Server
Command: railsMate.toggleApiServerDisposable
Description: Toggle the Rails API server (start or stop the server).
Run Database Migrations
Command: railsMate.runDbMigrateDisposable
Description: Run pending database migrations to update your schema.
Generate API Controller
Command: railsMate.generateApiControllerDisposable
Description: Generate a new API controller for a given resource.
Generate API Model
Command: railsMate.generateApiModelDisposable
Description: Generate a model for a specified resource.
Generate API Serializer
Command: railsMate.generateApiSerializerDisposable
Description: Create a serializer for a resource in your Rails API.
Run Tests
Command: railsMate.runTestsDisposable
Description: Run your Rails tests from within VSCode.
Generate New Migration
Command: railsMate.generateMigrationDisposable
Description: Create a new migration file for database schema changes.
Add Column to Table
Command: railsMate.addColumnToTableDisposable
Description: Add a new column to an existing table.
Rollback Database Migration
Command: railsMate.rollbackMigrationDisposable
Description: Rollback the most recent database migration.
Reset Database
Command: railsMate.resetDbDisposable
Description: Reset the database (drop and recreate).
Seed Database
Command: railsMate.seedDbDisposable
Description: Seed the database with initial data.
Example Usage
Creating a new Rails API project: Open the Command Palette and type RailsMate: Create New Rails API Project
. Provide the necessary project details and proceed.
Generating a migration to add a column: Type RailsMate: Generate Migration to Add Column
and enter the details for your column (table name, column name, etc.).
Running database migrations: To apply pending migrations, type RailsMate: Run Database Migrations
and it will execute all migrations.
Running tests: To run your tests, open the Command Palette and type RailsMate: Run Tests
.
Configuration
RailsMate is ready to use out-of-the-box, but you can adjust its behavior to fit your project’s needs by modifying your VSCode settings.
Configuration Options
- Open VSCode settings by pressing
Ctrl+,
(Windows/Linux) or Cmd+,
(macOS).
- Search for
RailsMate
to find any available settings and adjust them according to your project requirements.
Requirements
- Ruby: Ensure Ruby is installed on your system.
- Rails: You need to have Rails installed (
gem install rails
).
- Bundler: Install Bundler (
gem install bundler
) for dependency management.
- Database (SQLite/PostgreSQL/MySQL): Ensure that the necessary database adapter gems are installed, e.g.,
sqlite3
, pg
, or mysql2
.
Contributing
We welcome contributions! If you'd like to improve RailsMate, follow these steps:
- Fork the repository and create a new branch for your changes.
- Make your changes and ensure they work properly.
- Submit a pull request describing your changes.
Reporting Issues
If you encounter any bugs or have feature suggestions, feel free to file an issue on GitHub. Please include your Rails version, Ruby version, and any error messages.
License
RailsMate is licensed under the MIT License. See the LICENSE file for more details.
Credits
- Rails Framework: The backbone of this extension’s commands.
- VSCode API: Used to integrate the commands and functionality into VSCode.