Class: DrySerialization::Blueprinter::InstallGenerator

Inherits:
BaseGenerator
  • Object
show all
Defined in:
lib/generators/dry_serialization/blueprinter/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_blueprinterObject

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/blueprinter/install_generator.rb', line 9

def install_blueprinter
  remove_other_supported_gems(SERIALIZERS[:ams], SERIALIZERS[:jsonapi_serializer])
  
  puts "Installing #{SERIALIZERS[:blueprinter]}..."
  insert_into_file('Gemfile',
                   "\ngem 'blueprinter'",
                   after: "gem 'dry_serialization', source: 'https://gem.fury.io/mikeyduece-gems/'")
  run 'bundle install'
  
  helper_include(SERIALIZERS[:blueprinter])
end