Sha256: a920453189519bdecd4fc442fc6a04313709fc6e2f92512e2d7401d9ff152cc4
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true require 'rails/generators' require 'rails/generators/active_record' module ExternalServices module Generators # Installs ExternalServices in a rails app. class ServiceGenerator < ::Rails::Generators::NamedBase source_root File.expand_path('templates/services', __dir__) class_option( :only_api_actions, type: :boolean, default: false, desc: 'Do not generate service model class' ) desc 'Generates specified model and API classes.' def add_model return if options.only_api_actions? dir = File.expand_path('app/models/external_services') template 'model.rb', File.join(dir, "#{file_name}.rb") end def add_api_action dir = File.expand_path('app/models/external_services/api_actions') template 'api_action.rb', File.join(dir, "#{file_name}.rb") end def add_api dir = File.expand_path('lib/external_services/api') template 'api.rb', File.join(dir, "#{file_name}.rb") end def add_api_job dir = File.expand_path('app/jobs/external_services') template 'api_job.rb', File.join(dir, "#{file_name}_api_job.rb") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
external_services-0.5.4 | lib/generators/service_generator.rb |