dump 1.0.7 → 1.0.8

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDJhMGZmMTE3NTJmMGNiYmRiYzM5MWMxOTdmZDljMWZmYjE3NDNkYQ==
4
+ NDIxYTMyY2NlYzQxMmQwNTI5YjA1YTY3NGY5ZTRmOThkNGUwY2M2Zg==
5
5
  data.tar.gz: !binary |-
6
- MDBkYzg0OGNiMmUxNjljYTI1NThlYzliMjE0ZjE3NDE5ZmE0YTgzNQ==
6
+ ZTE0MDYxNmY2Yzg4MWVlYTlkNTcwMzBlZTUwOWI2M2JhN2ZjNTVlNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjljY2QxNTkxNGM3NzJkMGRiZmM1ODdiZjIyNjk4ZDczMWU1NGJlOTU1YTQ4
10
- ZmI4Y2UzMjE1NjhlYjJjNTUyYTIwYzY1YzI4ZGVhMmUyZTlmY2ZlYzEzZjNm
11
- N2FmNGM0ZmM4ZWM4MzNlZDEzZmEwOTFiNGQyOGQ2Y2E5M2UwZjI=
9
+ NmYzODJlMTkyYzEzNjUxMTE1MmZhZTE3ZjRlZTBjMWY0MDhjZTAzYzZiOWY1
10
+ YTdiNWEzMjA1NmRjNzBhZTBlMjJlNTVjZDNhMmI4NmViZmY1MTUwMmFjMzE3
11
+ MmViZmRjODUyMGFjMzAzZjE3MmM5NTI3MmRhYjk2MTA2YjRkYWU=
12
12
  data.tar.gz: !binary |-
13
- YjEyY2Y5MTMwMzM2NmIyMzhhZDAxYTZiMTVkNmJlOTVmNTMyNzdhMWNlOTk4
14
- NmI1NmVkOGZhMTFjNDM2YTQxZWJhZDQzOWFkNDAyOGM1NmZlMjYyNWUyOGM5
15
- N2ZjNDU2NDNiZThiMjhjZGFjM2Y2ZjVmMjhlOGIwMjcyY2FjZTA=
13
+ OGM4YTJhMmMzOTYxNmQwZDE2MDJmY2I3NjYyMzU1ZmUxNzk2ZmVjNmM0YTY5
14
+ ZmU4ZjJjZWVjYWIwZTUyMGVkYTNmYjQ2ZGM3ZTU5NWM3OTEzOGRhYTNlNTYy
15
+ MDQxNTQzNWNjYzdhY2QyMzk5MzI0ZjhlNGUwYTBhYmVhZmJjNWY=
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'dump'
5
- s.version = '1.0.7'
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']
@@ -95,23 +95,23 @@ module Dump
95
95
  end
96
96
  end
97
97
 
98
- def find_entry(matcher)
98
+ def find_entry(name)
99
99
  stream.each do |entry|
100
- if entry.full_name.match(matcher)
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(matcher)
108
- find_entry(matcher) do |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(matcher)
114
- find_entry(matcher) do |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
@@ -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
@@ -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 first entry in stream equal string' do
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 first entry in stream matching regexp' do
162
- @dump.find_entry(/\.dump$/) do |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(/\.dump$/) do |_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.7
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-01-17 00:00:00.000000000 Z
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