fu_queue 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG +3 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +13 -0
- data/Rakefile +31 -0
- data/fu_queue.gemspec +23 -0
- data/generators/fu_queue/fu_queue_generator.rb +21 -0
- data/generators/fu_queue/templates/fu_queue.yml.erb +21 -0
- data/lib/fu_queue.rb +26 -0
- metadata +73 -0
data/.gitignore
ADDED
data/CHANGELOG
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'rubyforge'
|
5
|
+
|
6
|
+
task :clean => [:clobber_rdoc, :clobber_package]
|
7
|
+
|
8
|
+
desc 'Generate documentation for the fu_queue gem.'
|
9
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Fu Queue'
|
12
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
gem_spec = eval(File.read('fu_queue.gemspec'))
|
18
|
+
|
19
|
+
Rake::GemPackageTask.new(gem_spec) do |p|
|
20
|
+
p.need_tar = false
|
21
|
+
p.need_zip = false
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Package and upload the release to rubyforge.'
|
25
|
+
task :release => [:clean, :package] do |t|
|
26
|
+
rubyforge = RubyForge.new.configure
|
27
|
+
rubyforge.login
|
28
|
+
rubyforge.add_release gem_spec.rubyforge_project, gem_spec.name, gem_spec.version.to_s, "pkg/#{gem_spec.name}-#{gem_spec.version}.gem"
|
29
|
+
end
|
30
|
+
|
31
|
+
task :bamboo => [ :package ]
|
data/fu_queue.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
spec = Gem::Specification.new do |s|
|
2
|
+
s.name = 'fu_queue'
|
3
|
+
s.version = '1.0.0'
|
4
|
+
s.date = '2009-06-18'
|
5
|
+
s.authors = ['Graeme Mathieson', 'Mark Connell' 'Rubaidh Ltd']
|
6
|
+
s.email = 'support@rubaidh.com'
|
7
|
+
s.rubyforge_project = 'rubaidh'
|
8
|
+
s.homepage = 'http://rubaidh.com/portfolio/open-source'
|
9
|
+
s.summary = '[Rails] Make the life of SMQueue easier in a Rails application'
|
10
|
+
|
11
|
+
s.description = 'Make the life of SMQueue easier in a Rails application'
|
12
|
+
|
13
|
+
s.files = %w(
|
14
|
+
.gitignore MIT-LICENSE Rakefile README.rdoc CHANGELOG fu_queue.gemspec
|
15
|
+
generators/fu_queue/fu_queue_generator.rb
|
16
|
+
generators/fu_queue/templates/fu_queue.yml.erb
|
17
|
+
lib/fu_queue.rb
|
18
|
+
)
|
19
|
+
|
20
|
+
s.add_dependency 'seanohalpin-smqueue', '>=0.2.1'
|
21
|
+
|
22
|
+
s.has_rdoc = false
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class FuQueueGenerator < Rails::Generator::NamedBase
|
2
|
+
def initialize(runtime_args, runtime_options = {})
|
3
|
+
runtime_args = ["default_queue"] if runtime_args.blank?
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.directory 'config'
|
10
|
+
m.template 'fu_queue.yml.erb', File.join('config', 'fu_queue.yml')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def queue_name
|
15
|
+
file_name
|
16
|
+
end
|
17
|
+
|
18
|
+
def app_name
|
19
|
+
File.basename(RAILS_ROOT)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
:host: localhost
|
3
|
+
:adapter: StompAdapter
|
4
|
+
|
5
|
+
development:
|
6
|
+
<%= queue_name %>:
|
7
|
+
:name: /queue/<%= app_name %>/development/<%= queue_name %>
|
8
|
+
<<: *defaults
|
9
|
+
|
10
|
+
test: &test
|
11
|
+
<%= queue_name %>:
|
12
|
+
:name: /queue/<%= app_name %>/test/<%= queue_name %>
|
13
|
+
<<: *defaults
|
14
|
+
|
15
|
+
cucumber:
|
16
|
+
<<: *test
|
17
|
+
|
18
|
+
production:
|
19
|
+
<%= queue_name %>:
|
20
|
+
:name: /queue/<%= app_name %>/<%= queue_name %>
|
21
|
+
<<: *defaults
|
data/lib/fu_queue.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# FuQueue
|
2
|
+
class FuQueue
|
3
|
+
class << self
|
4
|
+
def [](queue_name)
|
5
|
+
( @queues ||= {} )[queue_name] ||= new(queue_name)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(queue_name)
|
10
|
+
@sm_queue = SMQueue.new(YAML.load_file("#{RAILS_ROOT}/config/fu_queue.yml")[RAILS_ENV][queue_name.to_s])
|
11
|
+
end
|
12
|
+
|
13
|
+
def get
|
14
|
+
if block_given?
|
15
|
+
@sm_queue.get do |message|
|
16
|
+
yield YAML.parse(message.body).transform
|
17
|
+
end
|
18
|
+
else
|
19
|
+
YAML.parse(@sm_queue.get.body).transform
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def put(message)
|
24
|
+
@sm_queue.put(message.to_yaml)
|
25
|
+
end
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fu_queue
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Graeme Mathieson
|
8
|
+
- Mark ConnellRubaidh Ltd
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-06-18 00:00:00 +01:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: seanohalpin-smqueue
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.2.1
|
25
|
+
version:
|
26
|
+
description: Make the life of SMQueue easier in a Rails application
|
27
|
+
email: support@rubaidh.com
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files: []
|
33
|
+
|
34
|
+
files:
|
35
|
+
- .gitignore
|
36
|
+
- MIT-LICENSE
|
37
|
+
- Rakefile
|
38
|
+
- README.rdoc
|
39
|
+
- CHANGELOG
|
40
|
+
- fu_queue.gemspec
|
41
|
+
- generators/fu_queue/fu_queue_generator.rb
|
42
|
+
- generators/fu_queue/templates/fu_queue.yml.erb
|
43
|
+
- lib/fu_queue.rb
|
44
|
+
has_rdoc: true
|
45
|
+
homepage: http://rubaidh.com/portfolio/open-source
|
46
|
+
licenses: []
|
47
|
+
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
|
51
|
+
require_paths:
|
52
|
+
- lib
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
version:
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
requirements: []
|
66
|
+
|
67
|
+
rubyforge_project: rubaidh
|
68
|
+
rubygems_version: 1.3.4
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: "[Rails] Make the life of SMQueue easier in a Rails application"
|
72
|
+
test_files: []
|
73
|
+
|