em-files 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/{em-file.gemspec → em-files.gemspec} +10 -6
- data/lib/em-files.rb +5 -4
- metadata +17 -6
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
EventMachine Files
|
2
2
|
==================
|
3
3
|
|
4
|
-
**em-files** solve problem of blocking disk IO
|
4
|
+
**em-files** solve problem of blocking disk IO when operating with
|
5
5
|
large files. Use [EventMachine][4] for multiplexing reads and writes
|
6
6
|
to small blocks performed in standalone EM ticks. They speed down the
|
7
7
|
file IO operations of sure, but allow running other tasks with them
|
@@ -45,6 +45,6 @@ Copyright © 2011 [Martin Kozák][3]. See `LICENSE.txt` for
|
|
45
45
|
further details.
|
46
46
|
|
47
47
|
[1]: http://www.ruby-doc.org/core/classes/File.html
|
48
|
-
[2]: http://github.com/martinkozak/em-
|
48
|
+
[2]: http://github.com/martinkozak/em-files/issues
|
49
49
|
[3]: http://www.martinkozak.net/
|
50
50
|
[4]: http://rubyeventmachine.com/
|
data/Rakefile
CHANGED
@@ -16,7 +16,7 @@ Jeweler::Tasks.new do |gem|
|
|
16
16
|
gem.name = "em-files"
|
17
17
|
gem.homepage = "https://github.com/martinkozak/em-files"
|
18
18
|
gem.license = "MIT"
|
19
|
-
gem.summary = "Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO
|
19
|
+
gem.summary = "Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO when operating with large files."
|
20
20
|
gem.email = "martinkozak@martinkozak.net"
|
21
21
|
gem.authors = ["Martin Kozák"]
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -4,12 +4,12 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{em-
|
8
|
-
s.version = "0.1.
|
7
|
+
s.name = %q{em-files}
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Martin Kozák"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-03-09}
|
13
13
|
s.email = %q{martinkozak@martinkozak.net}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -23,14 +23,15 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.md",
|
24
24
|
"Rakefile",
|
25
25
|
"VERSION",
|
26
|
+
"em-files.gemspec",
|
26
27
|
"lib/em-files.rb",
|
27
28
|
"test.rb"
|
28
29
|
]
|
29
|
-
s.homepage = %q{https://github.com/martinkozak/em-
|
30
|
+
s.homepage = %q{https://github.com/martinkozak/em-files}
|
30
31
|
s.licenses = ["MIT"]
|
31
32
|
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = %q{1.
|
33
|
-
s.summary = %q{Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO
|
33
|
+
s.rubygems_version = %q{1.6.2}
|
34
|
+
s.summary = %q{Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO when operating with large files.}
|
34
35
|
|
35
36
|
if s.respond_to? :specification_version then
|
36
37
|
s.specification_version = 3
|
@@ -39,15 +40,18 @@ Gem::Specification.new do |s|
|
|
39
40
|
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
|
40
41
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
41
42
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
43
|
+
s.add_development_dependency(%q<riot>, [">= 0.12.1"])
|
42
44
|
else
|
43
45
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
44
46
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
45
47
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
48
|
+
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
46
49
|
end
|
47
50
|
else
|
48
51
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
49
52
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
50
53
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
54
|
+
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
51
55
|
end
|
52
56
|
end
|
53
57
|
|
data/lib/em-files.rb
CHANGED
@@ -41,7 +41,8 @@ module EM
|
|
41
41
|
end
|
42
42
|
|
43
43
|
##
|
44
|
-
# Reads
|
44
|
+
# Reads whole content of the file. Be warn, it reads it in
|
45
|
+
# binary mode.
|
45
46
|
#
|
46
47
|
# @param [String] filepath path to file
|
47
48
|
# @param [Integer] rwsize size of block operated during one tick
|
@@ -50,7 +51,7 @@ module EM
|
|
50
51
|
|
51
52
|
|
52
53
|
def self.read(filepath, rwsize = 65536, &block)
|
53
|
-
self::open(filepath, "
|
54
|
+
self::open(filepath, "rb", rwsize) do |io|
|
54
55
|
io.read do |out|
|
55
56
|
block.call(out)
|
56
57
|
io.close()
|
@@ -59,7 +60,7 @@ module EM
|
|
59
60
|
end
|
60
61
|
|
61
62
|
##
|
62
|
-
# Writes data to file and closes it.
|
63
|
+
# Writes data to file and closes it. Writes them in binary mode.
|
63
64
|
#
|
64
65
|
# @param [String] filepath path to file
|
65
66
|
# @param [String] data data for write
|
@@ -69,7 +70,7 @@ module EM
|
|
69
70
|
#
|
70
71
|
|
71
72
|
def self.write(filepath, data = "", rwsize = 65536, &block)
|
72
|
-
self::open(filepath, "
|
73
|
+
self::open(filepath, "wb", rwsize) do |io|
|
73
74
|
io.write(data) do |length|
|
74
75
|
block.call(length)
|
75
76
|
io.close()
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: em-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Martin Koz\xC3\xA1k"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-09 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -46,6 +46,17 @@ dependencies:
|
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: riot
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.12.1
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: *id004
|
49
60
|
description:
|
50
61
|
email: martinkozak@martinkozak.net
|
51
62
|
executables: []
|
@@ -63,7 +74,7 @@ files:
|
|
63
74
|
- README.md
|
64
75
|
- Rakefile
|
65
76
|
- VERSION
|
66
|
-
- em-
|
77
|
+
- em-files.gemspec
|
67
78
|
- lib/em-files.rb
|
68
79
|
- test.rb
|
69
80
|
has_rdoc: true
|
@@ -80,7 +91,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
80
91
|
requirements:
|
81
92
|
- - ">="
|
82
93
|
- !ruby/object:Gem::Version
|
83
|
-
hash:
|
94
|
+
hash: 50982926357626224
|
84
95
|
segments:
|
85
96
|
- 0
|
86
97
|
version: "0"
|
@@ -93,9 +104,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
104
|
requirements: []
|
94
105
|
|
95
106
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.6.2
|
97
108
|
signing_key:
|
98
109
|
specification_version: 3
|
99
|
-
summary: Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO
|
110
|
+
summary: Sequenced file reader and writer through EventMachine. Solves problem of blocking disk IO when operating with large files.
|
100
111
|
test_files: []
|
101
112
|
|