cliaws 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +2 -0
- data/bin/clisqs +95 -0
- data/lib/cliaws/sqs.rb +50 -0
- data/lib/cliaws/version.rb +1 -1
- data/lib/cliaws.rb +5 -0
- data/website/index.html +11 -93
- data.tar.gz.sig +1 -1
- metadata +5 -2
- metadata.gz.sig +0 -0
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
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
|
data/lib/cliaws/version.rb
CHANGED
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
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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>→ ‘cliaws’</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> – create Google Group – 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’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
|
-
|
1
|
+
C�¡䵠��z��S��R��#�97y��7����m>CR� �1-�+�Sm�3O!yJ0��}S_��ye�ύ��}2p����՜�^8�r|�t�-�?�^��"+ 8%��8�(��U�^���z�Bu��j���_Um�z2f���Y�L�LBeY�?�2�DËM�-��^��K�5�V[�����+�e�����w���:e�����d�ƘJ�P��C?��,J�Yc�H(��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.
|
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-
|
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
|