Sha256: ed62e0c4a91ede735557990e8db05b7d8ee01f8604a032736d56021f553cd4aa

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

module Chatroom
	# Include this module in your generator to generate Chatroom controllers.
	# 'copy_controllers' is the main method and by default copies all controllers.
	module ControllerPathTemplates
		protected
		def target_path
			@target_path ||= "app/controllers"
		end

		def controller_directory(name, _target_path = nil)
			directory name.to_s, _target_path || "#{target_path}/#{name}"
		end
	end

	class ControllersGenerator < Rails::Generators::Base
		include ControllerPathTemplates
		source_root File.expand_path('../../../../app/controllers', __FILE__)
		desc "Copies Chatroom controllers to your application."

		def copy_controllers
			controller_directory(:chatroom)
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chatroom-0.1.1 lib/generators/chatroom/controllers_generator.rb
chatroom-0.1.0 lib/generators/chatroom/controllers_generator.rb
chatroom-0.0.9 lib/generators/chatroom/controllers_generator.rb
chatroom-0.0.8 lib/generators/chatroom/controllers_generator.rb