GrapeScaffold

Introduction

An API scaffold generator for Grape which generates controller, models and specs.

Installation

Add this line to your Rails application's Gemfile:

gem 'grape-scaffold'

And then execute:

$ bundle

Usage

Scaffold

The scaffold generator works similar to the Rails scaffold, it takes the model name and it's attributes as arguments

$ rails g grape:scaffold Model [Attributes]

Supported Options

  • --skip-model-tests - Skip model tests
  • --skip-controller-tests - Skip controller tests
  • --controller-path=CONTROLLER_PATH - This can be used to set the path where the controller is generated. By default it's generated under app/controllers/api/v1/

Controller

The controller generator can be used to generate only the controller and controller specs.

$ rails g grape:controller Model

Supported Options

  • --skip-controller-tests - Skip controller tests
  • --controller-path=CONTROLLER_PATH - This can be used to set the path where the controller is generated. By default it's generated under app/controllers/api/v1

Source

GrapeScaffold

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

License

Availaible under the MIT License.

X

Talk to us, that's always a good idea!