cpee-dstore 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/cpee-dstore.gemspec +1 -1
- data/lib/cpee-dstore/implementation.rb +28 -7
- data/lib/cpee-dstore/implementation.xml +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c28c56e93122155e84b94e655fd0d4be5737a25085606fc024e07aaefe76590
|
|
4
|
+
data.tar.gz: 8714302f01d9466b1f7e43651078923a9dc36073abde5f1f56c64ff3b1618cff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8381e687333d1746b08f9b55124ceef643eee6e07335fa9bee264576762104cbc486528a283a915be516d7c0137540e5cc24f8be80e0f6efd97420837ed06acb
|
|
7
|
+
data.tar.gz: 1786ebf085d45afecebfa505c021b58566ec30eba39b2678227154bb21c4c2398df8e23a4c7fa93909cd55e7f08bd47fea2acede8b17a954a005b4bb01979f44
|
data/cpee-dstore.gemspec
CHANGED
|
@@ -28,16 +28,22 @@ class File
|
|
|
28
28
|
lines = 0
|
|
29
29
|
|
|
30
30
|
begin
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
reached_start = idx.zero?
|
|
32
|
+
seek idx
|
|
33
|
+
chunk = read buffer
|
|
33
34
|
lines += chunk.count("\n")
|
|
34
|
-
chunks.unshift
|
|
35
|
-
idx
|
|
36
|
-
end while lines <
|
|
35
|
+
chunks.unshift(chunk)
|
|
36
|
+
idx = [idx - buffer, 0].max
|
|
37
|
+
end while lines < n + 1 && !reached_start
|
|
37
38
|
|
|
38
39
|
tail_of_file = chunks.join('')
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
if lines < n + 1
|
|
41
|
+
tail_of_file
|
|
42
|
+
else
|
|
43
|
+
ary = tail_of_file.split("\n")
|
|
44
|
+
n = ary.size if n > ary.size
|
|
45
|
+
ary[ ary.size - n, n ].join("\n")
|
|
46
|
+
end
|
|
41
47
|
end
|
|
42
48
|
end
|
|
43
49
|
|
|
@@ -90,6 +96,20 @@ module CPEE
|
|
|
90
96
|
end
|
|
91
97
|
end #}}}
|
|
92
98
|
|
|
99
|
+
class DoDel < Riddl::Implementation #{{{
|
|
100
|
+
def response
|
|
101
|
+
file = File.join(@a[0],@r[-2],@r[-1])
|
|
102
|
+
meta = file + '.mimetype'
|
|
103
|
+
if File.exist?(file) && File.exist?(meta)
|
|
104
|
+
File.unlink(file)
|
|
105
|
+
File.unlink(meta)
|
|
106
|
+
else
|
|
107
|
+
@status = 404
|
|
108
|
+
nil
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end #}}}
|
|
112
|
+
|
|
93
113
|
def self::implementation(opts)
|
|
94
114
|
opts[:data_dir] ||= File.expand_path(File.join(__dir__,'data'))
|
|
95
115
|
|
|
@@ -99,6 +119,7 @@ module CPEE
|
|
|
99
119
|
on resource '[a-z_][a-zA-Z0-9_]*' do
|
|
100
120
|
run DoGet, opts[:data_dir] if get 'rfile'
|
|
101
121
|
run DoPut, opts[:data_dir] if put 'ifile'
|
|
122
|
+
run DoDel, opts[:data_dir] if delete
|
|
102
123
|
end
|
|
103
124
|
end
|
|
104
125
|
end
|