beetle_joevandyk_extensions 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/beetle_joevandyk_extensions.gemspec +18 -0
- data/lib/beetle_joevandyk_extensions.rb +25 -0
- data/lib/beetle_joevandyk_extensions/version.rb +3 -0
- metadata +64 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/beetle_joevandyk_extensions/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Joe Van Dyk"]
|
6
|
+
gem.email = ["joe@fixieconsulting.com"]
|
7
|
+
gem.description = %q{Extensions to Beetle}
|
8
|
+
gem.summary = %q{Extensions to Beetle}
|
9
|
+
gem.homepage = ''
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "beetle_joevandyk_extensions"
|
15
|
+
gem.require_paths = ['lib']
|
16
|
+
gem.version = BeetleJoevandykExtensions::VERSION
|
17
|
+
gem.add_runtime_dependency("beetle")
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "beetle_joevandyk_extensions/version"
|
2
|
+
require 'beetle'
|
3
|
+
|
4
|
+
module BeetleJoevandykExtensions
|
5
|
+
def self.rpc name, message, options={}
|
6
|
+
client = Beetle::Client.new
|
7
|
+
client.register_message name
|
8
|
+
status, result = client.rpc(name, message.to_json)
|
9
|
+
raise result.to_s if status != "OK"
|
10
|
+
JSON.parse(result)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.listener name, &block
|
14
|
+
client = Beetle::Client.new
|
15
|
+
client.register_queue name
|
16
|
+
client.register_handler name do |input|
|
17
|
+
block.call JSON.parse(input.data)
|
18
|
+
end
|
19
|
+
client.listen do
|
20
|
+
puts "Started #{ name } at #{ Time.now }"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Beetle.include(BeetleJoevandykExtensions)
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beetle_joevandyk_extensions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joe Van Dyk
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-07-16 00:00:00.000000000 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: beetle
|
17
|
+
requirement: &2157270620 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2157270620
|
26
|
+
description: Extensions to Beetle
|
27
|
+
email:
|
28
|
+
- joe@fixieconsulting.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- .gitignore
|
34
|
+
- Gemfile
|
35
|
+
- Rakefile
|
36
|
+
- beetle_joevandyk_extensions.gemspec
|
37
|
+
- lib/beetle_joevandyk_extensions.rb
|
38
|
+
- lib/beetle_joevandyk_extensions/version.rb
|
39
|
+
has_rdoc: true
|
40
|
+
homepage: ''
|
41
|
+
licenses: []
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 1.6.2
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Extensions to Beetle
|
64
|
+
test_files: []
|