Sha256: feadbb9f35dfbad3fd0accee268e5e0956ae33433931eddf9f66449c1415b0d7
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
require 'generators/transponder' module Transponder module Generators class ServiceGenerator < Base class_option :module_name, type: :string, aliases: '-m', default: 'application' def add_service service_path = File.join(javascripts_path, options[:module_name], "services/#{file_name.downcase}.coffee") template "_service.coffee", service_path end def service_class_name "#{options[:module_name].camelize}.Services.#{file_name.classify}" end def add_service_to_boot boot_file = File.join(javascripts_path, options[:module_name], 'initializers/boot.coffee') insert_into_file boot_file, "new #{service_class_name}()\n", after: "# services\n" end def add_service_to_manifest manifest_file = File.join(javascripts_path, options[:module_name], 'initializers/manifest.coffee') insert_into_file manifest_file, " $(body).trigger '#{options[:module_name].downcase}:services:#{file_name.downcase}'\n", after: "#{options[:module_name].camelize}.services_manifest = ->\n" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems