laboristo 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3733281eacf2c77397c8e7f452273bfb33e852bc
4
- data.tar.gz: efdd5e9f806e245917c28339ada758b331f0821f
3
+ metadata.gz: 17f08dc40db63489c80c5c3eb1bcf63f0b5fe5c0
4
+ data.tar.gz: eb280e7db9e83c62050f38acbbbd59d64d48eb5a
5
5
  SHA512:
6
- metadata.gz: 9ed914bf20b5799719c6e569f1845a9061bc78c52935065cc7bf63bd12d596f6fa11838bde6786af7e826a103e9e4702771d835fba1d2e7d05746e4cb77feeea
7
- data.tar.gz: 7abb5b6db3f92b7c619b6cb270f155e6329f3c70925f2f524ff7dc985b0560db16727b827d877f8f3586eac220fe86c4e661887fa89a4c6d44a452a4fb28e330
6
+ metadata.gz: 953a02b03057565688a1d20191f79d6d604016bc9885f635af2c5bd5de58bd8552bd5adcd04b33b5b1f03e141f3fe633a22def6ba8371996131435a9dc3e80d3
7
+ data.tar.gz: 9872c860230de61ef52c08cba0d362b3bcdb1f3804b4242f6dd589ba879b0254c63ae6cd5f9b6f992d25291a00b9189c59c786d5bdc3e4bc8ae87fea581e5f76
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-2
7
+ install:
8
+ - gem install aws-sdk-core
9
+ - gem install clap
10
+ - gem install cutest -v 1.1.3
11
+ - gem install codeclimate-test-reporter
12
+ script:
13
+ RUBYLIB=./lib cutest test/*_test.rb
data/README.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Laboristo
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/laboristo.svg)][gem]
4
+ [![Dependency Status](https://gemnasium.com/matiasow/laboristo.svg)][gemnasium]
5
+ [![Code Climate](https://codeclimate.com/github/matiasow/laboristo/badges/gpa.svg)][codeclimate]
6
+ [![Build Status](https://travis-ci.org/matiasow/laboristo.svg?branch=master)][travis]
7
+ [![Test Coverage](https://codeclimate.com/github/matiasow/laboristo/badges/coverage.svg)][codeclimate]
8
+
9
+ [gem]: http://badge.fury.io/rb/laboristo
10
+ [gemnasium]: https://gemnasium.com/matiasow/laboristo
11
+ [codeclimate]: https://codeclimate.com/github/matiasow/laboristo
12
+ [travis]: https://travis-ci.org/matiasow/laboristo
13
+
2
14
  Laboristo is an attempt to port [Ost](https://github.com/soveran/ost) simplicity to AWS SQS.
3
15
 
16
+ ![enter image description here](http://i.imgur.com/F6ZZNrx.jpg)
17
+
4
18
  ## Installation
5
19
 
6
20
  Simply run:
@@ -48,13 +62,13 @@ To push a message to the queue:
48
62
  ```ruby
49
63
  require 'laboristo'
50
64
 
51
- Laboristo['my_queue_name'] << 'some message'
65
+ Laboristo['my_queue'] << 'some message'
52
66
  ```
53
67
 
54
68
  And get messages from a queue:
55
69
  ```ruby
56
70
  require 'laboristo'
57
- Laboristo['my_queue_name'].each do |msg|
71
+ Laboristo['my_queue'].each do |msg|
58
72
  # Do something with msg...
59
73
  end
60
74
  ```
@@ -85,6 +99,14 @@ To run it in background you can use ```-d``` flag to daemonize the process:
85
99
 
86
100
  You can stop the workers by killing the process. Keep in mind that, because of how SQS works, unprocessed messages will go back to the queue.
87
101
 
102
+ ### Purging
103
+
104
+ Delete all messages from a queue:
105
+
106
+ ```ruby
107
+ Laboristo['my_queue'].purge
108
+ ```
109
+
88
110
  ## Development
89
111
 
90
112
  After cloning repository install dependencies using [dep](https://github.com/cyx/dep):
@@ -109,7 +131,7 @@ Feel free to report bugs, open issues, comments and pull requests. Only keep in
109
131
 
110
132
  ## Credits
111
133
 
112
- Most of the credit for this gem goes to [@soveran](https://github.com/soveran/ost) and [@djanowski](https://github.com/djanowski/ost-bin), who created the code this gem is based in. Kudos to them!
134
+ Most of the credit for this gem goes to [@soveran](https://github.com/soveran/ost) and [@djanowski](https://github.com/djanowski/ost-bin), who created the code this gem is based on. Kudos to them!
113
135
 
114
136
  ## License
115
137
  Laboristo is released under the [MIT License](http://www.opensource.org/licenses/MIT).
data/laboristo.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'laboristo'
3
- s.version = '0.1.0'
3
+ s.version = '0.2.0'
4
4
  s.summary = 'Simple messages and workers for AWS SQS'
5
5
  s.authors = ['matiasow']
6
6
  s.email = ['matiasow@gmail.com']
data/lib/laboristo.rb CHANGED
@@ -38,6 +38,10 @@ module Laboristo
38
38
 
39
39
  alias << push
40
40
  alias pop each
41
+
42
+ def purge
43
+ @sqs.purge_queue(queue_url: @url)
44
+ end
41
45
  end
42
46
 
43
47
  def self.[](queue)
data/test/helper.rb CHANGED
@@ -38,5 +38,5 @@ end
38
38
  @region = ENV['AWS_REGION']
39
39
  @client = Aws::SQS::Client.new
40
40
 
41
- @queue_name = SecureRandom.uuid
41
+ @queue_name = 'laboristo_test_' + SecureRandom.uuid
42
42
  @url = @client.create_queue(queue_name: @queue_name).data.to_hash[:queue_url]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laboristo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - matiasow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-03 00:00:00.000000000 Z
11
+ date: 2015-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core
@@ -62,6 +62,7 @@ extra_rdoc_files: []
62
62
  files:
63
63
  - ".gems"
64
64
  - ".gitignore"
65
+ - ".travis.yml"
65
66
  - LICENSE
66
67
  - README.md
67
68
  - bin/laboristo