dump 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/dump.gemspec +1 -1
- data/lib/dump/reader.rb +6 -6
- data/spec/db/schema.rb +6 -0
- data/spec/dump/reader_spec.rb +6 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDIxYTMyY2NlYzQxMmQwNTI5YjA1YTY3NGY5ZTRmOThkNGUwY2M2Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTE0MDYxNmY2Yzg4MWVlYTlkNTcwMzBlZTUwOWI2M2JhN2ZjNTVlNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NmYzODJlMTkyYzEzNjUxMTE1MmZhZTE3ZjRlZTBjMWY0MDhjZTAzYzZiOWY1
|
10
|
+
YTdiNWEzMjA1NmRjNzBhZTBlMjJlNTVjZDNhMmI4NmViZmY1MTUwMmFjMzE3
|
11
|
+
MmViZmRjODUyMGFjMzAzZjE3MmM5NTI3MmRhYjk2MTA2YjRkYWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGM4YTJhMmMzOTYxNmQwZDE2MDJmY2I3NjYyMzU1ZmUxNzk2ZmVjNmM0YTY5
|
14
|
+
ZmU4ZjJjZWVjYWIwZTUyMGVkYTNmYjQ2ZGM3ZTU5NWM3OTEzOGRhYTNlNTYy
|
15
|
+
MDQxNTQzNWNjYzdhY2QyMzk5MzI0ZjhlNGUwYTBhYmVhZmJjNWY=
|
data/dump.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'dump'
|
5
|
-
s.version = '1.0.
|
5
|
+
s.version = '1.0.8'
|
6
6
|
s.summary = %q{Rails app rake and capistrano tasks to create and restore dumps of database and assets}
|
7
7
|
s.homepage = "http://github.com/toy/#{s.name}"
|
8
8
|
s.authors = ['Ivan Kuchin']
|
data/lib/dump/reader.rb
CHANGED
@@ -95,23 +95,23 @@ module Dump
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
|
-
def find_entry(
|
98
|
+
def find_entry(name)
|
99
99
|
stream.each do |entry|
|
100
|
-
if entry.full_name
|
100
|
+
if entry.full_name == name
|
101
101
|
# we can not return entry - after exiting stream.each the entry will be invalid and will read from tar start
|
102
102
|
return yield(entry)
|
103
103
|
end
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
-
def read_entry(
|
108
|
-
find_entry(
|
107
|
+
def read_entry(name)
|
108
|
+
find_entry(name) do |entry|
|
109
109
|
return entry.read
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
def read_entry_to_file(
|
114
|
-
find_entry(
|
113
|
+
def read_entry_to_file(name)
|
114
|
+
find_entry(name) do |entry|
|
115
115
|
Tempfile.open('dumper') do |temp|
|
116
116
|
temp.write(entry.read(4096)) until entry.eof?
|
117
117
|
temp.rewind
|
data/spec/db/schema.rb
CHANGED
@@ -4,4 +4,10 @@ ActiveRecord::Schema.define(:version => 0) do
|
|
4
4
|
t.column "#{type}_col", type
|
5
5
|
end
|
6
6
|
end
|
7
|
+
|
8
|
+
create_table :another_chickens, :force => true do |t|
|
9
|
+
%w[string text decimal datetime timestamp date ].each do |type|
|
10
|
+
t.column "#{type}_col", type
|
11
|
+
end
|
12
|
+
end
|
7
13
|
end
|
data/spec/dump/reader_spec.rb
CHANGED
@@ -143,29 +143,30 @@ describe Reader do
|
|
143
143
|
|
144
144
|
describe 'low level' do
|
145
145
|
before do
|
146
|
+
@e0 = double('e0', :full_name => 'another_first.dump', :read => 'another_first.dump_data')
|
146
147
|
@e1 = double('e1', :full_name => 'config', :read => 'config_data')
|
147
148
|
@e2 = double('e2', :full_name => 'first.dump', :read => 'first.dump_data')
|
148
149
|
@e3 = double('e3', :full_name => 'second.dump', :read => 'second.dump_data')
|
149
|
-
@stream = [@e1, @e2, @e3]
|
150
|
+
@stream = [@e0, @e1, @e2, @e3]
|
150
151
|
@dump = described_class.new('123.tgz')
|
151
152
|
allow(@dump).to receive(:stream).and_return(@stream)
|
152
153
|
end
|
153
154
|
|
154
155
|
describe 'find_entry' do
|
155
|
-
it 'finds
|
156
|
+
it 'finds entry in stream equal string' do
|
156
157
|
@dump.find_entry('config') do |entry|
|
157
158
|
expect(entry).to eq(@e1)
|
158
159
|
end
|
159
160
|
end
|
160
161
|
|
161
|
-
it 'finds
|
162
|
-
@dump.find_entry(
|
162
|
+
it 'finds exact entry in stream without confusion' do
|
163
|
+
@dump.find_entry('first.dump') do |entry|
|
163
164
|
expect(entry).to eq(@e2)
|
164
165
|
end
|
165
166
|
end
|
166
167
|
|
167
168
|
it 'returns result of block' do
|
168
|
-
expect(@dump.find_entry(
|
169
|
+
expect(@dump.find_entry('first.dump') do |_entry|
|
169
170
|
'hello'
|
170
171
|
end).to eq('hello')
|
171
172
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dump
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Kuchin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: archive-tar-minitar
|