Sha256: c2ae4196c9f1dd6ed7c678df386a062beefee070ad5ac5c06ab6e15dd57654df
Contents?: true
Size: 1.19 KB
Versions: 5
Compression:
Stored size: 1.19 KB
Contents
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', __FILE__) 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
5 entries across 5 versions & 1 rubygems