Sha256: 298bdc3f755e7a40bf58bcf4687fd051bfb1f7ba08aad10f0c811595651f57ce
Contents?: true
Size: 872 Bytes
Versions: 56
Compression:
Stored size: 872 Bytes
Contents
# frozen_string_literal: true require_relative "../../lib/plutonium_generators" module Pu module Field class InputGenerator < Rails::Generators::Base include PlutoniumGenerators::Generator source_root File.expand_path("templates", __dir__) desc "Generates a field input" argument :name def start in_root do template "input.rb", "app/plutonium/fields/inputs/#{name.underscore}_input.rb" insert_into_file "config/initializers/plutonium.rb", registration_statement, after: /.*# Register components here.*\n/ end rescue => e exception "#{self.class} failed:", e end private def registration_statement indent "Plutonium::Core::Fields::Inputs::Factory.map_type :#{name.underscore}, to: Fields::Inputs::#{name.camelize}Input\n", 2 end end end end
Version data entries
56 entries across 56 versions & 1 rubygems