Have you ever wished you could access your Amazon Simple Queue Service from the command line ? Now you can:


1 $ AWS_ACCESS_KEY_ID=<your access key>
2 $ AWS_SECRET_ACCESS_KEY="<the secret access key>"
3
4 $ clisqs create my-queue
5 Queue my-queue was created.
6
7 $ clisqs list
8 my-queue
9
10 $ clisqs push —data "this is the message" my-queue
11 Pushed 19 bytes to queue my-queue
12
13 $ cat README.txt | clisqs push my-queue
14 Pushed 2687 bytes to queue my-queue
15
16 $ clisqs push my-queue README.txt
17 Pushed 2687 bytes to queue my-queue
18
19 $ clisqs size my-queue
20 3
21
22 $ clisqs pop my-queue
23 this is the message
24
25 $ clisqs delete —force my-queue
26 Queue my-queue was deleted.

Installation


1 $ sudo gem install cliaws

Direct-code access


1 require "rubygems"
2 require "cliaws"
3
4 Cliaws.sqs.push("my-queue", "the data")
5 the_size = Cliaws.sqs.size("my-queue")
6 the_message = Cliaws.sqs.pop("my-queue")

S3 ?

This gem also works with S3. See my prior release announcement: Cliaws: command-line access to S3

I just released a new gem on RubyForge: cliaws. Using it, you have access to nice command line shortcuts:


1 $ AWS_ACCESS_KEY_ID=<your access key>
2 $ AWS_SECRET_ACCESS_KEY="<the secret access key>"
3 $ clis3 list BUCKET/PATH-PREFIX
4 $ clis3 put BUCKET/FULL/PATH/NAME /path/to/local/file
5 $ clis3 get BUCKET/FULL/PATH/NAME /path/to/local/file
6 $ clis3 cat BUCKET/FULL/PATH/NAME

This is not rocket science, but with the kind of work I’m doing at the moment, having quick command-line access to S3 is a boon.

Installation


1 $ gem install cliaws

Direct-code access


1 require "rubygems"
2 require "cliaws"
3
4 # Retrieve and store in a variable
5 value = Cliaws.s3.get("BUCKET/FULL/PATH/NAME")
6
7 # Retrieve and stream to specified file
8 File.open("/path/to/local/file", "w") do |f|
9 Cliaws.s3.get("BUCKET/FULL/PATH/NAME", f)
10 end
11
12 # Returns an Array of full names
13 contents = Cliaws.s3.list("BUCKET")

Repository

The repository is hosted on GitHub, with a mirror on RubyForge.

The repository’s URLs are:

Go forth and fork !

Well, with much more testing, I’m releasing another preview release of Piston. This release should import Subversion or Git repositories into Subversion or Git working copies just fine. There’s one slight problem, which is when you use piston import URL (without a target directory), it will import into a folder named repository, which isn’t what it’s supposed to do. I’m missing a couple of tests, is all.

How to grab this release ? Two ways:

  • git clone git://github.com/francois/piston.git
  • Grab a tarball

Once you have the code, run rake install_gem to install the gem. Enjoy !

I’m making it official. I’m releasing 1.9.0 today:

http://github.com/francois/piston/tree/1.9.0

I’ll put up a gem tomorrow, but if you want to play with Piston now, the best way is to either clone the repository, or grab a tarball directly from GitHub.

What’s implemented in this release ?

  • piston import

But you can import from either SVN or Git, into either SVN or Git. All Piston metadata is stored in a .piston.yml file in the pistonized dir’s root.

If you have questions, problems, comments, go ahead and comment right here, or use Piston’s tracker

Well, thanks to Graeme Mathieson, Piston finally sports a piston diff subcommand. This command allows you to know what changes you made vs what’s in the remote repository.

As usual, installation is pretty simple:


1 $ gem install piston

What does piston diff report ? Here it is:


1 $ piston help diff
2 diff: Shows the differences between the local repository and the pristine upstream
3 usage: diff [DIR […]]
4
5 This operation has the effect of producing a diff between the pristine upstream
6 (at the last updated revision) and your local version. In other words, it
7 gives you the changes you have made in your repository that have not been
8 incorporated upstream.
9
10 Valid options:
11 v, —verbose Show subversion commands and results as they are executed
12 -q, —quiet Do not output any messages except errors
13 -r, —revision=REVISION
14 -u, —show-updates Query the remote repository for out of dateness information
15 -l, —lock Close down and lock the imported directory from further changes
16 —dry-run Does not actually execute any commands
17 —force Force the command to run, even if Piston thinks it would cause a problem
18
19 $ piston diff vendor/rails
20 Processing ‘vendor/rails’…
21 Fetching remote repository’s latest revision and UUID
22 Checking out repository at revision 8784
23 diff -urN —exclude=.svn vendor/rails.tmp/actionmailer/lib/action_mailer/base.rb vendor/rails/actionmailer/lib/action_mailer/base.rb
24 -
- vendor/rails.tmp/actionmailer/lib/action_mailer/base.rb 2008-02-08 22:38:25.000000000 -0500
25 + vendor/rails/actionmailer/lib/action_mailer/base.rb 2008-01-11 17:05:42.000000000 -0500
26 @ -348,7 +348,7 @
27 # end
28 # end
29 def receive(raw_email)
30 – logger.info "Received mail:\n #{raw_email}" unless logger.nil?
31 + logger.debug "Received mail:\n #{raw_email}" unless logger.nil?
32 mail = TMail::Mail.parse(raw_email)
33 mail.base64_decode
34 new.receive(mail)
35 @ -445,7 +445,7 @
36 # no alternate has been given as the parameter, this will fail.
37 def deliver!(mail = @mail)
38 raise "no mail object available for delivery!" unless mail
39 – logger.info "Sent mail:\n #{mail.encoded}" unless logger.nil?
40 + logger.debug "Sent mail:\n #{mail.encoded}" unless logger.nil?
41
42 begin
43 send("perform_delivery_#{delivery_method}", mail) if perform_deliveries

Caveat: piston diff uses the command line version of diff. This means Windows users will need to install a compatible version, or write a wrapper script around some preferred tool that supports the same features.

What is Piston ?

Piston is a utility that eases vendor branch management. This is similar to svn:externals, except you have a local copy of the files, which you can modify at will. As long as the changes are mergeable, you should have no problems.

Visit Piston’s home page at http://piston.rubyforge.org/

Search

Your Host

A picture of me

I am François Beausoleil, a Ruby on Rails and Scala developer. During the day, I work on Seevibes, a platform to measure social interactions related to TV shows. At night, I am interested many things. Read my biography.

Top Tags

Books I read and recommend

Links

Projects I work on

Projects I worked on