Sha256: 34b0ded30b47311915d294558286a4a5977c8eea0ef8702656bf56372d89d90d

Contents?: true

Size: 544 Bytes

Versions: 3

Compression:

Stored size: 544 Bytes

Contents

module RailsImporter
  module Generators
    class ImporterGenerator < Rails::Generators::NamedBase
      source_root File.expand_path("../templates", __FILE__)

      desc "Creates an importer class inheriting from RailsImporter::Base"

      def add_importer_class
        template('importer.rb', "lib/rails_importer/#{file_name}_importer.rb")
      end

      def add_to_importers
        insert_into_file "config/initializers/rails_importer.rb", "\tconfig.importers << #{class_name}Importer\n", :before => "end"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_importer-0.2.1 lib/generators/rails_importer/importer_generator.rb
rails_importer-0.2.0 lib/generators/rails_importer/importer_generator.rb
rails_importer-0.1.0 lib/generators/rails_importer/importer_generator.rb