em-files 0.2.0 → 0.2.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 +2 -0
- data/README.md +1 -1
- data/VERSION +1 -1
- data/em-files.gemspec +5 -2
- data/lib/em-files.rb +7 -5
- metadata +20 -9
data/Gemfile
CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
|
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
gem "eventmachine", ">= 0.12.10"
|
5
|
+
gem "multitype-introspection", ">= 0.1.2"
|
5
6
|
|
6
7
|
# Add dependencies to develop your gem here.
|
7
8
|
# Include everything needed to run rake, tests, features, etc.
|
data/Gemfile.lock
CHANGED
@@ -7,6 +7,7 @@ GEM
|
|
7
7
|
bundler (~> 1.0.0)
|
8
8
|
git (>= 1.2.5)
|
9
9
|
rake
|
10
|
+
multitype-introspection (0.1.2)
|
10
11
|
rake (0.8.7)
|
11
12
|
riot (0.12.2)
|
12
13
|
rr
|
@@ -19,4 +20,5 @@ DEPENDENCIES
|
|
19
20
|
bundler (~> 1.0.0)
|
20
21
|
eventmachine (>= 0.12.10)
|
21
22
|
jeweler (~> 1.5.2)
|
23
|
+
multitype-introspection (>= 0.1.2)
|
22
24
|
riot (>= 0.12.1)
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ using filters:
|
|
52
52
|
|
53
53
|
zip = Zlib::Deflate::new
|
54
54
|
filter = Proc::new { |chunk| zip.deflate(chunk, Zlib::SYNC_FLUSH) }
|
55
|
-
data = "..." # some bigger than big
|
55
|
+
data = "..." # some data bigger than big
|
56
56
|
|
57
57
|
EM::run do
|
58
58
|
EM::File::write(data, filter) # done in several ticks
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/em-files.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{em-files}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.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-03-
|
12
|
+
s.date = %q{2011-03-24}
|
13
13
|
s.email = %q{martinkozak@martinkozak.net}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -38,17 +38,20 @@ Gem::Specification.new do |s|
|
|
38
38
|
|
39
39
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
40
40
|
s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
|
41
|
+
s.add_runtime_dependency(%q<multitype-introspection>, [">= 0.1.2"])
|
41
42
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
42
43
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
43
44
|
s.add_development_dependency(%q<riot>, [">= 0.12.1"])
|
44
45
|
else
|
45
46
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
47
|
+
s.add_dependency(%q<multitype-introspection>, [">= 0.1.2"])
|
46
48
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
47
49
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
48
50
|
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
49
51
|
end
|
50
52
|
else
|
51
53
|
s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
|
54
|
+
s.add_dependency(%q<multitype-introspection>, [">= 0.1.2"])
|
52
55
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
53
56
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
54
57
|
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
data/lib/em-files.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
3
|
|
4
4
|
require "eventmachine"
|
5
|
+
require "stringio"
|
6
|
+
require "multitype-introspection"
|
5
7
|
|
6
8
|
##
|
7
9
|
# Main EventMachine module.
|
@@ -30,7 +32,7 @@ module EM
|
|
30
32
|
# because processing is asynchronous so it doesn't know when
|
31
33
|
# is convenient to close the file.
|
32
34
|
#
|
33
|
-
# @param [String] filepath path to file
|
35
|
+
# @param [String, IO, StringIO] filepath path to file or IO object
|
34
36
|
# @param [String] mode file access mode (see equivalent Ruby method)
|
35
37
|
# @param [Integer] rwsize size of block operated during one tick
|
36
38
|
# @param [Proc] block syntactic sugar for wrapping File access object
|
@@ -53,7 +55,7 @@ module EM
|
|
53
55
|
# binary mode. If IO object is given instead of filepath, uses
|
54
56
|
# it as native one and +mode+ argument is ignored.
|
55
57
|
#
|
56
|
-
# @param [String] filepath path to file
|
58
|
+
# @param [String, IO, StringIO] filepath path to file or IO object
|
57
59
|
# @param [Integer] rwsize size of block operated during one tick
|
58
60
|
# @param [Proc] filter filter which for postprocessing each
|
59
61
|
# read chunk
|
@@ -76,7 +78,7 @@ module EM
|
|
76
78
|
# If IO object is given instead of filepath, uses it as native
|
77
79
|
# one and +mode+ argument is ignored.
|
78
80
|
#
|
79
|
-
# @param [String] filepath path to file
|
81
|
+
# @param [String, IO, StringIO] filepath path to file or IO object
|
80
82
|
# @param [String] data data for write
|
81
83
|
# @param [Integer] rwsize size of block operated during one tick
|
82
84
|
# @param [Proc] filter filter which for preprocessing each
|
@@ -125,7 +127,7 @@ module EM
|
|
125
127
|
# Constructor. If IO object is given instead of filepath, uses
|
126
128
|
# it as native one and +mode+ argument is ignored.
|
127
129
|
#
|
128
|
-
# @param [String, IO] filepath path to file or IO object
|
130
|
+
# @param [String, IO, StringIO] filepath path to file or IO object
|
129
131
|
# @param [String] mode file access mode (see equivalent Ruby method)
|
130
132
|
# @param [Integer] rwsize size of block operated during one tick
|
131
133
|
#
|
@@ -137,7 +139,7 @@ module EM
|
|
137
139
|
rwsize = self::RWSIZE if rwsize.nil?
|
138
140
|
|
139
141
|
# If filepath is directly IO, uses it
|
140
|
-
if filepath.
|
142
|
+
if filepath.kind_of_any? [StringIO, IO]
|
141
143
|
@native = filepath
|
142
144
|
else
|
143
145
|
@native = ::File::open(filepath, mode)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: em-files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.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-03-
|
13
|
+
date: 2011-03-24 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +25,19 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: multitype-introspection
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.1.2
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: bundler
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
30
41
|
none: false
|
31
42
|
requirements:
|
32
43
|
- - ~>
|
@@ -34,10 +45,10 @@ dependencies:
|
|
34
45
|
version: 1.0.0
|
35
46
|
type: :development
|
36
47
|
prerelease: false
|
37
|
-
version_requirements: *
|
48
|
+
version_requirements: *id003
|
38
49
|
- !ruby/object:Gem::Dependency
|
39
50
|
name: jeweler
|
40
|
-
requirement: &
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
41
52
|
none: false
|
42
53
|
requirements:
|
43
54
|
- - ~>
|
@@ -45,10 +56,10 @@ dependencies:
|
|
45
56
|
version: 1.5.2
|
46
57
|
type: :development
|
47
58
|
prerelease: false
|
48
|
-
version_requirements: *
|
59
|
+
version_requirements: *id004
|
49
60
|
- !ruby/object:Gem::Dependency
|
50
61
|
name: riot
|
51
|
-
requirement: &
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
52
63
|
none: false
|
53
64
|
requirements:
|
54
65
|
- - ">="
|
@@ -56,7 +67,7 @@ dependencies:
|
|
56
67
|
version: 0.12.1
|
57
68
|
type: :development
|
58
69
|
prerelease: false
|
59
|
-
version_requirements: *
|
70
|
+
version_requirements: *id005
|
60
71
|
description:
|
61
72
|
email: martinkozak@martinkozak.net
|
62
73
|
executables: []
|
@@ -91,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
102
|
requirements:
|
92
103
|
- - ">="
|
93
104
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
105
|
+
hash: 1975590278330534789
|
95
106
|
segments:
|
96
107
|
- 0
|
97
108
|
version: "0"
|