uas2git 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61411d7ba4da079f4c10ec1089dfc39b230cae0f
4
- data.tar.gz: 3bee5c6e7ba9b2b4786211873dfc291a51956e94
3
+ metadata.gz: b2b19bc2bc78262e8dc5261a3835e8c0268b944b
4
+ data.tar.gz: bb591d0df72a7ff57184d20e1525e45cff0c7136
5
5
  SHA512:
6
- metadata.gz: e3990fdc0d8405160c71b7b2f16041a9fbf721e108745925e220c958711f433c571d5440b12a61a23ff23d38ba70078158d19e3cd3f8a4f14be5961b7e17a1bf
7
- data.tar.gz: 9700dfcf9a4e253661213163db487a97ffa55be08e559b3a93a355b1dd85becf5eba415db86f27785a63f72292f6504b24521be9dda2d455affc1e4b88c77fd9
6
+ metadata.gz: 657ad52b78256644bcfd3bf0cbf24f5703a35f3b0478b4ca002b911b477696152285d92d5b92338c62136f6f880463019f73a43f3986eb8fc442c3e476cee34d
7
+ data.tar.gz: 9ed83b1077de6d7404ef44a9ac09c2e558fa6a17bae7d0b8b60dff46e2f55227033ea483c7837c4b0056a91c7a945657ebd059e2500dddeffad608b68faabde4
@@ -1,3 +1,4 @@
1
1
  require 'uas2git/version'
2
+ require 'uas2git/lo_reader'
2
3
  require 'uas2git/migration'
3
4
  require 'uas2git/uas'
@@ -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
@@ -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
- blob = ''
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
 
@@ -1,3 +1,3 @@
1
1
  module UAS2Git
2
- VERSION = '0.9.3'
2
+ VERSION = '0.9.4'
3
3
  end
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.3
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