Initial checkin 0.1
authorMichael Prokop <mika@grml.org>
Thu, 13 Dec 2007 10:36:06 +0000 (11:36 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 13 Dec 2007 10:36:06 +0000 (11:36 +0100)
Makefile [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/rules [new file with mode: 0755]
grml-paste [new file with mode: 0755]
grml-paste.1.txt [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..33e6fe9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+%.html : %.txt ;
+       asciidoc -b xhtml11 $^
+
+%.gz : %.txt ;
+       asciidoc -d manpage -b docbook $^
+       #sed -i 's/<emphasis role="strong">/<emphasis role="bold">/g' `echo $^ |sed -e 's/.txt/.xml/'`
+       xsltproc -nonet /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl `echo $^ |sed -e 's/.txt/.xml/'` &>/dev/null
+       # ugly hack to avoid '.sp' at the end of a sentence or paragraph:
+       sed -i 's/\.sp//' `echo $^ |sed -e 's/.txt//'`
+       gzip -f --best `echo $^ |sed -e 's/.txt//'`
+
+MANPAGES = grml-paste.1
+
+all: doc
+
+doc: doc_man doc_html
+doc_html: $(addsuffix .html, $(MANPAGES))
+doc_man: $(addsuffix .gz, $(MANPAGES))
+
+clean:
+       @for i in $(MANPAGES); do \
+               rm -f $$i.html $$i.xml $$i.gz; done
+
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..2ade598
--- /dev/null
@@ -0,0 +1,6 @@
+grml-paste (0.1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Michael Prokop <mika@grml.org>  Thu, 13 Dec 2007 11:17:35 +0100
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..48488d3
--- /dev/null
@@ -0,0 +1,16 @@
+Source: grml-paste
+Section: utils
+Priority: extra
+Maintainer: Michael Prokop <mika@grml.org>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+Homepage: http://hg.grml.org/grml-paste/
+XS-Vcs-hg: http://hg.grml.org/grml-paste/
+XS-Vcs-Browser: http://hg.grml.org/grml-paste/
+
+Package: grml-paste
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby
+Description: command line interface for paste.grml.org
+ grml-paste is a command line interface for uploading
+ plain text to  http://paste.grml.org/
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..641fc01
--- /dev/null
@@ -0,0 +1,30 @@
+This package was debianized by Michael Prokop <mika@grml.org> on
+Thu, 13 Dec 2007 11:17:35 +0100.
+
+It was downloaded from http://grml.org/
+
+Upstream Author: Nico Golde <nico@grml.org>
+
+Copyright: grml-team (grml.org), (c) 2007 Nico Golde <nico@grml.org>
+
+License:
+
+   This package is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This package is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this package; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2007, Michael Prokop <mika@grml.org> and
+is licensed under the GPL, see above.
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..1344198
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+build: build-stamp
+
+build-stamp:
+       dh_testdir
+       $(MAKE)
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       -$(MAKE) clean
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs usr/bin
+
+       install -m 755 grml-paste debian/grml-paste/usr/bin/grml-paste
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_installman grml-paste.1.gz
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/grml-paste b/grml-paste
new file mode 100755 (executable)
index 0000000..d4b7fb6
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/env ruby
+# Filename:      grml-paste
+# Purpose:       paste files to the online grml paste bot
+# Authors:       grml-team (grml.org), (c) 2007 Nico Golde <nico@grml.org>
+# Bug-Reports:   see http://grml.org/bugs/
+# License:       This file is licensed under the GPL v2
+##########################################################################
+
+require 'uri'
+require 'net/http'
+
+url = URI.parse('http://paste.grml.org/paste')
+
+def usage
+       $stderr.puts "usage: #{$0} [-n nick] [-s summary] [-f source] [-h|--help]\n"
+       $stderr.puts "\t -n <nick>\tset your nickname (defaults to Anonymuos)"
+       $stderr.puts "\t -s <summary>\tspecify a summary of your paste (defaults to none)"
+       $stderr.puts "\t -f <source>\tsets the file to read from, you don't need this for reading from stdin"
+       $stderr.puts "\t --help\t\tprint this help"
+       Kernel.exit(1)
+end
+
+file    = nil
+summary = "none"
+nick    = "Anonymous"
+channel = "#grml"
+text    = ""
+
+ARGV.each_index do |i|
+       if ARGV[i] == '-h' or ARGV[i] == '--help' then
+               usage
+       elsif ARGV[i] == '-n' and ARGV[i+1] != nil then
+               nick = ARGV[i+1]
+       elsif ARGV[i] == '-s' and ARGV[i+1] != nil then
+               summary = ARGV[i+1]
+       elsif ARGV[i] == '-f' and ARGV[i+1] != nil then
+               file = ARGV[i+1]
+       end
+end
+
+if file == nil or file == "-"
+       f = STDIN
+else
+       begin
+               f = File.open(file)
+       rescue
+               $stderr.puts "Error: couldn't open file: #{file}"
+               Kernel.exit(1)
+       end
+end
+
+f.each_line do |line|
+       text << line
+end
+
+begin
+       res = Net::HTTP.post_form(url,{'Paste it' => 'Paste it', 'paste' => text, 'channel' => channel,  'summary' => summary, 'nick' => nick})
+rescue
+       $stderr.puts "Unable to post HTTP request"
+       Kernel.exit(1)
+end
+
+results = res.body.scan(/<a href='http:\/\/paste.grml.org\/[0-9]+'/)
+result = ""
+if results.size > 0 then
+       result = results[0].sub(/<a href='(http:\/\/paste.grml.org\/[0-9]+)'/, '\1')
+end
+
+if result == "" then
+       print "Failed to paste, please retry\n"
+else
+       print "You can find your paste on: " + result + "\n"
+end
+
+## END OF FILE #################################################################
diff --git a/grml-paste.1.txt b/grml-paste.1.txt
new file mode 100644 (file)
index 0000000..8eae3ff
--- /dev/null
@@ -0,0 +1,42 @@
+grml-paste(1)
+=============
+
+Name
+----
+grml-paste - command line interface for paste.grml.org
+
+Synopsis
+--------
+grml-paste [-n nick] [-s summary] [-f source] [-h|--help]
+
+Description
+-----------
+
+grml-paste is a command line interface for uploading plain text to http://paste.grml.org/
+
+Options
+-------
+
+  -n **nick**::
+
+Set your nickname (defaults to Anonymous).
+
+  -s **summary**::
+
+Specify a summary of your paste (defaults to none).
+
+  -f *source**::
+
+Sets the file to read from, use - to read from stdin.
+
+  --help::
+
+Print help text.
+
+Bugs
+----
+Please report feedback, link:http://grml.org/bugs/[bugreports] and wishes link:http://grml.org/contact/[to us]!
+
+Authors
+-------
+Nico Golde <nico@grml.org>