Sha256: 78c0dee5af0f631c71b16c5a8ce806e406ec955ae2f38d298344777fe665281f

Contents?: true

Size: 1 KB

Versions: 3

Compression:

Stored size: 1 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 :assets

			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

3 entries across 3 versions & 1 rubygems

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