Sha256: e691eb1f59425075498a677796f9d8732c17ab9fcb78f283976684572c7e888c

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

module Chatroom
	module Generators
		class ChatroomGenerator < Rails::Generators::NamedBase
			include Rails::Generators::ResourceHelpers

			namespace "chatroom"
			source_root File.expand_path('../templates', __FILE__)

			desc "Generators a model with the given NAME (if one does not exists) with chatroom " <<
					 "configuration plus a migration file, controller_file, assets_file, views_file and chatroom routes." << 
					 "Setup the faye server for chatting."

			class_option :routes, :desc => "Generate routes", :type => :boolean, :default => true

			hook_for :orm
			# hook_for :views
			# hook_for :controllers
			hook_for :assets
			# hook_for :helpers

			def add_chatroom_routes
				chatroom_route = <<-ROUTE
resources :#{plural_name}, module: 'chatroom'
				ROUTE
				route chatroom_route
			end

			def setup_private_pub
				gem 'private_pub', '1.0.3'
				gem 'thin', '1.5.1'
				generate 'private_pub:install'

				inject_into_file 'app/assets/javascripts/application.js', before: '//= require_tree .' do <<-RUBY
//= require private_pub
				RUBY
				end
			end
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chatroom-0.0.8 lib/generators/chatroom/chatroom_generator.rb