Sha256: ff4e41e9971d51a779f29438353ae11920cd81241614a35816da159092d18c46

Contents?: true

Size: 747 Bytes

Versions: 5

Compression:

Stored size: 747 Bytes

Contents

# lib/generators/apache_age/node/entity_generator.rb
require 'rails/generators'
require 'rails/generators/named_base'

require_relative '../generator_entity_helpers'

module ApacheAge
  class NodeGenerator < Rails::Generators::NamedBase
    include ApacheAge::GeneratorEntityHelpers

    desc "Generates node (model) with attributes."
    source_root File.expand_path('templates', __dir__)
    argument :attributes, type: :array, default: [], banner: "field:type field:type"
    class_option :skip_namespace, type: :boolean, default: true, desc: "Skip namespace 'rails_age' in generated files"

    def perform_task
      age_type = 'node'
      behavior == :invoke ? generate_age_entity(age_type) : destroy_age_entity(age_type)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails_age-0.6.4 lib/generators/apache_age/node/node_generator.rb
rails_age-0.6.3 lib/generators/apache_age/node/node_generator.rb
rails_age-0.6.2 lib/generators/apache_age/node/node_generator.rb
rails_age-0.6.1 lib/generators/apache_age/node/node_generator.rb
rails_age-0.6.0 lib/generators/apache_age/node/node_generator.rb