A pastie is a snippet of text/code stored on a single webpage. This makes it very easy to share the text over IM or IRC - you just copy+paste the url. As a bonus, pasties are syntax highlighted making them easier to read than if shared as plain text.
The pastiepacker is a command-line tool to “pack” a selection of files (or by default, a whole recursive folder of files) into a single pastie. So a whole/part of a project can be quickly shared.
It can also “unpack” a packed pastie back into files. The pastiepacker is therefore a simple, useful distributed archiving tool, using pasties for storage.
For example, this pastie http://pastie.caboo.se/175886 shows a selection of files packed into a pastie. It just happens to be the source for pastiepacker itself! (release 1.0.0)
You can pack a whole folder or a selection of files. Any README/readme. files are placed at the front of the pastie, because that seems helpful. The packed pasties include information on how to unpack the pastie back into raw files.
Only ascii files are packed.
sudo gem install pastiepacker
The basics: packing files into a pastie
To pack a folder:
To only pack a selection of files ending with txt you can pass a list of file names via STDIN:
find * | grep "txt$" | pastiepacker
pastiepacker* outputs the url of the prepared pastie, so you can pipe it to xargs:
pastiepacker | xargs open
If the selection of files (within the current folder or the selection of files via STDIN) contains a readme file (readme.txt, README.txt, README.markdown, etc), that file will be packed at the top of the pastie, for the convenience of readers.
The basics: unpacking pasties into files
To unpack a packed pastie:
This unpacks the files into a subfolder 175138/
To unpack a private pastie:
This unpacks the files into a subfolder 5hwfheniddqmyasmfcxaw/
How to submit patches
The source for the Pastie Packer is available via git.
git clone git://github.com/drnic/pastie-packer.git pastiepacker cd pastiepacker rake install_gem
It is also available via rubyforge.org:
git clone git://rubyforge.org/pastiepacker.git cd pastiepacker rake install_gem
Or, you can unpack the 1.0.0 release of the pastiepacker from its own pastie!
This code is free to use under the terms of the MIT license.