Sha256: 8db0df6c5e6677e4775db64ed678dd55ae3048d6bdd12d011a4427a6cbba5a8f

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

require 'generators/rom'

module ROM
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      def self.namespace
        "rom:#{generator_name}"
      end

      def self.source_root
        File.expand_path("../install/templates", __FILE__)
      end

      class_option :adapter,
        banner: '--adapter=adapter',
        desc: "specify an adapter to use", required: true,
        default: "sql"

      def create_initializer
        template 'initializer.rb.erb',
          File.join('config', 'initializers', 'rom.rb')
      end

      def add_types_module
        copy_file "types.rb", "lib/types.rb"
      end

      def add_application_model
        copy_file "application_model.rb", "app/models/application_model.rb"
      end



    private

      def adapter
        options[:adapter].to_sym
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rom-rails-1.1.1 lib/generators/rom/install_generator.rb
rom-rails-1.1.0 lib/generators/rom/install_generator.rb