Sha256: d8a876c01678e1162f1c7cd98b1603e86926a900c2abd3144aeeb11597b553c0

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

module Schemable
  class InstallGenerator < Rails::Generators::Base

    source_root File.expand_path('../../templates', __dir__)
    class_option :model_name, type: :string, default: 'Model', desc: 'Name of the model'

    def initialize(*args)
      super(*args)
    end

    def copy_initializer
      target_path = 'spec/swagger/common_definitions.rb'

      if Rails.root.join(target_path).exist?
        say_status('skipped', 'Common definitions already exists')
      else
        copy_file('common_definitions.rb', target_path)
      end

      target_path = 'app/helpers/serializers_helper.rb'

      if Rails.root.join(target_path).exist?
        say_status('skipped', 'Serializers helper already exists')
      else
        copy_file('serializers_helper.rb', target_path)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schemable-0.1.4 lib/generators/schemable/install_generator.rb
schemable-0.1.3 lib/generators/schemable/install_generator.rb