debian/0000755000000000000000000000000012256653355007202 5ustar debian/rules0000755000000000000000000000070111755015341010246 0ustar #!/usr/bin/make -f #export DH_VERBOSE=1 # # Uncomment to ignore all test failures (but the tests will run anyway) #export DH_RUBY_IGNORE_TESTS=all # # Uncomment to ignore some test failures (but the tests will run anyway). # Valid values: #export DH_RUBY_IGNORE_TESTS=ruby1.8 ruby1.9.1 require-rubygems # # If you need to specify the .gemspec (eg there is more than one) #export DH_RUBY_GEMSPEC=gem.gemspec %: dh $@ --buildsystem=ruby --with ruby debian/stompserver.install0000644000000000000000000000005011760621111013136 0ustar debian/stompserver.conf etc/stompserver debian/watch0000644000000000000000000000015311755015341010220 0ustar version=3 http://pkg-ruby-extras.alioth.debian.org/cgi-bin/gemwatch/stompserver .*/stompserver-(.*).tar.gz debian/source/0000755000000000000000000000000011755015341010470 5ustar debian/source/format0000644000000000000000000000001411755015341011676 0ustar 3.0 (quilt) debian/stompserver.init0000644000000000000000000001006212256653355012457 0ustar #! /bin/sh ### BEGIN INIT INFO # Provides: stompserver # Required-Start: $network $remote_fs # Required-Stop: $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: a stomp messaging server implemented in Ruby # Description: this script starts or stops the stomp messaging server # in daemon mode. ### END INIT INFO # # Copyright (c) 2009 Joshua Timberman, # # stompserver Startup script for stompserver # chkconfig: - 80 20 # description: starts up stompserver in daemon mode. DAEMON=/usr/bin/stompserver NAME=stompserver DEFAULT=/etc/default/$NAME DESC=stompserver PIDFILE=/var/run/$NAME/pid STARTTIME=2 DIETIME=2 test -x $DAEMON || exit 0 . /lib/lsb/init-functions if [ ! -d /var/run/stompserver ]; then mkdir -p /var/run/stompserver fi # Read configuration variable file if it is present [ -r $DEFAULT ] && . $DEFAULT chown stompserver:stompserver /var/run/stompserver DAEMON_OPTS="-C /etc/stompserver/stompserver.conf" running() { [ ! -f "$PIDFILE" ] && return 1 status="0" pidofproc -p $PIDFILE $NAME >/dev/null || status="$?" if [ "$status" = 0 ]; then return 0 else return 1 fi } start_server() { start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS errcode=$? return $errcode } stop_server() { if [ -z "$DAEMONUSER" ] ; then killproc -p $PIDFILE $DAEMON errcode=$? else start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --user $DAEMONUSER \ --exec $DAEMON errcode=$? fi return $errcode } reload_server() { [ ! -f "$PIDFILE" ] && return 1 pid=pidofproc $PIDFILE # This is the daemon's pid kill -1 $pid return $? } force_stop() { [ ! -e "$PIDFILE" ] && return if running ; then kill -15 $pid sleep "$DIETIME"s if running ; then kill -9 $pid sleep "$DIETIME"s if running ; then echo "Cannot kill $NAME (pid=$pid)!" exit 1 fi fi fi rm -f $PIDFILE } case "$1" in start) log_daemon_msg "Starting $DESC " "$NAME" if running ; then log_progress_msg "apparently already running" log_end_msg 0 exit 0 fi if start_server ; then [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time if running ; then log_end_msg 0 else log_end_msg 1 fi else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if running ; then errcode=0 stop_server || errcode=$? log_end_msg $errcode else log_progress_msg "apparently not running" log_end_msg 0 exit 0 fi ;; force-stop) $0 stop if running; then log_daemon_msg "Stopping (force) $DESC" "$NAME" errcode=0 force_stop || errcode=$? log_end_msg $errcode fi ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" errcode=0 stop_server || errcode=$? [ -n "$DIETIME" ] && sleep $DIETIME start_server || errcode=$? [ -n "$STARTTIME" ] && sleep $STARTTIME running || errcode=$? log_end_msg $errcode ;; status) status_of_proc -p $PIDFILE $DAEMON "stompserver" && exit 0 || exit $? ;; reload) log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon" log_warning_msg "cannot re-read the config file (use restart)." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 debian/stompserver.10000644000000000000000000001145611755015341011652 0ustar .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH STOMPSERVER "1" "July 2009" "stompserver" "User Commands" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME stompserver \- Stomp protocol messaging server .SH SYNOPSIS .B stompserver [\fIoptions\fR] .SH DESCRIPTION Stomp messaging server with file/dbm/memory/activerecord based FIFO queues, queue monitoring, and basic authentication. .SH OPTIONS .TP \fB\-C\fR, \fB\-\-config\fR=\fICONFIGFILE\fR Configuration File (default: stompserver.conf) .TP \fB\-p\fR, \fB\-\-port\fR=\fIPORT\fR Change the port (default: 61613) .TP \fB\-b\fR, \fB\-\-host\fR=\fIADDR\fR Change the host (default: localhost) .TP \fB\-q\fR, \fB\-\-queuetype\fR=\fIQUEUETYPE\fR Queue type (memory|dbm|activerecord|file) (default: memory) .TP \fB\-w\fR, \fB\-\-working_dir\fR=\fIDIR\fR Change the working directory (default: current directory) .TP \fB\-s\fR, \fB\-\-storage\fR=\fIDIR\fR Change the storage directory (default: .stompserver, relative to working_dir) .TP \fB\-d\fR, \fB\-\-debug\fR Turn on debug messages .TP \fB\-a\fR, \fB\-\-auth\fR Require client authorization .TP \fB\-c\fR, \fB\-\-checkpoint\fR=\fISECONDS\fR Time between checkpointing the queues in seconds (default: 0) .TP \fB\-h\fR, \fB\-\-help\fR Show this message .SH QUEUES Stompserver handles basic message queue processing using memory, file, or dbm based queues. Messages are sent and consumed in FIFO order (unless a client error happens, this should be corrected in the future). Topics are memory-only storage. You can select activerecord, file or dbm storage and the queues will use that, but topics will only be stored in memory. memory queues are of course the fastest ones but shouldn't be used if you want to ensure all messages are delivered. dbm queues will use berkeleydb if available, otherwise dbm or gdbm depending on the platform. sdbm does not work well with marshalled data. Note that these queues have not been tested in this release. For the file based storage, each frame is stored in a single file. The first 8 bytes contains the header length, the next 8 bytes contains the body length, then the headers are stored as a marshalled object followed by the body stored as a string. This storage is currently inefficient because queues are stored separately from messages, which forces a double write for data safety reasons on each message stored. The activerecord based storage expects to find a database.yml file in the configuration directory. It should be the most robust backend, but the slowest one. The database must have an ar_messages table which can be created with the following code (you are responsible to do so): ActiveRecord::Schema.define do create_table 'ar_messages' do |t| t.column 'stomp_id', :string, :null => false t.column 'frame', :text, :null => false end end You can read the frames with this model: class ArMessage < ActiveRecord::Base serialize :frame end The ar_message implementation will certainly change in the future. This is meant to be easily readable by a Rails application (which could handle the ar_messages table creation with a migration). .SH ACCESS CONTROL Basic client authorization is also supported. If the \-a flag is passed to stompserver on startup, and a .passwd file exists in the run directory, then clients will be required to provide a valid login and passcode. See passwd.example for the password file format. .SH MONITORING Queues can be monitored via the monitor queue (this will probably not be supported this way in the future to avoid polluting the queue namespace). If you subscribe to /queue/monitor, you will receive a status message every 5 seconds that displays each queue, it's size, frames enqueued, and frames dequeued. Stats are sent in the same format of stomp headers, so they are easy to parse. Following is an example of a status message containing stats for 2 queues: Queue: /queue/client2 size: 0 dequeued: 400 enqueued: 400 Queue: /queue/test size: 50 dequeued: 250 enqueued: 300 .SH AUTHOR stompserver was written by Patrick Hurley and Lionel Bouton. .PP This manual page was compiled from the included documentation by Bryan McLellan for the Debian project (and may be used by others). The existing documentation is distributed under the MIT license. debian/ruby-test-files.yaml0000644000000000000000000000013211755015341013106 0ustar --- - test/test_queue_manager.rb - test/test_stomp_frame.rb - test/test_topic_manager.rb debian/copyright0000644000000000000000000000373311755015341011131 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: stompserver Upstream-Contact: Lionel Bouton Source: http://rubyforge.org/projects/stompserver/ Files: * Copyright: 2006, Patrick Hurley 2007, Lionel Bouton License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Comment: Expat license referred to as MIT license Files: setup.rb Copyright: 2000-2004, Minero Aoki License: LGPL-2.1 This program is free software. You can distribute/modify this program under the terms of the GNU Lesser General Public License version 2.1. . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the file `/usr/share/common-licenses/LGPL-2.1'. Files: debian/* Copyright: 2009, Bryan McLellan 2012, Paul van Tilburg License: GPL-2 On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. debian/stompserver.postinst0000644000000000000000000000146611755015341013375 0ustar #!/bin/sh # postinst script for stompserver # # see: dh_installdeb(1) set -e case "$1" in configure) if [ -z "`getent passwd stompserver`" ]; then adduser --quiet --system --home /var/lib/stompserver --shell /bin/false \ --group --disabled-password --disabled-login --no-create-home \ --gecos "Stomp Server" stompserver fi chown stompserver:stompserver /var/lib/stompserver chown stompserver:stompserver /var/log/stompserver chown stompserver:stompserver /etc/stompserver ;; abort-upgrade|abort-remove|abort-deconfigure) ;; *) echo "postinst called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0 debian/control0000644000000000000000000000177212256653355010614 0ustar Source: stompserver Section: ruby Priority: optional Maintainer: Debian Ruby Extras Maintainers Uploaders: Bryan McLellan , Joshua Timberman , Paul van Tilburg Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.3.0~) Standards-Version: 3.9.5 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/stompserver.git Vcs-Browser: http://anonscm.debian.org/gitweb?p=pkg-ruby-extras/stompserver.git;a=summary Homepage: http://stompserver.rubyforge.org/ XS-Ruby-Versions: all Package: stompserver Architecture: all XB-Ruby-Versions: ${ruby:Versions} Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-daemons, ruby-eventmachine, adduser Description: stomp messaging server implemented in Ruby Stompserver is a stomp messaging server with support for multiple FIFO based queue backends including file, dbm, memory and activerecord. It supports basic authentication and queue monitoring. debian/stompserver.logrotate0000644000000000000000000000026011755015341013501 0ustar /var/log/stompserver/*log { missingok create 0644 stompserver stompserver compress rotate 12 weekly postrotate /etc/init.d/stompserver force-reload endscript } debian/stompserver.docs0000644000000000000000000000001311755015341012425 0ustar README.txt debian/patches/0000755000000000000000000000000012256653355010631 5ustar debian/patches/series0000644000000000000000000000013712256653355012047 0ustar remove_rubygems.patch fhs_paths.patch fix_storagedir.patch ruby19_20.patch ruby_hashbang.patch debian/patches/ruby19_20.patch0000644000000000000000000000336512256653355013315 0ustar Author: Timothy Redaelli Description: [PATCH] Adapt for ruby 1.9 Forwarded: not-needed Origin: https://github.com/drizzt/stompserver/commit/b2dd714f9bc6d7b831767cc0d45d7f00cae2bde5.patch --- lib/stomp_server/stomp_frame.rb | 6 +++--- test/test_topic_manager.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/stomp_server/stomp_frame.rb b/lib/stomp_server/stomp_frame.rb index 3833d98..b2cb950 100644 --- a/lib/stomp_server/stomp_frame.rb +++ b/lib/stomp_server/stomp_frame.rb @@ -10,7 +10,7 @@ def initialize(command=nil, headers=nil, body=nil) def to_s result = @command + "\n" - @headers['content-length'] = @body.size.to_s if @body.include?(0) + @headers['content-length'] = @body.size.to_s if @body.include?(0.chr) @headers.each_pair do |key, value| result << "#{key}:#{value}\n" end @@ -37,7 +37,7 @@ def initialize end def parse_body(len) - raise RuntimeError.new("Invalid stompframe (missing null term)") unless @buffer[len] == 0 + raise RuntimeError.new("Invalid stompframe (missing null term)") unless @buffer[len] == 0.chr @frame.body = @buffer[0...len] @buffer = @buffer[len+1..-1] @frames << @frame @@ -51,7 +51,7 @@ def parse_binary_body end def parse_text_body - if pos = @buffer.index(0) + if pos = @buffer.index(0.chr) parse_body(pos) end end diff --git a/test/test_topic_manager.rb b/test/test_topic_manager.rb index 152a577..1e23b6b 100644 --- a/test/test_topic_manager.rb +++ b/test/test_topic_manager.rb @@ -52,7 +52,7 @@ def test_unsubscribe assert_equal('', u.data) end - def test_sendmsg(msg) + def test_sendmsg u = UserMock.new t = 'foo' @t.subscribe(t, u) -- 1.8.4 debian/patches/ruby_hashbang.patch0000644000000000000000000000055212256653355014470 0ustar Author: Timothy Redaelli Forwarded: not-needed Origin: https://github.com/drizzt/stompserver/commit/1e8fd79acbc2ffb7cf99635a38a9ddb03bb1a5bc.patch Description: added Shebang into bin/stompserver --- a/bin/stompserver +++ b/bin/stompserver @@ -1,3 +1,5 @@ +#!/user/bin/env ruby + require 'etc' require 'yaml' require 'daemons/daemonize' debian/patches/remove_rubygems.patch0000644000000000000000000000254211755015341015055 0ustar # Description: Remove requirement of rubygems # Requiring RubyGems is discouraged by the Debian Ruby Extras team # per http://pkg-ruby-extras.alioth.debian.org/upstream-devs.html # Author: Bryan McLellan Index: stompserver-0.9.9/bin/stompserver =================================================================== --- stompserver-0.9.9.orig/bin/stompserver 2009-07-28 10:47:18.000000000 -0700 +++ stompserver-0.9.9/bin/stompserver 2009-07-28 10:47:26.000000000 -0700 @@ -1,4 +1,3 @@ -require 'rubygems' require 'etc' require 'yaml' require 'daemons/daemonize' Index: stompserver-0.9.9/lib/stomp_server.rb =================================================================== --- stompserver-0.9.9.orig/lib/stomp_server.rb 2009-07-28 10:47:37.000000000 -0700 +++ stompserver-0.9.9/lib/stomp_server.rb 2009-07-28 10:47:42.000000000 -0700 @@ -1,4 +1,3 @@ -require 'rubygems' require 'eventmachine' require 'stomp_server/stomp_frame' require 'stomp_server/stomp_id' Index: stompserver-0.9.9/lib/stomp_server/test_server.rb =================================================================== --- stompserver-0.9.9.orig/lib/stomp_server/test_server.rb 2009-07-28 10:47:48.000000000 -0700 +++ stompserver-0.9.9/lib/stomp_server/test_server.rb 2009-07-28 10:47:52.000000000 -0700 @@ -1,4 +1,3 @@ -require 'rubygems' require 'eventmachine' module StompServer debian/patches/fhs_paths.patch0000644000000000000000000000276611755015341013632 0ustar # Description: Check for absolute paths so we can enforce FHS in config. # No upstream patch/URL yet, will update package when one is open. # Author: Joshua Timberman --- a/lib/stomp_server.rb +++ b/lib/stomp_server.rb @@ -27,6 +27,7 @@ :working_dir => Dir.getwd, :storage => ".stompserver", :logdir => 'log', + :etcdir => 'etc', :configfile => 'stompserver.conf', :logfile => 'stompserver.log', :pidfile => 'stompserver.pid', @@ -62,11 +63,11 @@ opts = @defaults end - opts[:etcdir] = File.join(opts[:working_dir],'etc') - opts[:storage] = File.join(opts[:working_dir],opts[:storage]) - opts[:logdir] = File.join(opts[:working_dir],opts[:logdir]) - opts[:logfile] = File.join(opts[:logdir],opts[:logfile]) - opts[:pidfile] = File.join(opts[:logdir],opts[:pidfile]) + opts[:etcdir] = opts[:etcdir] =~ /^\// ? opts[:etcdir] : File.join(opts[:working_dir],opts[:etcdir]) + opts[:storage] = opts[:storage] =~ /^\// ? opts[:storage] : File.join(opts[:working_dir],opts[:storage]) + opts[:logdir] = opts[:logdir] =~ /^\// ? opts[:logdir] : File.join(opts[:working_dir],opts[:logdir]) + opts[:logfile] = opts[:logfile] =~ /^\// ? opts[:logfile] : File.join(opts[:logdir],opts[:logfile]) + opts[:pidfile] = opts[:pidfile] =~ /^\// ? opts[:pidfile] : File.join(opts[:logdir],opts[:pidfile]) if opts[:auth] opts[:passwd] = File.join(opts[:etcdir],'.passwd') end debian/patches/fix_storagedir.patch0000644000000000000000000000147511755015341014660 0ustar # Description: Bug in initialize won't create the storage dir in FHS compliant location # No upstream bug yet, will update the package when there is one. Index: stompserver-0.9.9/lib/stomp_server/queue/activerecord_queue.rb =================================================================== --- stompserver-0.9.9.orig/lib/stomp_server/queue/activerecord_queue.rb 2009-08-19 17:49:44.559625055 -0600 +++ stompserver-0.9.9/lib/stomp_server/queue/activerecord_queue.rb 2009-08-19 17:50:07.623903343 -0600 @@ -15,7 +15,7 @@ # Default configuration, use SQLite for simplicity db_params = { 'adapter' => 'sqlite3', - 'database' => "#{configdir}/stompserver_development" + 'database' => "#{storagedir}/stompserver_development" } # Load DB configuration db_config = "#{configdir}/database.yml" debian/compat0000644000000000000000000000000211755015341010366 0ustar 7 debian/stompserver.dirs0000644000000000000000000000007011755015341012441 0ustar var/log/stompserver var/lib/stompserver etc/stompserver debian/stompserver.conf0000644000000000000000000000044611755015341012434 0ustar --- :daemon: true :working_dir: /var/lib/stompserver :logdir: /var/log/stompserver :pidfile: /var/run/stompserver/pid :storage: /var/lib/stompserver/storage :etcdir: /etc/stompserver :queue: memory :auth: false :debug: false :group: stompserver :user: stompserver :host: 127.0.0.1 :port: 61613 debian/changelog0000644000000000000000000000464712256653355011067 0ustar stompserver (0.9.9gem-3) unstable; urgency=low * Team upload. [ Cédric Boutillier ] * debian/control: remove obsolete DM-Upload-Allowed flag * use canonical URI in Vcs-* fields [ Jonas Genannt ] * d/control: - bumped standards version to 3.9.5 - README.source no longer needed - changed ruby1.8 dependency to ruby | ruby-interpreter - changed Ruby-Versions to all * ruby_hashbang.patch: refreshed from upstream, added DEP-3 header (changed ruby1.8 into env ruby) * added patch for Ruby 1.9/2.0 support from Upstream (Closes: #730880) * d/stompserver.init updated init script - added DIETIME/STARTTIME (Closes: #576452) - updated status to lsb init function - added source of default/stompserver (LP: #704687) -- Jonas Genannt Sat, 30 Nov 2013 22:38:12 +0100 stompserver (0.9.9gem-2) unstable; urgency=low * Bumped build-dependency on gem2deb to >= 0.3.0~. -- Paul van Tilburg Tue, 26 Jun 2012 23:54:44 +0200 stompserver (0.9.9gem-1) unstable; urgency=low * Use upstream source from the gem rather than RubyForge. -- Paul van Tilburg Sat, 26 May 2012 00:42:45 +0200 stompserver (0.9.9-2) unstable; urgency=low * Source packages adapted according to the new Ruby policy: - Build for Ruby 1.8 only; there is no support for Ruby 1.9.1. - Migrated to pkg-ruby-extras git repos. Changed the Vcs-* fields in debian/control accordingly. - Changed the depends to follow the new Ruby library naming scheme. * debian/control: - Added a default DM-Upload-Allowed field set to yes. - Standards-Version bumped to 3.9.3; no changes required. - Set XS-Ruby-Versions to ruby1.8. - Changed the build-depends for using gem2deb instead of ruby-pkg-tools. - Switched the maintainer with the uploaders field as per new convention the team is the default maintainer. * debian/copyright: reworked to fit the Debian copyright format version 1.0. * debian/patches: refreshed patches to removed fuzz. * debian/watch: updated to use gemwatch instead Rubyforge. * debian/stompserver.init - Depend on $remote_fs instead of $local_fs. - Added a description. -- Paul van Tilburg Fri, 25 May 2012 22:57:44 +0200 stompserver (0.9.9-1) unstable; urgency=low * Initial release (Closes: #537410) -- Joshua Timberman Thu, 13 Aug 2009 12:25:59 -0600 debian/manpages0000644000000000000000000000002511760621111010675 0ustar debian/stompserver.1 debian/stompserver.examples0000644000000000000000000000005311755015341013317 0ustar config/stompserver.conf etc/passwd.example debian/stompserver.postrm0000644000000000000000000000073211755015341013031 0ustar #!/bin/sh # postrm script for stompserver # # see: dh_installdeb(1) set -e case "$1" in purge) rm -rf /etc/stompserver rm -rf /var/log/stompserver ;; remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; *) echo "postrm called with unknown argument \`$1'" >&2 exit 1 ;; esac # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0