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

Configuration

rails generate active_generator:install will generate the following file: ../config/initalizers/active_generator.rb

ActiveGenerator::Settings.configure do |config|
  config.autoload_controller_generator_locale = true
  config.autoload_helper_generator_locale = true
  config.autoload_job_generator_locale = true
  config.autoload_mailer_generator_locale = true
  config.autoload_model_generator_locale = true
  config.autoload_service_generator_locale = true
  config.autoload_task_generator_locale = true
  config.autoload_view_generator_locale = true
  config.test_framework = 'test_unit'
end

Environment

Generates an environment file in the config/environments directory.

Options:

rails generate environment staging production will generate the following staging.rb file:

# config/environments/staging.rb

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  ~~~~~~~~~~~~~~~~~~ OMITED IN README ~~~~~~~~~~~~~~~~~~
end

Initializer

Generates an initializer file in the config/initializers directory.

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

# config/initializers/stripe.rb

# TODO:
  # Add initializer code here.

Locale

Generates an initializer file in the config/locales directory.

Generators:

Options:

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
#==================================================
# V1
  # Test
    # Actions
    # Methods

en-GB:
  controllers:
    v1:
      test:

        # 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

View

Generates an view file in the app/views directory.

rails generate view social/twitter index will generate the following index.html.erb file:

# app/views/social/twitter/index.html.erb

<!-- TODO: -->
  <!-- Add view code here. -->

Contributing

Your contribution is welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request