ActiveGenerator

Gem Version Build Status Coverage Status

ActiveGenerator extends the base rails generators with commonly used generators.

Installation

Add this line to your application's Gemfile:

gem 'active_generator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_generator

Table of Contents

Initializer

Generates an initializer file in the config/initializer directory.

rails generate initializer stripe will generate the following stripe.rb file:

# config/initializer/stripe.rb

# TODO:
  # Add initializer code here.

Locale

Generates an initializer file in the config/locales directory.

Generators:

  • api
  • controller
  • helper
  • job
  • mailer
  • model
  • service
  • uploader
  • view

Options:

  • language: 2, 4, 6, and 6 character prefix

rails generate locale:controller admin/user en-GB will generate the following user.yml file:

# config/locales/en-GB/controller/admin/user.yml

#==================================================
# Table of Contents
#==================================================
# Test
  # V1
    # Actions
    # Methods

en-GB:
  test:
    v1:
      controllers:

        # Actions
        #--------------------------------------------------
        actions:
          todo: "TODO"

        # Methods
        #--------------------------------------------------
        methods:
          todo: "TODO"

Service

Generates an service file in the app/services directory.

rails generate service social/twitter will generate the following twitter.rb file:

# app/services/social/twitter.rb

class Social::Twitter
  # TODO:
    # Add service code here.
end

Contributing

  1. Fork it ( https://github.com/[my-github-username]/active_generator/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request