uas2git 0.9.3 → 0.9.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/lib/uas2git.rb +1 -0
- data/lib/uas2git/lo_reader.rb +26 -0
- data/lib/uas2git/migration.rb +3 -16
- data/lib/uas2git/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b19bc2bc78262e8dc5261a3835e8c0268b944b
|
4
|
+
data.tar.gz: bb591d0df72a7ff57184d20e1525e45cff0c7136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 657ad52b78256644bcfd3bf0cbf24f5703a35f3b0478b4ca002b911b477696152285d92d5b92338c62136f6f880463019f73a43f3986eb8fc442c3e476cee34d
|
7
|
+
data.tar.gz: 9ed83b1077de6d7404ef44a9ac09c2e558fa6a17bae7d0b8b60dff46e2f55227033ea483c7837c4b0056a91c7a945657ebd059e2500dddeffad608b68faabde4
|
data/lib/uas2git.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
module Uas2Git
|
2
|
+
class LOReader
|
3
|
+
def initialize(connection)
|
4
|
+
@connection = connection
|
5
|
+
end
|
6
|
+
|
7
|
+
def open(stream, &block)
|
8
|
+
@connection.transaction do
|
9
|
+
begin
|
10
|
+
@fd = @connection.lo_open(stream)
|
11
|
+
|
12
|
+
r = yield self
|
13
|
+
|
14
|
+
ensure
|
15
|
+
@connection.lo_close(@fd)
|
16
|
+
|
17
|
+
r
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def read(size)
|
23
|
+
@connection.lo_read(@fd, size)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/uas2git/migration.rb
CHANGED
@@ -49,23 +49,10 @@ module Uas2Git
|
|
49
49
|
asset_versions.find_each do |asset_version|
|
50
50
|
Progress.step do
|
51
51
|
asset_version.contents.each do |contents|
|
52
|
-
|
53
|
-
|
54
|
-
asset_version.transaction do
|
55
|
-
fd = asset_version.class.connection.raw_connection.lo_open(contents.stream, PG::INV_READ)
|
56
|
-
|
57
|
-
loop do
|
58
|
-
data = asset_version.class.connection.raw_connection.lo_read(fd, 65536)
|
59
|
-
break if data == nil || data.empty?
|
60
|
-
|
61
|
-
blob += data
|
62
|
-
end
|
63
|
-
|
64
|
-
asset_version.class.connection.raw_connection.lo_close(fd)
|
52
|
+
oid = LOReader.new(asset_version.class.connection.raw_connection).open(contents.stream) do |lo|
|
53
|
+
Rugged::Blob.from_chunks(repo, lo)
|
65
54
|
end
|
66
55
|
|
67
|
-
oid = repo.write(blob, :blob)
|
68
|
-
|
69
56
|
if contents.tag == 'asset' then
|
70
57
|
oids[asset_version.asset.serial] = {} if oids[asset_version.asset.serial].nil?
|
71
58
|
oids[asset_version.asset.serial][asset_version.revision] = oid
|
@@ -215,7 +202,7 @@ fileFormatVersion: 2
|
|
215
202
|
guid: #{guid_string}
|
216
203
|
folderAsset: yes
|
217
204
|
DefaultImporter:
|
218
|
-
userData
|
205
|
+
userData:\s
|
219
206
|
EOF
|
220
207
|
end
|
221
208
|
|
data/lib/uas2git/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uas2git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toru Nayuki
|
@@ -138,6 +138,7 @@ files:
|
|
138
138
|
- Vagrantfile
|
139
139
|
- bin/uas2git
|
140
140
|
- lib/uas2git.rb
|
141
|
+
- lib/uas2git/lo_reader.rb
|
141
142
|
- lib/uas2git/migration.rb
|
142
143
|
- lib/uas2git/uas.rb
|
143
144
|
- lib/uas2git/version.rb
|