Sha256: a4a9b2ea2a69b75cbcacd5fd2090d72515ef1bb8764c47084138a9672271e8f1

Contents?: true

Size: 872 Bytes

Versions: 8

Compression:

Stored size: 872 Bytes

Contents

require 'rails/generators'
require 'rails/generators/base'

module HouseStyle
  class InstallGenerator < Rails::Generators::Base
    def self.source_root
      @source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
    end

    def create_root_rubocop_yml
      template 'rubocop.yml', '.rubocop.yml'
    end

    def create_rspec_rubocop_yml
      template 'rspec_rubocop.yml', 'spec/.rubocop.yml'
    end

    def create_db_migrate_rubocop_yml
      template 'db_migrate_rubocop.yml', 'db/migrate/.rubocop.yml' if Dir.exist?(db_path)
    end

    def create_features_rubocop_yml
      template 'features_rubocop.yml', 'features/.rubocop.yml' if Dir.exist?(features_path)
    end

    private

    def db_path
      File.join(Rails.root, 'db', 'migrate')
    end

    def features_path
      File.join(Rails.root, 'features')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
house_style-3.2.2 lib/generators/house_style/install_generator.rb
house_style-3.2.1 lib/generators/house_style/install_generator.rb
house_style-3.2.0 lib/generators/house_style/install_generator.rb
house_style-3.1.0 lib/generators/house_style/install_generator.rb
house_style-3.0.0 lib/generators/house_style/install_generator.rb
house_style-2.3.0 lib/generators/house_style/install_generator.rb
house_style-2.2.1 lib/generators/house_style/install_generator.rb
house_style-2.2.0 lib/generators/house_style/install_generator.rb