aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rwxr-xr-xbin/mauveclient42
-rwxr-xr-xbin/mauveconsole42
-rwxr-xr-xbin/mauveserver43
-rw-r--r--debian/changelog6
-rw-r--r--debian/mauvealert-common.install1
-rw-r--r--debian/mauvealert-server.links1
-rw-r--r--debian/mauvealert-server.manpages2
-rw-r--r--lib/mauve/version.rb5
9 files changed, 113 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 3776678..b412315 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ man:
mkdir -p man
man/%.1: bin/%
- ruby -I lib $< --help | txt2man -t $(notdir $<) -s 1 > $@
+ ruby -I lib $< --manual | txt2man -t $(notdir $<) -s 1 > $@
clean:
$(RM) -r man
diff --git a/bin/mauveclient b/bin/mauveclient
index e3bc453..12747fa 100755
--- a/bin/mauveclient
+++ b/bin/mauveclient
@@ -4,6 +4,7 @@
#
# SYNOPSIS
# mauveclient [<destination>]
+# [ --help | -h ] [ --manual | -m ] [ --version | -V ]
# [--source | -o <source>] [--replace | -p] [--verbose | -v]
# [--id <alertid> ... ]
#
@@ -40,6 +41,12 @@
# specify it twice, it will print the entire data
# structure.
#
+# --help, -h Display a short help message, and exit.
+#
+# --manual, -m Display this manual, and exit.
+#
+# --version, -V Display the version number for Mauve and exit.
+#
# You can specify any number of alerts in an update - every time you specify
# --id starts a new alert.
#
@@ -67,7 +74,6 @@
# no time is specified, "now" is assumed. See
# SPECIFYING TIMES below for the format of <time>.
#
-#
# SPECIFYING TIMES
#
# Times can be specified for an alert to be raised or cleared. This can be
@@ -155,7 +161,7 @@ require 'getoptlong'
require 'mauve/sender'
require 'mauve/proto'
require 'mauve/mauve_time'
-require 'pp'
+require 'mauve/version'
NOW = Mauve::MauveTime.now
@@ -205,9 +211,13 @@ begin
message = nil
verbose = 0
help = false
+ manual = false
+ version = false
opts = GetoptLong.new(
['-h', '--help', GetoptLong::NO_ARGUMENT],
+ ['-m', '--manual', GetoptLong::NO_ARGUMENT],
+ ['-V', '--version', GetoptLong::NO_ARGUMENT],
['-o', '--source', GetoptLong::OPTIONAL_ARGUMENT],
['-p', '--replace', GetoptLong::NO_ARGUMENT],
['-i', '--id', GetoptLong::OPTIONAL_ARGUMENT],
@@ -222,11 +232,15 @@ begin
#
# Can catch empty arguments better if we set the GetoptLong things to
# "optional" rather than "required" and catch the empty arg here.
- error "#{opt} cannot be empty" if arg.empty? and not %w(-h -p -v -c -r).include?(opt)
+ error "#{opt} cannot be empty" if arg.empty? and not %w(-h -m -V -p -v -c -r).include?(opt)
case opt
when '-h'
help = true
+ when '-m'
+ manual = true
+ when '-V'
+ version = true
when '-p'
update.replace = true
when '-i'
@@ -255,19 +269,33 @@ begin
# CAUTION! Kwality kode.
#
- if help
+ if manual or help
# Open the file, stripping the shebang line
lines = File.open(__FILE__){|fh| fh.readlines}[1..-1]
+ found_synopsis = false
+
lines.each do |line|
- line.chomp!
+
+ line.chomp!
break if line.empty?
+
+ if help and !found_synopsis
+ found_synopsis = (line =~ /^#\s+SYNOPSIS\s*$/) if !found_synopsis
+ next
+ end
+
puts line[2..-1].to_s
- end
- exit 0
+ break if help and found_synopsis and line =~ /^#\s*$/
+
+ end
end
+ puts "#{$0}: version "+Mauve::VERSION if version
+
+ exit 0 if help or version or manual
+
error "No alerts specified" unless !update.alert.empty? || update.replace
update.transmission_id = rand(2**63)
diff --git a/bin/mauveconsole b/bin/mauveconsole
index 5a16a7e..c9a4656 100755
--- a/bin/mauveconsole
+++ b/bin/mauveconsole
@@ -1,26 +1,26 @@
#!/usr/bin/ruby1.8
# NAME
-#
# mauveconsole -- Ruby console to query the mauvealert server directly
#
# SYNOPSIS
-#
-# mauveconsole [-h | --help] [<configuration file>]
+# mauveconsole [-h | --help] [-V | --version] [-m | --manual] [<configuration file>]
#
# OPTIONS
-#
-# -h, --help Show a help message
-# <configuration file> File to load the configuration from. If none is
+# -h, --help Show a help message, and exit
+#
+# -m, --manual Show this manual, and exit
+#
+# -V, --version Show the version number, and exit
+#
+# <configuration file> File from whence to load the configuration. If none is
# specified, then mauvealert.conf in the current
# directory is used, and failing that
# /etc/mauvealert/mauvealert.conf is used.
#
# SEE ALSO
-#
# irb(1), mauveserver(1), mauveclient(1)
#
# AUTHOR
-#
# Patrick J Cherry <patrick@bytemark.co.uk>
#
@@ -30,21 +30,39 @@ def error(msg)
exit 1
end
+help = ARGV.any?{|a| a =~ /-(h|-help)/}
+version = ARGV.any?{|a| a =~ /-(V|-version)/}
+manual = ARGV.any?{|a| a =~ /-(m|-manual)/}
+
# CAUTION! Kwality kode.
#
-if ARGV.any?{|a| a =~ /--?h(elp)?/}
+if manual or help
# Open the file, stripping the shebang line
lines = File.open(__FILE__){|fh| fh.readlines}[1..-1]
+ found_synopsis = false
+
lines.each do |line|
- line.chomp!
+ line.chomp!
break if line.empty?
+
+ if help and !found_synopsis
+ found_synopsis = (line =~ /^#\s+SYNOPSIS\s*$/) if !found_synopsis
+ next
+ end
+
puts line[2..-1].to_s
- end
- exit 0
+ break if help and found_synopsis and line =~ /^#\s*$/
+ end
end
+require 'mauve/version'
+
+puts "#{$0}: version "+Mauve::VERSION if version
+
+exit 0 if help or version or manual
+
configuration_file = ARGV.shift
configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join("mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
configuration_file = File.expand_path(configuration_file)
diff --git a/bin/mauveserver b/bin/mauveserver
index 4ac5a6d..9d1cf53 100755
--- a/bin/mauveserver
+++ b/bin/mauveserver
@@ -1,24 +1,26 @@
#! /usr/bin/ruby1.8
# NAME
-#
# mauveserver -- receive alerts from station(s) around the network
#
# SYNOPSIS
-#
-# mauveserver [ -h | --help ] [<configuration file>]
+# mauveserver [ -h | --help ] [-m | --manual] [-V | --version] [<configuration file>]
#
# OPTIONS
+# -h, --help Show a help message, and exit.
#
-# -h, --help Show a help message
+# -V, --version Show the version, and exit.
#
-# <configuration file> File to load the configuration from
+# -m, --manual Show this manual, and exit.
+#
+# <configuration file> File from whence to load the configuration. If none is
+# specified, then mauvealert.conf in the current
+# directory is used, and failing that
+# /etc/mauvealert/mauvealert.conf is used.
#
# SEE ALSO
-#
# mauveclient(1), mauveconsole(1)
#
# AUTHOR
-#
# Patrick J Cherry <patrick@bytemark.co.uk>
#
@@ -34,21 +36,40 @@ rescue SyntaxError => no_blocks_with_procs
error "mauveserver must have Ruby 1.8.7 or later"
end
+help = ARGV.any?{|a| a =~ /-(h|-help)/}
+version = ARGV.any?{|a| a =~ /-(V|-version)/}
+manual = ARGV.any?{|a| a =~ /-(m|-manual)/}
+
+#
# CAUTION! Kwality kode.
#
-if ARGV.any?{|a| a =~ /--?h(elp)?/}
+if manual or help
# Open the file, stripping the shebang line
lines = File.open(__FILE__){|fh| fh.readlines}[1..-1]
+ found_synopsis = false
lines.each do |line|
- line.chomp!
+
+ line.chomp!
break if line.empty?
+
+ if help and !found_synopsis
+ found_synopsis = (line =~ /^#\s+SYNOPSIS\s*$/) if !found_synopsis
+ next
+ end
+
puts line[2..-1].to_s
- end
- exit 0
+ break if help and found_synopsis and line =~ /^#\s*$/
+
+ end
end
+require 'mauve/version'
+
+puts "#{$0}: version "+Mauve::VERSION if version
+
+exit 0 if help or version or manual
configuration_file = ARGV.shift
configuration_file = [".", "/etc/mauvealert/"].collect{|x| File.join("mauveserver.conf") }.find{|d| File.file?(d)} if configuration_file.nil?
diff --git a/debian/changelog b/debian/changelog
index 88f6d71..8c34394 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+mauvealert (3.1.0) stable; urgency=low
+
+ * New version.
+
+ -- Patrick J Cherry <patrick@bytemark.co.uk> Fri, 15 Jul 2011 14:03:15 +0100
+
mauvealert (3.0.6) stable; urgency=low
* Reminders to peple lists now work.
diff --git a/debian/mauvealert-common.install b/debian/mauvealert-common.install
index 99771ab..b98b3cf 100644
--- a/debian/mauvealert-common.install
+++ b/debian/mauvealert-common.install
@@ -1,5 +1,6 @@
mauve.proto usr/lib/mauvealert/
lib/mauve/proto.rb usr/lib/ruby/1.8/mauve/
lib/mauve/mauve_time.rb usr/lib/ruby/1.8/mauve/
+lib/mauve/version.rb usr/lib/ruby/1.8/mauve/
diff --git a/debian/mauvealert-server.links b/debian/mauvealert-server.links
new file mode 100644
index 0000000..bc1cdbe
--- /dev/null
+++ b/debian/mauvealert-server.links
@@ -0,0 +1 @@
+usr/share/javascript/jquery usr/share/mauvealert/static/javascript/jquery
diff --git a/debian/mauvealert-server.manpages b/debian/mauvealert-server.manpages
new file mode 100644
index 0000000..5d0c618
--- /dev/null
+++ b/debian/mauvealert-server.manpages
@@ -0,0 +1,2 @@
+man/mauveserver.1
+man/mauveconsole.1
diff --git a/lib/mauve/version.rb b/lib/mauve/version.rb
new file mode 100644
index 0000000..361b239
--- /dev/null
+++ b/lib/mauve/version.rb
@@ -0,0 +1,5 @@
+module Mauve
+
+ VERSION="3.1.0"
+
+end