cliaws 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.1.0 2008-04-17
2
+
3
+ * Implemented sqs command-line client.
4
+ * Cliaws::S3#get either returns the data, or writes the data to it's +dest+ parameter.
5
+
1
6
  == 1.0.0 2008-04-12
2
7
 
3
8
  * Implemented s3 command-line client.
data/Manifest.txt CHANGED
@@ -5,10 +5,12 @@ Manifest.txt
5
5
  README.txt
6
6
  Rakefile
7
7
  bin/clis3
8
+ bin/clisqs
8
9
  config/hoe.rb
9
10
  config/requirements.rb
10
11
  lib/cliaws.rb
11
12
  lib/cliaws/s3.rb
13
+ lib/cliaws/sqs.rb
12
14
  lib/cliaws/version.rb
13
15
  log/.gitignore
14
16
  script/console
data/bin/clisqs ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Created on 2008-4-12.
4
+ # Copyright (c) 2008. All rights reserved.
5
+
6
+ begin
7
+ require 'rubygems'
8
+ rescue LoadError
9
+ # no rubygems to load, so we fail silently
10
+ end
11
+
12
+ require "main"
13
+ require "cliaws"
14
+
15
+ Main {
16
+ mixin(:qname) do
17
+ argument("queue_name") do
18
+ required
19
+ argument_required
20
+ end
21
+ end
22
+
23
+ mode("create") do
24
+ mixin :qname
25
+ description "Create a new queue"
26
+ def run
27
+ Cliaws.sqs.create(queue_name)
28
+ puts "Queue #{queue_name} was created."
29
+ end
30
+ end
31
+
32
+ mode("delete") do
33
+ mixin :qname
34
+ description "Deletes a queue"
35
+ option("force") { cast :boolean; default false }
36
+ def run
37
+ Cliaws.sqs.delete(queue_name, params["force"].value)
38
+ puts "Queue #{queue_name} was deleted."
39
+ end
40
+ end
41
+
42
+ mode("list") do
43
+ description "Lists the available queues"
44
+ def run
45
+ puts Cliaws.sqs.list
46
+ end
47
+ end
48
+
49
+ mode("size") do
50
+ mixin :qname
51
+ description "Prints the queue's size."
52
+ def run
53
+ puts Cliaws.sqs.size(queue_name)
54
+ end
55
+ end
56
+
57
+ mode("receive") do
58
+ mixin :qname
59
+ description "Receive (but keep) a message from the named queue."
60
+ def run
61
+ puts Cliaws.sqs.receive(queue_name)
62
+ end
63
+ end
64
+
65
+ mode("pop") do
66
+ mixin :qname
67
+ description "Retrieve and delete a message from the named queue."
68
+ def run
69
+ puts Cliaws.sqs.pop(queue_name)
70
+ end
71
+ end
72
+
73
+ mode("send") do
74
+ mixin :qname
75
+ option("data") { optional; argument_required }
76
+ argument("data_file") { optional; argument_required }
77
+ description "Sends data from --data, data_file or STDIN to the named queue."
78
+ def run
79
+ data = case
80
+ when params["data"].given?
81
+ params["data"].value
82
+ when params["data_file"].given?
83
+ File.read(params["data_file"].value)
84
+ else
85
+ STDIN.read
86
+ end
87
+ Cliaws.sqs.send(queue_name, data)
88
+ puts "Pushed #{data.size} bytes to queue #{queue_name}"
89
+ end
90
+ end
91
+
92
+ def queue_name
93
+ params["queue_name"].value
94
+ end
95
+ }
data/lib/cliaws/sqs.rb ADDED
@@ -0,0 +1,50 @@
1
+ require "right_aws"
2
+ require "activesupport"
3
+
4
+ module Cliaws
5
+ class Sqs
6
+ def initialize(access_key_id, secret_access_key)
7
+ @sqs = RightAws::Sqs.new(access_key_id, secret_access_key, :logger => Logger.new("/dev/null"))
8
+ end
9
+
10
+ # Gets a message from the queue, but doesn't delete it.
11
+ def receive(qname)
12
+ q(qname).receive(qname).to_s
13
+ end
14
+
15
+ # Adds a message in the queue.
16
+ def send(qname, data)
17
+ q(qname).push(data)
18
+ end
19
+
20
+ # Gets and deletes message.
21
+ def pop(qname)
22
+ q(qname).pop.to_s
23
+ end
24
+
25
+ # Returns the size of the queue.
26
+ def size(qname)
27
+ q(qname).size
28
+ end
29
+
30
+ # Lists the created queues.
31
+ def list(prefix=nil)
32
+ @sqs.queues(prefix).map(&:name)
33
+ end
34
+
35
+ # Creates a queue
36
+ def create(qname)
37
+ q(qname, true)
38
+ end
39
+
40
+ # Deletes a queue. +force+ must be true to delete a queue with pending messages.
41
+ def delete(qname, force=false)
42
+ q(qname).delete(force)
43
+ end
44
+
45
+ protected
46
+ def q(qname, create=false)
47
+ @sqs.queue(qname, create)
48
+ end
49
+ end
50
+ end
@@ -1,7 +1,7 @@
1
1
  module Cliaws #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
data/lib/cliaws.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
2
 
3
3
  require "cliaws/s3"
4
+ require "cliaws/sqs"
4
5
 
5
6
  module Cliaws
6
7
  def self.access_key_id
@@ -14,4 +15,8 @@ module Cliaws
14
15
  def self.s3
15
16
  @@s3 ||= Cliaws::S3.new(access_key_id, secret_access_key)
16
17
  end
18
+
19
+ def self.sqs
20
+ @@sqs ||= Cliaws::Sqs.new(access_key_id, secret_access_key)
21
+ end
17
22
  end
data/website/index.html CHANGED
@@ -1,93 +1,11 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <title>
8
- cliaws
9
- </title>
10
- <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
- <style>
12
-
13
- </style>
14
- <script type="text/javascript">
15
- window.onload = function() {
16
- settings = {
17
- tl: { radius: 10 },
18
- tr: { radius: 10 },
19
- bl: { radius: 10 },
20
- br: { radius: 10 },
21
- antiAlias: true,
22
- autoPad: true,
23
- validTags: ["div"]
24
- }
25
- var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
- versionBox.applyCornersToAll();
27
- }
28
- </script>
29
- </head>
30
- <body>
31
- <div id="main">
32
-
33
- <h1>cliaws</h1>
34
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/cliaws"; return false'>
35
- <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/cliaws" class="numbers">1.0.0</a>
37
- </div>
38
- <h1>&#x2192; &#8216;cliaws&#8217;</h1>
39
-
40
-
41
- <h2>What</h2>
42
-
43
-
44
- <h2>Installing</h2>
45
-
46
-
47
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">cliaws</span></pre></p>
48
-
49
-
50
- <h2>The basics</h2>
51
-
52
-
53
- <h2>Demonstration of usage</h2>
54
-
55
-
56
- <h2>Forum</h2>
57
-
58
-
59
- <p><a href="http://groups.google.com/group/cliaws">http://groups.google.com/group/cliaws</a></p>
60
-
61
-
62
- <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; cliaws</p>
63
-
64
-
65
- <h2>How to submit patches</h2>
66
-
67
-
68
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
69
-
70
-
71
- <p>The trunk repository is <code>svn://rubyforge.org/var/svn/cliaws/trunk</code> for anonymous access.</p>
72
-
73
-
74
- <h2>License</h2>
75
-
76
-
77
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
78
-
79
-
80
- <h2>Contact</h2>
81
-
82
-
83
- <p>Comments are welcome. Send an email to <a href="mailto:FIXME"><span class="caps">FIXME</span> full name</a> email via the <a href="http://groups.google.com/group/cliaws">forum</a></p>
84
- <p class="coda">
85
- <a href="FIXME email">FIXME full name</a>, 12th April 2008<br>
86
- Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
87
- </p>
88
- </div>
89
-
90
- <!-- insert site tracking codes here, like Google Urchin -->
91
-
92
- </body>
93
- </html>
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title>cliaws</title>
5
+
6
+ </head>
7
+ <body id="body">
8
+ <p>This page has not yet been created for RubyGem <code>cliaws</code></p>
9
+ <p>To the developer: To generate it, update website/index.txt and run the rake task <code>website</code> to generate this <code>index.html</code> file.</p>
10
+ </body>
11
+ </html>
data.tar.gz.sig CHANGED
@@ -1 +1 @@
1
- N*.�y�P���v����U+^��v��zK4��T<?4��R�'&2w#�:��/�Ȩ2p�RW��1Q�z<d�/�hKB ���R~<����x)��1D���ql sP5���П�&X_49��"Y-G d�"U��!��p{�’�0W4���8u��KH�u�������� ��/R���A�)}��$�d�.�^��bp��%�?�a6��<8{� e H'��>g�^���f���X�Ь;W vgo
1
+ C�¡䵠��z��S��R��#�97y��7����m>CR� 1-�+�Sm�3O!yJ0��}S_��ye�ύ��}2p����՜�^8r|�t�-�?�^��"+ 8%��8�(��U�^���z�Bu��j���_Um�z2f���YL�LBeY�?�2DËM�-��^��K5�V[�����+�e�����w���:e�����d�ƘJP��C?��,JYcH(��c� ��6Îj�l�X�E%]��1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliaws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fran\xC3\xA7ois Beausoleil"
@@ -30,7 +30,7 @@ cert_chain:
30
30
  DdYn10CtfIKBFg==
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2008-04-14 00:00:00 -04:00
33
+ date: 2008-04-17 00:00:00 -04:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -65,6 +65,7 @@ email:
65
65
  - francois@teksol.info
66
66
  executables:
67
67
  - clis3
68
+ - clisqs
68
69
  extensions: []
69
70
 
70
71
  extra_rdoc_files:
@@ -81,10 +82,12 @@ files:
81
82
  - README.txt
82
83
  - Rakefile
83
84
  - bin/clis3
85
+ - bin/clisqs
84
86
  - config/hoe.rb
85
87
  - config/requirements.rb
86
88
  - lib/cliaws.rb
87
89
  - lib/cliaws/s3.rb
90
+ - lib/cliaws/sqs.rb
88
91
  - lib/cliaws/version.rb
89
92
  - log/.gitignore
90
93
  - script/console
metadata.gz.sig CHANGED
Binary file