Sha256: aa288b66fed5be9837725f410047903580c3a7e3c28efea4d98bafa244eb41e9

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 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(*)
      super(*)
    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

3 entries across 3 versions & 1 rubygems

Version Path
schemable-0.1.2 lib/generators/schemable/install_generator.rb
schemable-0.1.1 lib/generators/schemable/install_generator.rb
schemable-0.1.0 lib/generators/schemable/install_generator.rb