midori-contrib 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/midori-contrib.rb +1 -1
- data/lib/midori-contrib/file.rb +43 -41
- metadata +3 -3
- data/Gemfile.lock +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cadddcc567b3ab5a97cfdcec2fb36682f43c0702
|
4
|
+
data.tar.gz: 625e91eff21ba060065dfe10a6034de1bd4ddf5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e70ecc877cf7f532071e2c21afb2e58313d32df77845918a18a79745cb3b355d94a1583ecd9643d767d5f1458cd29aaf7b7168e6cec2e163a873fa7b15450fa4
|
7
|
+
data.tar.gz: a7ef4a9aa0adab65f63b6c1b3589ce130c99dc21046eed50a83c52713224f3893984d3ce2ef63d6b6e1eb893d2acfc3fb2bf8bfbec0117843a5aeb5bf443eab4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 HeckPsi Lab
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/lib/midori-contrib.rb
CHANGED
data/lib/midori-contrib/file.rb
CHANGED
@@ -1,51 +1,53 @@
|
|
1
1
|
##
|
2
2
|
# Midori Extension of File reading and writing
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
module MidoriContrib
|
4
|
+
class File
|
5
|
+
# Init File object
|
6
|
+
# @param [Array] args same args like File.new
|
7
|
+
def initialize(*args)
|
8
|
+
@file = ::File.new(*args)
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
# read file
|
12
|
+
# @return [String] string readed
|
13
|
+
def read
|
14
|
+
await(Promise.new do |resolve|
|
15
|
+
data = ''
|
16
|
+
EventLoop.register(@file, :r) do
|
17
|
+
if @file.eof?
|
18
|
+
EventLoop.deregister(@file)
|
19
|
+
resolve.call(data)
|
20
|
+
else
|
21
|
+
data << @file.read_nonblock(16384)
|
22
|
+
end
|
21
23
|
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
24
|
+
end)
|
25
|
+
end
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
# write file
|
28
|
+
# @param [String] data string to be written
|
29
|
+
def write(data)
|
30
|
+
await(Promise.new do |resolve|
|
31
|
+
written = 0
|
32
|
+
EventLoop.register(@file, :w) do
|
33
|
+
written += @file.write_nonblock(data[written..-1])
|
34
|
+
if written == data.size
|
35
|
+
EventLoop.deregister(@file)
|
36
|
+
resolve.call(written)
|
37
|
+
end
|
36
38
|
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
39
|
+
end)
|
40
|
+
end
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
# raw file object
|
43
|
+
# @return [File] file
|
44
|
+
def raw
|
45
|
+
@file
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
# Close the file
|
49
|
+
def close
|
50
|
+
@file.close
|
51
|
+
end
|
50
52
|
end
|
51
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: midori-contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HeckPsi Lab
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: em-midori
|
@@ -31,7 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- ".editorconfig"
|
34
|
-
-
|
34
|
+
- LICENSE
|
35
35
|
- lib/midori-contrib.rb
|
36
36
|
- lib/midori-contrib/file.rb
|
37
37
|
- lib/midori-contrib/net.rb
|
data/Gemfile.lock
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
midori-contrib (0.0.1)
|
5
|
-
em-midori (~> 0.3)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
codeclimate-test-reporter (1.0.7)
|
11
|
-
simplecov
|
12
|
-
diff-lcs (1.3)
|
13
|
-
docile (1.1.5)
|
14
|
-
em-midori (0.3.0)
|
15
|
-
midori_http_parser (~> 0.6.1)
|
16
|
-
mustermann (~> 1.0)
|
17
|
-
nio4r (~> 2.0)
|
18
|
-
hiredis (0.6.1)
|
19
|
-
json (2.1.0)
|
20
|
-
kramdown (1.13.2)
|
21
|
-
midori_http_parser (0.6.1.3)
|
22
|
-
mustermann (1.0.0)
|
23
|
-
mysql2 (0.4.6)
|
24
|
-
nest (3.1.1)
|
25
|
-
redic
|
26
|
-
nio4r (2.1.0)
|
27
|
-
ohm (3.1.1)
|
28
|
-
nest (~> 3)
|
29
|
-
redic (~> 1.5.0)
|
30
|
-
stal
|
31
|
-
pg (0.21.0)
|
32
|
-
rake (12.0.0)
|
33
|
-
redic (1.5.0)
|
34
|
-
hiredis
|
35
|
-
rspec (3.6.0)
|
36
|
-
rspec-core (~> 3.6.0)
|
37
|
-
rspec-expectations (~> 3.6.0)
|
38
|
-
rspec-mocks (~> 3.6.0)
|
39
|
-
rspec-core (3.6.0)
|
40
|
-
rspec-support (~> 3.6.0)
|
41
|
-
rspec-expectations (3.6.0)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.6.0)
|
44
|
-
rspec-mocks (3.6.0)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.6.0)
|
47
|
-
rspec-support (3.6.0)
|
48
|
-
sequel (4.47.0)
|
49
|
-
simplecov (0.14.1)
|
50
|
-
docile (~> 1.1.0)
|
51
|
-
json (>= 1.8, < 3)
|
52
|
-
simplecov-html (~> 0.10.0)
|
53
|
-
simplecov-html (0.10.1)
|
54
|
-
stal (0.3.0)
|
55
|
-
redic (~> 1.5)
|
56
|
-
yard (0.9.9)
|
57
|
-
|
58
|
-
PLATFORMS
|
59
|
-
ruby
|
60
|
-
|
61
|
-
DEPENDENCIES
|
62
|
-
bundler (~> 1.0)
|
63
|
-
codeclimate-test-reporter (~> 1.0)
|
64
|
-
hiredis (~> 0.6.0)
|
65
|
-
kramdown (~> 1.13)
|
66
|
-
midori-contrib!
|
67
|
-
mysql2 (~> 0.4)
|
68
|
-
ohm (~> 3.0)
|
69
|
-
pg (~> 0.17)
|
70
|
-
rake (~> 12.0)
|
71
|
-
rspec (~> 3.0)
|
72
|
-
sequel (~> 4.40)
|
73
|
-
simplecov (~> 0.14)
|
74
|
-
yard (~> 0.9)
|
75
|
-
|
76
|
-
BUNDLED WITH
|
77
|
-
1.14.6
|