Class: DrySerialization::JsonapiSerializer::InstallGenerator

Inherits:
BaseGenerator
  • Object
show all
Defined in:
lib/generators/dry_serialization/jsonapi_serializer/install_generator.rb

Constant Summary

Constants inherited from BaseGenerator

BaseGenerator::API_CONTROLLER_PATH, BaseGenerator::SERIALIZERS

Instance Method Summary collapse

Methods inherited from BaseGenerator

exit_on_failure?

Instance Method Details

#install_jsonapi_serializerObject

Add blueprinter gem to gemfile after dry_serialization declaration and bundles the newly declared gem



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/dry_serialization/jsonapi_serializer/install_generator.rb', line 9

def install_jsonapi_serializer
  remove_other_supported_gems(SERIALIZERS[:blueprinter], SERIALIZERS[:ams])
  
  puts "Installing #{SERIALIZERS[:jsonapi_serializer]}..."
  insert_into_file('Gemfile',
                   "\ngem 'jsonapi_serializer'",
                   after: "gem 'dry_serialization'")
  run 'bundle install'
  
  helper_include(SERIALIZERS[:jsonapi_serializer])
end