fnf 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/fnf.gemspec +0 -1
- data/lib/fnf.rb +3 -3
- data/lib/fnf/fifo.rb +30 -0
- data/lib/fnf/version.rb +1 -1
- metadata +7 -20
data/fnf.gemspec
CHANGED
data/lib/fnf.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'daemons'
|
3
|
-
require 'fifo'
|
4
3
|
require 'json'
|
5
4
|
require 'eventmachine'
|
6
5
|
require 'typhoeus'
|
@@ -9,7 +8,8 @@ require 'msgpack'
|
|
9
8
|
require 'fifowriter/fifowriter'
|
10
9
|
|
11
10
|
module Fnf
|
11
|
+
autoload :Fifo, 'fnf/fifo'
|
12
12
|
autoload :Connection, 'fnf/connection'
|
13
|
-
autoload :Worker,
|
14
|
-
autoload :Client,
|
13
|
+
autoload :Worker, 'fnf/worker'
|
14
|
+
autoload :Client, 'fnf/client'
|
15
15
|
end
|
data/lib/fnf/fifo.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module Fnf
|
2
|
+
|
3
|
+
class Fifo
|
4
|
+
def initialize(file)
|
5
|
+
if !File.exists?(file)
|
6
|
+
File.mkfifo(file)
|
7
|
+
File.chmod(0666, file)
|
8
|
+
end
|
9
|
+
@pipe = File.open(file, "r+")
|
10
|
+
end
|
11
|
+
|
12
|
+
def readline
|
13
|
+
str = ""
|
14
|
+
while ($_ = self.read(1)) != "\n"
|
15
|
+
str << $_
|
16
|
+
end
|
17
|
+
str << "\n"
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_io
|
21
|
+
@pipe.to_io
|
22
|
+
end
|
23
|
+
|
24
|
+
def read(n)
|
25
|
+
@pipe.read(n)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/lib/fnf/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fnf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Julio Capote
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-28 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: eventmachine
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
type: :runtime
|
48
48
|
version_requirements: *id002
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
50
|
+
name: msgpack
|
51
51
|
prerelease: false
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
@@ -60,20 +60,6 @@ dependencies:
|
|
60
60
|
version: "0"
|
61
61
|
type: :runtime
|
62
62
|
version_requirements: *id003
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: msgpack
|
65
|
-
prerelease: false
|
66
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
|
-
requirements:
|
69
|
-
- - ">="
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
type: :runtime
|
76
|
-
version_requirements: *id004
|
77
63
|
description: " Fire and Forget replaces the need to write resque tasks or delayed jobs to fire off web requests (usually notification webhooks or a anti-spam service, like defensio or akismet). A single worker reads and executes web requests from a blocking named pipe, while clients queue up them up in a non blocking manner. It uses typhoeus internally to execute the web requests for maximum speed."
|
78
64
|
email:
|
79
65
|
- jcapote@gmail.com
|
@@ -98,6 +84,7 @@ files:
|
|
98
84
|
- lib/fnf.rb
|
99
85
|
- lib/fnf/client.rb
|
100
86
|
- lib/fnf/connection.rb
|
87
|
+
- lib/fnf/fifo.rb
|
101
88
|
- lib/fnf/version.rb
|
102
89
|
- lib/fnf/worker.rb
|
103
90
|
- spec/client_spec.rb
|