wyrm 0.3.0 → 0.3.1
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/.travis.yml +6 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -3
- data/lib/wyrm/dump.rb +2 -2
- data/lib/wyrm/hole.rb +1 -2
- data/lib/wyrm/pump.rb +4 -3
- data/lib/wyrm/restore.rb +2 -2
- data/lib/wyrm/version.rb +1 -1
- data/lib/wyrm.rb +3 -2
- data/spec/hole_mouth_spec.rb +6 -2
- data/spec/pump_spec.rb +32 -2
- data/spec/wyrm_spec.rb +13 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2353cb241637c8a85c0f105bb190dd8edd4a5324
|
4
|
+
data.tar.gz: eb33c310f9030aeb682f310857f13d3dd8ff209d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e71ad3b6bac9fdf802ec232885b7f28af657bf9a2eb819e5386bebd990f0e705ee4d7ddd54bbb401c4b134581a6bde4c2baf81380bfd4ad49c1a601e37633e31
|
7
|
+
data.tar.gz: af05ca3f7371d87955cf7de056c93f79567d98b27e17718e6471d0b56ae3017e541a555b666c47e0f1daccbecc0c8a09bd89eb128a923c1039eebe911e5976a2
|
data/.travis.yml
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
# Wyrm
|
2
|
-
|
3
|
-
[](http://badge.fury.io/rb/wyrm)
|
1
|
+
# Wyrm [](http://badge.fury.io/rb/wyrm) [](https://travis-ci.org/djellemah/wyrm)
|
4
2
|
|
5
3
|
Transfer a database from one rdbms to another (eg mysql to postgres). Either via
|
6
4
|
a set of files, or direct from one db server to another.
|
data/lib/wyrm/dump.rb
CHANGED
@@ -11,8 +11,8 @@ require 'wyrm/logger'
|
|
11
11
|
# ds.call
|
12
12
|
# TODO possibly use Gem::Package::TarWriter to write tar files
|
13
13
|
class Wyrm::Dump
|
14
|
-
include PumpMaker
|
15
|
-
include SchemaTools
|
14
|
+
include Wyrm::PumpMaker
|
15
|
+
include Wyrm::SchemaTools
|
16
16
|
include Wyrm::Logger
|
17
17
|
|
18
18
|
def initialize( src_db, container = nil, pump: nil )
|
data/lib/wyrm/hole.rb
CHANGED
@@ -56,8 +56,7 @@ module Wyrm
|
|
56
56
|
def queue
|
57
57
|
@queue ||=
|
58
58
|
if RUBY_VERSION == '2.1.0'
|
59
|
-
|
60
|
-
Queue.new
|
59
|
+
raise "Queue broken in 2.1.0 possibly related to https://bugs.ruby-lang.org/issues/9302"
|
61
60
|
else
|
62
61
|
SizedQueue.new 5000
|
63
62
|
end
|
data/lib/wyrm/pump.rb
CHANGED
@@ -49,11 +49,12 @@ class Wyrm::Pump
|
|
49
49
|
@db.extension :pagination
|
50
50
|
|
51
51
|
# turn on postgres streaming if available
|
52
|
-
|
53
|
-
|
52
|
+
# also gets called for non-postgres dbs, but that seems to be fine.
|
53
|
+
if defined?( Sequel::Postgres ) && @db.is_a?(Sequel::Postgres::Database) && defined?(Sequel::Postgres.supports_streaming?) && Sequel::Postgres.supports_streaming?
|
54
54
|
@db.extension :pg_streaming
|
55
|
+
logger.info "Streaming for #{@db.uri}"
|
55
56
|
else
|
56
|
-
logger.info "No streaming for
|
57
|
+
logger.info "No streaming for #{@db.uri}"
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
data/lib/wyrm/restore.rb
CHANGED
@@ -16,8 +16,8 @@ require 'wyrm/schema_tools'
|
|
16
16
|
# end of they probably lengthy table restore process.
|
17
17
|
# TODO check if table has been restored already, and has the correct rows,
|
18
18
|
class Wyrm::Restore
|
19
|
-
include PumpMaker
|
20
|
-
include SchemaTools
|
19
|
+
include Wyrm::PumpMaker
|
20
|
+
include Wyrm::SchemaTools
|
21
21
|
include Wyrm::Logger
|
22
22
|
|
23
23
|
def initialize( container, dst_db, pump: nil, drop_tables: false )
|
data/lib/wyrm/version.rb
CHANGED
data/lib/wyrm.rb
CHANGED
data/spec/hole_mouth_spec.rb
CHANGED
@@ -2,7 +2,11 @@ require 'rspec'
|
|
2
2
|
|
3
3
|
require Pathname(__dir__) + '../lib/wyrm/hole.rb'
|
4
4
|
|
5
|
+
|
5
6
|
describe Wyrm::Hole::Mouth do
|
7
|
+
if RUBY_VERSION == '2.1.0'
|
8
|
+
it 'Queue broken on 2.1.0'
|
9
|
+
else
|
6
10
|
describe '#flush' do
|
7
11
|
it 'calls poison_queue' do
|
8
12
|
subject.should_receive(:poison_queue)
|
@@ -168,9 +172,9 @@ describe Wyrm::Hole::Mouth do
|
|
168
172
|
# has a logger which nothing else uses
|
169
173
|
it 'works' do
|
170
174
|
Wyrm::Hole::Mouth::RUBY_VERSION = '2.1.0'
|
171
|
-
subject.
|
172
|
-
subject.queue
|
175
|
+
->{subject.queue}.should raise_error(/broken in 2.1.0/)
|
173
176
|
Wyrm::Hole::Mouth.send :remove_const, :RUBY_VERSION
|
174
177
|
end
|
175
178
|
end
|
179
|
+
end #unless RUBY_VERSION == '2.1.0'
|
176
180
|
end
|
data/spec/pump_spec.rb
CHANGED
@@ -18,11 +18,41 @@ describe Pump do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '#table_name=' do
|
21
|
-
it 'invalidates caches'
|
21
|
+
it 'invalidates caches' do
|
22
|
+
subject.should_receive(:invalidate_cached_members)
|
23
|
+
subject.table_name = :big_face
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
describe '#db=' do
|
25
|
-
it 'invalidates caches'
|
28
|
+
it 'invalidates caches' do
|
29
|
+
subject.should_receive(:invalidate_cached_members)
|
30
|
+
subject.db = Sequel.sqlite
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'handles nil db' do
|
34
|
+
->{subject.db = nil}.should_not raise_error
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'adds pagination extension' do
|
38
|
+
db = Sequel.sqlite
|
39
|
+
db.should_receive(:extension).with(:pagination)
|
40
|
+
subject.db = db
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'turns on streaming for postgres' do
|
44
|
+
db = Sequel.postgres
|
45
|
+
db.should_receive(:extension).with(:pagination)
|
46
|
+
db.should_receive(:extension).with(:pg_streaming)
|
47
|
+
subject.db = db
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'no streaming for non-postgres' do
|
51
|
+
db = Sequel.sqlite
|
52
|
+
db.should_receive(:extension).with(:pagination)
|
53
|
+
db.should_not_receive(:extension).with(:pg_streaming)
|
54
|
+
subject.db = db
|
55
|
+
end
|
26
56
|
end
|
27
57
|
|
28
58
|
describe '#codec=' do
|
data/spec/wyrm_spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
# include this here because at least once I forgot to update this
|
4
|
+
# when file names changed
|
5
|
+
require Pathname(__dir__) + '../lib/wyrm.rb'
|
6
|
+
|
7
|
+
include Wyrm
|
8
|
+
|
9
|
+
describe Wyrm do
|
10
|
+
it 'has the right constants' do
|
11
|
+
Wyrm.constants.sort.should == [:Dump, :Hole, :Logger, :Pump, :PumpMaker, :Restore, :SchemaTools, :VERSION].sort
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wyrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Anderson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -175,6 +175,7 @@ extra_rdoc_files: []
|
|
175
175
|
files:
|
176
176
|
- ".gitignore"
|
177
177
|
- ".rvmrc"
|
178
|
+
- ".travis.yml"
|
178
179
|
- Gemfile
|
179
180
|
- LICENSE.txt
|
180
181
|
- README.md
|
@@ -198,6 +199,7 @@ files:
|
|
198
199
|
- spec/hole_mouth_spec.rb
|
199
200
|
- spec/pump_spec.rb
|
200
201
|
- spec/schema_tools_spec.rb
|
202
|
+
- spec/wyrm_spec.rb
|
201
203
|
- wyrm.gemspec
|
202
204
|
homepage: https://github.com/djellemah/wyrm
|
203
205
|
licenses:
|
@@ -219,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
219
221
|
version: '0'
|
220
222
|
requirements: []
|
221
223
|
rubyforge_project:
|
222
|
-
rubygems_version: 2.
|
224
|
+
rubygems_version: 2.1.11
|
223
225
|
signing_key:
|
224
226
|
specification_version: 4
|
225
227
|
summary: Transfer from one SQL rdbms to another
|
@@ -228,3 +230,4 @@ test_files:
|
|
228
230
|
- spec/hole_mouth_spec.rb
|
229
231
|
- spec/pump_spec.rb
|
230
232
|
- spec/schema_tools_spec.rb
|
233
|
+
- spec/wyrm_spec.rb
|