dump 1.1.0 → 1.2.0

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.
Files changed (110) hide show
  1. checksums.yaml +5 -13
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +47 -23
  4. data/.rubocop_todo.yml +105 -12
  5. data/.travis.yml +21 -31
  6. data/Appraisals +63 -0
  7. data/Gemfile +5 -26
  8. data/LICENSE.txt +1 -1
  9. data/README.markdown +3 -3
  10. data/dump.gemspec +11 -4
  11. data/lib/dump.rb +2 -2
  12. data/lib/dump/archive_tar_minitar.rb +1 -0
  13. data/lib/dump/assets.rb +1 -1
  14. data/lib/dump/capistrano.rb +3 -3
  15. data/lib/dump/capistrano/v2.rb +1 -0
  16. data/lib/dump/continious_timeout.rb +2 -2
  17. data/lib/dump/env/filter.rb +5 -5
  18. data/lib/dump/reader.rb +5 -1
  19. data/lib/dump/snapshot.rb +16 -12
  20. data/lib/dump/table_manipulation.rb +7 -1
  21. data/lib/dump/writer.rb +10 -3
  22. data/script/update_readme +1 -1
  23. data/spec/.gitignore +2 -0
  24. data/spec/cycle_spec.rb +1 -4
  25. data/spec/db/schema.rb +1 -1
  26. data/spec/dummy-5.0/.gitignore +21 -0
  27. data/spec/dummy-5.0/config.ru +5 -0
  28. data/spec/dummy-5.0/config/application.rb +25 -0
  29. data/spec/dummy-5.0/config/boot.rb +3 -0
  30. data/spec/dummy-5.0/config/cable.yml +9 -0
  31. data/spec/dummy-5.0/config/database.yml +25 -0
  32. data/spec/dummy-5.0/config/environment.rb +5 -0
  33. data/spec/dummy-5.0/config/environments/development.rb +47 -0
  34. data/spec/dummy-5.0/config/environments/production.rb +78 -0
  35. data/spec/dummy-5.0/config/environments/test.rb +42 -0
  36. data/spec/dummy-5.0/config/initializers/application_controller_renderer.rb +8 -0
  37. data/spec/dummy-5.0/config/initializers/backtrace_silencers.rb +7 -0
  38. data/spec/dummy-5.0/config/initializers/cookies_serializer.rb +5 -0
  39. data/spec/dummy-5.0/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/dummy-5.0/config/initializers/inflections.rb +16 -0
  41. data/spec/dummy-5.0/config/initializers/mime_types.rb +4 -0
  42. data/spec/dummy-5.0/config/initializers/new_framework_defaults.rb +26 -0
  43. data/spec/dummy-5.0/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy-5.0/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy-5.0/config/locales/en.yml +23 -0
  46. data/spec/dummy-5.0/config/puma.rb +47 -0
  47. data/spec/dummy-5.0/config/routes.rb +3 -0
  48. data/spec/dummy-5.0/config/secrets.yml +22 -0
  49. data/spec/dummy-5.0/config/spring.rb +6 -0
  50. data/spec/dummy-5.0/db/seeds.rb +7 -0
  51. data/spec/dummy-5.0/log/.keep +0 -0
  52. data/spec/dummy-5.1/.gitignore +23 -0
  53. data/spec/dummy-5.1/config.ru +5 -0
  54. data/spec/dummy-5.1/config/application.rb +31 -0
  55. data/spec/dummy-5.1/config/boot.rb +3 -0
  56. data/spec/dummy-5.1/config/cable.yml +10 -0
  57. data/spec/dummy-5.1/config/database.yml +25 -0
  58. data/spec/dummy-5.1/config/environment.rb +5 -0
  59. data/spec/dummy-5.1/config/environments/development.rb +47 -0
  60. data/spec/dummy-5.1/config/environments/production.rb +83 -0
  61. data/spec/dummy-5.1/config/environments/test.rb +42 -0
  62. data/spec/dummy-5.1/config/initializers/application_controller_renderer.rb +8 -0
  63. data/spec/dummy-5.1/config/initializers/backtrace_silencers.rb +7 -0
  64. data/spec/dummy-5.1/config/initializers/cookies_serializer.rb +5 -0
  65. data/spec/dummy-5.1/config/initializers/filter_parameter_logging.rb +4 -0
  66. data/spec/dummy-5.1/config/initializers/inflections.rb +16 -0
  67. data/spec/dummy-5.1/config/initializers/mime_types.rb +4 -0
  68. data/spec/dummy-5.1/config/initializers/wrap_parameters.rb +14 -0
  69. data/spec/dummy-5.1/config/locales/en.yml +33 -0
  70. data/spec/dummy-5.1/config/puma.rb +56 -0
  71. data/spec/dummy-5.1/config/routes.rb +3 -0
  72. data/spec/dummy-5.1/config/secrets.yml +32 -0
  73. data/spec/dummy-5.1/config/spring.rb +6 -0
  74. data/spec/dummy-5.1/db/seeds.rb +7 -0
  75. data/spec/dummy-5.1/log/.keep +0 -0
  76. data/spec/dummy-5.1/package.json +5 -0
  77. data/spec/dummy-5.2/.gitignore +28 -0
  78. data/spec/dummy-5.2/config.ru +5 -0
  79. data/spec/dummy-5.2/config/application.rb +33 -0
  80. data/spec/dummy-5.2/config/boot.rb +3 -0
  81. data/spec/dummy-5.2/config/cable.yml +10 -0
  82. data/spec/dummy-5.2/config/database.yml +25 -0
  83. data/spec/dummy-5.2/config/environment.rb +5 -0
  84. data/spec/dummy-5.2/config/environments/development.rb +54 -0
  85. data/spec/dummy-5.2/config/environments/production.rb +85 -0
  86. data/spec/dummy-5.2/config/environments/test.rb +46 -0
  87. data/spec/dummy-5.2/config/initializers/application_controller_renderer.rb +8 -0
  88. data/spec/dummy-5.2/config/initializers/backtrace_silencers.rb +7 -0
  89. data/spec/dummy-5.2/config/initializers/content_security_policy.rb +25 -0
  90. data/spec/dummy-5.2/config/initializers/cookies_serializer.rb +5 -0
  91. data/spec/dummy-5.2/config/initializers/filter_parameter_logging.rb +4 -0
  92. data/spec/dummy-5.2/config/initializers/inflections.rb +16 -0
  93. data/spec/dummy-5.2/config/initializers/mime_types.rb +4 -0
  94. data/spec/dummy-5.2/config/initializers/wrap_parameters.rb +14 -0
  95. data/spec/dummy-5.2/config/locales/en.yml +33 -0
  96. data/spec/dummy-5.2/config/puma.rb +34 -0
  97. data/spec/dummy-5.2/config/routes.rb +3 -0
  98. data/spec/dummy-5.2/config/spring.rb +6 -0
  99. data/spec/dummy-5.2/config/storage.yml +34 -0
  100. data/spec/dummy-5.2/db/seeds.rb +7 -0
  101. data/spec/dummy-5.2/package.json +5 -0
  102. data/spec/dummy_rails_app.rb +3 -5
  103. data/spec/dump/env_spec.rb +7 -7
  104. data/spec/dump/rails_root_spec.rb +1 -1
  105. data/spec/dump/reader_spec.rb +14 -14
  106. data/spec/dump/snapshot_spec.rb +24 -17
  107. data/spec/dump/table_manipulation_spec.rb +8 -5
  108. data/spec/dump/writer_spec.rb +3 -3
  109. data/spec/dump_spec.rb +1 -1
  110. metadata +189 -21
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "dummy-5_2",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -26,14 +26,12 @@ if (environment_path = environment_paths.find(&File.method(:exist?)))
26
26
  else
27
27
  app_path = "spec/dummy-#{version_parts.take(2).join('.')}"
28
28
 
29
- rails_command = if version < '3'
30
- "rails #{app_path}"
29
+ command = if version < '3'
30
+ "rails _#{version}_ #{app_path}"
31
31
  else
32
- "rails new #{app_path} -TSJ --skip-bundle"
32
+ "rails _#{version}_ new #{app_path} -TSJ --skip-bundle"
33
33
  end
34
34
 
35
- command = "RAILS_VERSION=#{version} bundle exec #{rails_command}"
36
-
37
35
  abort [
38
36
  "No dummy app for rails #{version}",
39
37
  "Create using `#{command}`",
@@ -114,16 +114,16 @@ describe Dump::Env do
114
114
  end
115
115
 
116
116
  it 'returns hash with symbol keys for every command' do
117
- expect(described_class.for_command(:create)).to eq({:desc => 'Description'})
118
- expect(described_class.for_command(:restore)).to eq({:like => 'Version'})
119
- expect(described_class.for_command(:versions)).to eq({:like => 'Version'})
117
+ expect(described_class.for_command(:create)).to eq(:desc => 'Description')
118
+ expect(described_class.for_command(:restore)).to eq(:like => 'Version')
119
+ expect(described_class.for_command(:versions)).to eq(:like => 'Version')
120
120
  expect(described_class.for_command(:bad)).to eq({})
121
121
  end
122
122
 
123
123
  it 'returns hash with symbol keys for every command when asking for string keys' do
124
- expect(described_class.for_command(:create, true)).to eq({'DESC' => 'Description'})
125
- expect(described_class.for_command(:restore, true)).to eq({'LIKE' => 'Version'})
126
- expect(described_class.for_command(:versions, true)).to eq({'LIKE' => 'Version'})
124
+ expect(described_class.for_command(:create, true)).to eq('DESC' => 'Description')
125
+ expect(described_class.for_command(:restore, true)).to eq('LIKE' => 'Version')
126
+ expect(described_class.for_command(:versions, true)).to eq('LIKE' => 'Version')
127
127
  expect(described_class.for_command(:bad, true)).to eq({})
128
128
  end
129
129
  end
@@ -133,7 +133,7 @@ describe Dump::Env do
133
133
  it 'converts keys to strings' do
134
134
  @env = {:desc => 'text', :tags => 'a b c', 'LEAVE' => 'none', 'OTHER' => 'data'}
135
135
  described_class.stringify!(@env)
136
- expect(@env).to eq({'DESC' => 'text', 'TAGS' => 'a b c', 'LEAVE' => 'none', 'OTHER' => 'data'})
136
+ expect(@env).to eq('DESC' => 'text', 'TAGS' => 'a b c', 'LEAVE' => 'none', 'OTHER' => 'data')
137
137
  end
138
138
  end
139
139
  end
@@ -38,6 +38,6 @@ describe Dump::RailsRoot do
38
38
  end
39
39
 
40
40
  it 'fails otherwaise' do
41
- expect{ rails_root }.to raise_error
41
+ expect{ rails_root }.to raise_error 'Unknown rails app root'
42
42
  end
43
43
  end
@@ -54,7 +54,7 @@ describe Reader do
54
54
  qqq: 123
55
55
  www: 345
56
56
  TEXT
57
- expect("#{@summary}").to eq(output.gsub(/#{output[/^\s+/]}/, ' '))
57
+ expect(@summary.to_s).to eq(output.gsub(/#{output[/^\s+/]}/, ' '))
58
58
  end
59
59
 
60
60
  it 'pluralizes' do
@@ -356,14 +356,14 @@ describe Reader do
356
356
 
357
357
  describe 'read_tables' do
358
358
  it 'verifies connection' do
359
- allow(@dump).to receive(:config).and_return({:tables => []})
359
+ allow(@dump).to receive(:config).and_return(:tables => [])
360
360
  expect(@dump).to receive(:verify_connection)
361
361
  @dump.read_tables
362
362
  end
363
363
 
364
364
  it 'calls read_table for each table in config' do
365
365
  allow(@dump).to receive(:verify_connection)
366
- allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
366
+ allow(@dump).to receive(:config).and_return(:tables => {'first' => 1, 'second' => 3})
367
367
 
368
368
  expect(@dump).to receive(:read_table).with('first', 1)
369
369
  expect(@dump).to receive(:read_table).with('second', 3)
@@ -373,7 +373,7 @@ describe Reader do
373
373
 
374
374
  describe 'when called with restore_tables' do
375
375
  it 'verifies connection and calls read_table for each table in restore_tables' do
376
- allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
376
+ allow(@dump).to receive(:config).and_return(:tables => {'first' => 1, 'second' => 3})
377
377
 
378
378
  expect(@dump).to receive(:verify_connection)
379
379
  expect(@dump).to receive(:read_table).with('first', 1)
@@ -385,7 +385,7 @@ describe Reader do
385
385
  end
386
386
 
387
387
  it 'does not verfiy connection or call read_table for empty restore_tables' do
388
- allow(@dump).to receive(:config).and_return({:tables => {'first' => 1, 'second' => 3}})
388
+ allow(@dump).to receive(:config).and_return(:tables => {'first' => 1, 'second' => 3})
389
389
 
390
390
  expect(@dump).not_to receive(:verify_connection)
391
391
  expect(@dump).not_to receive(:read_table)
@@ -473,7 +473,7 @@ describe Reader do
473
473
  expect(@dump).to receive(:quote_table_name).with('first').and_return('`first`')
474
474
  expect(@dump).to receive(:columns_insert_sql).with(@columns).and_return('(`id`, `name`)')
475
475
  @rows.each do |row|
476
- expect(@dump).to receive(:values_insert_sql).with(row){ |vs| vs.inspect }
476
+ expect(@dump).to receive(:values_insert_sql).with(row, &:inspect)
477
477
  end
478
478
 
479
479
  expect(@dump).to receive(:insert_into_table).with('`first`', '(`id`, `name`)', @rows.map(&:inspect))
@@ -497,7 +497,7 @@ describe Reader do
497
497
  end
498
498
 
499
499
  it 'does not read assets if config[:assets] is blank' do
500
- allow(@dump).to receive(:config).and_return({:assets => []})
500
+ allow(@dump).to receive(:config).and_return(:assets => [])
501
501
  expect(@dump).not_to receive(:find_entry)
502
502
  @dump.read_assets
503
503
  end
@@ -509,7 +509,7 @@ describe Reader do
509
509
 
510
510
  it 'calls assets:delete' do
511
511
  @assets = %w[images videos]
512
- allow(@dump).to receive(:config).and_return({:assets => @assets})
512
+ allow(@dump).to receive(:config).and_return(:assets => @assets)
513
513
  allow(@dump).to receive(:find_entry)
514
514
 
515
515
  expect(@task).to receive(:invoke)
@@ -519,7 +519,7 @@ describe Reader do
519
519
 
520
520
  it 'calls assets:delete with ASSETS set to config[:assets] joined with :' do
521
521
  @assets = %w[images videos]
522
- allow(@dump).to receive(:config).and_return({:assets => @assets})
522
+ allow(@dump).to receive(:config).and_return(:assets => @assets)
523
523
  allow(@dump).to receive(:find_entry)
524
524
 
525
525
  expect(@task).to receive(:invoke) do
@@ -532,7 +532,7 @@ describe Reader do
532
532
  describe 'when called with restore_assets' do
533
533
  it 'deletes files and dirs only in requested paths' do
534
534
  @assets = %w[images videos]
535
- allow(@dump).to receive(:config).and_return({:assets => @assets})
535
+ allow(@dump).to receive(:config).and_return(:assets => @assets)
536
536
 
537
537
  expect(Dump::Assets).to receive('glob_asset_children').with('images', '**/*').and_return(%w[images images/a.jpg images/b.jpg])
538
538
  expect(Dump::Assets).to receive('glob_asset_children').with('videos', '**/*').and_return(%w[videos videos/a.mov])
@@ -557,7 +557,7 @@ describe Reader do
557
557
 
558
558
  it 'does not delete any files and dirs for empty list' do
559
559
  @assets = %w[images videos]
560
- allow(@dump).to receive(:config).and_return({:assets => @assets})
560
+ allow(@dump).to receive(:config).and_return(:assets => @assets)
561
561
 
562
562
  expect(Dump::Assets).not_to receive('glob_asset_children')
563
563
 
@@ -577,7 +577,7 @@ describe Reader do
577
577
  describe 'old style' do
578
578
  it 'finds assets.tar' do
579
579
  @assets = %w[images videos]
580
- allow(@dump).to receive(:config).and_return({:assets => @assets})
580
+ allow(@dump).to receive(:config).and_return(:assets => @assets)
581
581
  allow(Dir).to receive(:glob).and_return([])
582
582
  allow(FileUtils).to receive(:remove_entry)
583
583
  allow(@stream).to receive(:each)
@@ -592,7 +592,7 @@ describe Reader do
592
592
  {'images' => {:files => 0, :total => 0}, 'videos' => {:files => 0, :total => 0}},
593
593
  ].each do |assets|
594
594
  it 'rewrites rewind method to empty method - to not raise exception, opens tar and extracts each entry' do
595
- allow(@dump).to receive(:config).and_return({:assets => assets})
595
+ allow(@dump).to receive(:config).and_return(:assets => assets)
596
596
  allow(Dir).to receive(:glob).and_return([])
597
597
  allow(FileUtils).to receive(:remove_entry)
598
598
 
@@ -626,7 +626,7 @@ describe Reader do
626
626
  {'images' => {:files => 0, :total => 0}, 'videos' => {:files => 0, :total => 0}},
627
627
  ].each do |assets|
628
628
  it 'extracts each entry' do
629
- allow(@dump).to receive(:config).and_return({:assets => assets})
629
+ allow(@dump).to receive(:config).and_return(:assets => assets)
630
630
  allow(Dir).to receive(:glob).and_return([])
631
631
  allow(FileUtils).to receive(:remove_entry)
632
632
 
@@ -120,8 +120,8 @@ describe Dump::Snapshot do
120
120
 
121
121
  describe 'with tags' do
122
122
  before do
123
- # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
124
- dumps_tags = [''] + %w[a a,d a,d,o a,d,s a,d,s,o a,o a,s a,s,o d d,o d,s d,s,o o s s,o z]
123
+ # 0 1 2 3 4 5 6 7 8 9 10 11 12 131415 16
124
+ dumps_tags = [''] + %w[a a,d a,d,o a,d,s a,d,s,o a,o a,s a,s,o d d,o d,s d,s,o o s s,o z]
125
125
  paths = dumps_tags.each_with_index.map do |dump_tags, i|
126
126
  path = dump_path("196504140659#{10 + i}@#{dump_tags}.tgz")
127
127
  expect(File).to receive(:file?).with(path).at_least(1).and_return(true)
@@ -135,15 +135,22 @@ describe Dump::Snapshot do
135
135
  end
136
136
 
137
137
  {
138
- 'x' => [],
139
- '+x' => [],
140
- 'z' => [16],
141
- 'a,d,s,o' => [1..15],
138
+ 'x' => [],
139
+
140
+ '+x' => [],
141
+
142
+ 'z' => [16],
143
+
144
+ 'a,d,s,o' => [1..15],
145
+
142
146
  '+a,+d,+s,+o' => [5],
143
- '-o' => [0, 1, 2, 4, 7, 9, 11, 14, 16],
147
+
148
+ '-o' => [0, 1, 2, 4, 7, 9, 11, 14, 16],
149
+
144
150
  'a,b,c,+s,-o' => [4, 7],
145
- '+a,+d' => [2, 3, 4, 5],
146
- '+d,+a' => [2, 3, 4, 5],
151
+
152
+ '+a,+d' => [2, 3, 4, 5],
153
+ '+d,+a' => [2, 3, 4, 5],
147
154
  }.each do |tags, ids|
148
155
  it "returns dumps filtered by #{tags}" do
149
156
  expect(described_class.list(:tags => tags)).to eq(described_class.list.values_at(*ids))
@@ -255,18 +262,18 @@ describe Dump::Snapshot do
255
262
 
256
263
  describe 'get_filter_tags' do
257
264
  it 'splits string and returns uniq non blank sorted tags' do
258
- expect(described_class.new('').send(:get_filter_tags, 'a,+b,+c,-d')).to eq({:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d]})
259
- expect(described_class.new('').send(:get_filter_tags, ' a , + b , + c , - d ')).to eq({:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d]})
260
- expect(described_class.new('').send(:get_filter_tags, ' a , + c , + b , - d ')).to eq({:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d]})
261
- expect(described_class.new('').send(:get_filter_tags, ' a , + b , + , - ')).to eq({:simple => %w[a], :mandatory => %w[b], :forbidden => []})
262
- expect(described_class.new('').send(:get_filter_tags, ' a , a , + b , + b , - d , - d ')).to eq({:simple => %w[a], :mandatory => %w[b], :forbidden => %w[d]})
265
+ expect(described_class.new('').send(:get_filter_tags, 'a,+b,+c,-d')).to eq(:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d])
266
+ expect(described_class.new('').send(:get_filter_tags, ' a , + b , + c , - d ')).to eq(:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d])
267
+ expect(described_class.new('').send(:get_filter_tags, ' a , + c , + b , - d ')).to eq(:simple => %w[a], :mandatory => %w[b c], :forbidden => %w[d])
268
+ expect(described_class.new('').send(:get_filter_tags, ' a , + b , + , - ')).to eq(:simple => %w[a], :mandatory => %w[b], :forbidden => [])
269
+ expect(described_class.new('').send(:get_filter_tags, ' a , a , + b , + b , - d , - d ')).to eq(:simple => %w[a], :mandatory => %w[b], :forbidden => %w[d])
263
270
  expect{ described_class.new('').send(:get_filter_tags, 'a,+a') }.not_to raise_error
264
- expect{ described_class.new('').send(:get_filter_tags, 'a,-a') }.to raise_error
265
- expect{ described_class.new('').send(:get_filter_tags, '+a,-a') }.to raise_error
271
+ expect{ described_class.new('').send(:get_filter_tags, 'a,-a') }.to raise_error ArgumentError, /clashes/
272
+ expect{ described_class.new('').send(:get_filter_tags, '+a,-a') }.to raise_error ArgumentError, /clashes/
266
273
  end
267
274
 
268
275
  it 'accepts non string' do
269
- expect(described_class.new('').send(:get_filter_tags, nil)).to eq({:simple => [], :mandatory => [], :forbidden => []})
276
+ expect(described_class.new('').send(:get_filter_tags, nil)).to eq(:simple => [], :mandatory => [], :forbidden => [])
270
277
  end
271
278
  end
272
279
 
@@ -141,7 +141,8 @@ describe Dump::TableManipulation do
141
141
  expect(self).to receive(:table_columns).with('first').and_return(
142
142
  [double(:column, :type => :integer, :limit => nil)] * 3 +
143
143
  [double(:column, :type => :string, :limit => nil)] * 3 +
144
- [double(:column, :type => :text, :limit => nil)])
144
+ [double(:column, :type => :text, :limit => nil)]
145
+ )
145
146
  expect(table_chunk_size('first')).to satisfy{ |n|
146
147
  (described_class::CHUNK_SIZE_MIN..described_class::CHUNK_SIZE_MAX).include?(n)
147
148
  }
@@ -149,13 +150,15 @@ describe Dump::TableManipulation do
149
150
 
150
151
  it 'does not return value less than CHUNK_SIZE_MIN' do
151
152
  expect(self).to receive(:table_columns).with('first').and_return(
152
- [double(:column, :type => :text, :limit => nil)] * 100)
153
+ [double(:column, :type => :text, :limit => nil)] * 100
154
+ )
153
155
  expect(table_chunk_size('first')).to eq(described_class::CHUNK_SIZE_MIN)
154
156
  end
155
157
 
156
158
  it 'does not return value more than CHUNK_SIZE_MAX' do
157
159
  expect(self).to receive(:table_columns).with('first').and_return(
158
- [double(:column, :type => :boolean, :limit => 1)] * 10)
160
+ [double(:column, :type => :boolean, :limit => 1)] * 10
161
+ )
159
162
  expect(table_chunk_size('first')).to eq(described_class::CHUNK_SIZE_MAX)
160
163
  end
161
164
  end
@@ -193,13 +196,13 @@ describe Dump::TableManipulation do
193
196
  describe 'each_table_row' do
194
197
  before do
195
198
  @row_count = 550
196
- @rows = Array.new(@row_count){ |i| {'id' => "#{i + 1}"} }
199
+ @rows = Array.new(@row_count){ |i| {'id' => i.succ.to_s} }
197
200
  end
198
201
 
199
202
  def verify_getting_rows
200
203
  i = 0
201
204
  each_table_row('first', @row_count) do |row|
202
- expect(row).to eq({'id' => "#{i + 1}"})
205
+ expect(row).to eq('id' => i.succ.to_s)
203
206
  i += 1
204
207
  end
205
208
  expect(i).to eq(@row_count)
@@ -71,7 +71,7 @@ describe Writer do
71
71
  @file = double('file')
72
72
  expect(@file).to receive(:write).with('qwfpgj')
73
73
 
74
- expect(@stream.tar).to receive(:add_file_simple).with('abc/def.txt', :mode => 0100444, :size => 6).and_yield(@file)
74
+ expect(@stream.tar).to receive(:add_file_simple).with('abc/def.txt', :mode => 0o100444, :size => 6).and_yield(@file)
75
75
 
76
76
  @dump.create_file('abc/def.txt') do |file|
77
77
  expect(file).to eq(@temp)
@@ -197,7 +197,7 @@ describe Writer do
197
197
 
198
198
  @dump.write_assets
199
199
  counts = {:files => 0, :total => 0}
200
- expect(@config[:assets]).to eq({'images/a' => counts, 'images/b' => counts, 'videos' => counts})
200
+ expect(@config[:assets]).to eq('images/a' => counts, 'images/b' => counts, 'videos' => counts)
201
201
  end
202
202
 
203
203
  it 'uses glob to find files' do
@@ -283,7 +283,7 @@ describe Writer do
283
283
  it 'dumps column names and values of each row' do
284
284
  @file = double('file')
285
285
  allow(@dump).to receive(:create_file).and_yield(@file)
286
- @config.replace({:tables => {'first' => 1, 'second' => 2}, :assets => %w[images videos]})
286
+ @config.replace(:tables => {'first' => 1, 'second' => 2}, :assets => %w[images videos])
287
287
 
288
288
  expect(Marshal).to receive(:dump).with(@config, @file)
289
289
  @dump.write_config
@@ -321,7 +321,7 @@ describe Dump do
321
321
  it "raises if called with :leave which is not a number or 'none'" do
322
322
  expect do
323
323
  described_class.cleanup(:leave => 'nothing')
324
- end.to raise_error
324
+ end.to raise_error ArgumentError, /number or "none"/
325
325
  end
326
326
  end
327
327
  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.1.0
4
+ version: 1.2.0
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-03-06 00:00:00.000000000 Z
11
+ date: 2018-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: archive-tar-minitar
@@ -28,61 +28,74 @@ dependencies:
28
28
  name: progress
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
- - - ! '>='
34
+ - - ">="
35
35
  - !ruby/object:Gem::Version
36
36
  version: 3.0.1
37
+ - - "!="
38
+ - !ruby/object:Gem::Version
39
+ version: 3.2.0
40
+ - - "!="
41
+ - !ruby/object:Gem::Version
42
+ version: 3.2.1
37
43
  type: :runtime
38
44
  prerelease: false
39
45
  version_requirements: !ruby/object:Gem::Requirement
40
46
  requirements:
41
- - - ~>
47
+ - - "~>"
42
48
  - !ruby/object:Gem::Version
43
49
  version: '3.0'
44
- - - ! '>='
50
+ - - ">="
45
51
  - !ruby/object:Gem::Version
46
52
  version: 3.0.1
53
+ - - "!="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.2.0
56
+ - - "!="
57
+ - !ruby/object:Gem::Version
58
+ version: 3.2.1
47
59
  - !ruby/object:Gem::Dependency
48
60
  name: rspec
49
61
  requirement: !ruby/object:Gem::Requirement
50
62
  requirements:
51
- - - ~>
63
+ - - "~>"
52
64
  - !ruby/object:Gem::Version
53
65
  version: '3.0'
54
66
  type: :development
55
67
  prerelease: false
56
68
  version_requirements: !ruby/object:Gem::Requirement
57
69
  requirements:
58
- - - ~>
70
+ - - "~>"
59
71
  - !ruby/object:Gem::Version
60
72
  version: '3.0'
61
73
  - !ruby/object:Gem::Dependency
62
74
  name: rubocop
63
75
  requirement: !ruby/object:Gem::Requirement
64
76
  requirements:
65
- - - ~>
77
+ - - "~>"
66
78
  - !ruby/object:Gem::Version
67
- version: '0.27'
79
+ version: '0.59'
68
80
  type: :development
69
81
  prerelease: false
70
82
  version_requirements: !ruby/object:Gem::Requirement
71
83
  requirements:
72
- - - ~>
84
+ - - "~>"
73
85
  - !ruby/object:Gem::Version
74
- version: '0.27'
86
+ version: '0.59'
75
87
  description:
76
88
  email:
77
89
  executables: []
78
90
  extensions: []
79
91
  extra_rdoc_files: []
80
92
  files:
81
- - .gitignore
82
- - .rubocop.yml
83
- - .rubocop_todo.yml
84
- - .travis.database.yml
85
- - .travis.yml
93
+ - ".gitignore"
94
+ - ".rubocop.yml"
95
+ - ".rubocop_todo.yml"
96
+ - ".travis.database.yml"
97
+ - ".travis.yml"
98
+ - Appraisals
86
99
  - Gemfile
87
100
  - LICENSE.txt
88
101
  - README.markdown
@@ -244,6 +257,82 @@ files:
244
257
  - spec/dummy-4.2/config/secrets.yml
245
258
  - spec/dummy-4.2/db/seeds.rb
246
259
  - spec/dummy-4.2/log/.keep
260
+ - spec/dummy-5.0/.gitignore
261
+ - spec/dummy-5.0/config.ru
262
+ - spec/dummy-5.0/config/application.rb
263
+ - spec/dummy-5.0/config/boot.rb
264
+ - spec/dummy-5.0/config/cable.yml
265
+ - spec/dummy-5.0/config/database.yml
266
+ - spec/dummy-5.0/config/environment.rb
267
+ - spec/dummy-5.0/config/environments/development.rb
268
+ - spec/dummy-5.0/config/environments/production.rb
269
+ - spec/dummy-5.0/config/environments/test.rb
270
+ - spec/dummy-5.0/config/initializers/application_controller_renderer.rb
271
+ - spec/dummy-5.0/config/initializers/backtrace_silencers.rb
272
+ - spec/dummy-5.0/config/initializers/cookies_serializer.rb
273
+ - spec/dummy-5.0/config/initializers/filter_parameter_logging.rb
274
+ - spec/dummy-5.0/config/initializers/inflections.rb
275
+ - spec/dummy-5.0/config/initializers/mime_types.rb
276
+ - spec/dummy-5.0/config/initializers/new_framework_defaults.rb
277
+ - spec/dummy-5.0/config/initializers/session_store.rb
278
+ - spec/dummy-5.0/config/initializers/wrap_parameters.rb
279
+ - spec/dummy-5.0/config/locales/en.yml
280
+ - spec/dummy-5.0/config/puma.rb
281
+ - spec/dummy-5.0/config/routes.rb
282
+ - spec/dummy-5.0/config/secrets.yml
283
+ - spec/dummy-5.0/config/spring.rb
284
+ - spec/dummy-5.0/db/seeds.rb
285
+ - spec/dummy-5.0/log/.keep
286
+ - spec/dummy-5.1/.gitignore
287
+ - spec/dummy-5.1/config.ru
288
+ - spec/dummy-5.1/config/application.rb
289
+ - spec/dummy-5.1/config/boot.rb
290
+ - spec/dummy-5.1/config/cable.yml
291
+ - spec/dummy-5.1/config/database.yml
292
+ - spec/dummy-5.1/config/environment.rb
293
+ - spec/dummy-5.1/config/environments/development.rb
294
+ - spec/dummy-5.1/config/environments/production.rb
295
+ - spec/dummy-5.1/config/environments/test.rb
296
+ - spec/dummy-5.1/config/initializers/application_controller_renderer.rb
297
+ - spec/dummy-5.1/config/initializers/backtrace_silencers.rb
298
+ - spec/dummy-5.1/config/initializers/cookies_serializer.rb
299
+ - spec/dummy-5.1/config/initializers/filter_parameter_logging.rb
300
+ - spec/dummy-5.1/config/initializers/inflections.rb
301
+ - spec/dummy-5.1/config/initializers/mime_types.rb
302
+ - spec/dummy-5.1/config/initializers/wrap_parameters.rb
303
+ - spec/dummy-5.1/config/locales/en.yml
304
+ - spec/dummy-5.1/config/puma.rb
305
+ - spec/dummy-5.1/config/routes.rb
306
+ - spec/dummy-5.1/config/secrets.yml
307
+ - spec/dummy-5.1/config/spring.rb
308
+ - spec/dummy-5.1/db/seeds.rb
309
+ - spec/dummy-5.1/log/.keep
310
+ - spec/dummy-5.1/package.json
311
+ - spec/dummy-5.2/.gitignore
312
+ - spec/dummy-5.2/config.ru
313
+ - spec/dummy-5.2/config/application.rb
314
+ - spec/dummy-5.2/config/boot.rb
315
+ - spec/dummy-5.2/config/cable.yml
316
+ - spec/dummy-5.2/config/database.yml
317
+ - spec/dummy-5.2/config/environment.rb
318
+ - spec/dummy-5.2/config/environments/development.rb
319
+ - spec/dummy-5.2/config/environments/production.rb
320
+ - spec/dummy-5.2/config/environments/test.rb
321
+ - spec/dummy-5.2/config/initializers/application_controller_renderer.rb
322
+ - spec/dummy-5.2/config/initializers/backtrace_silencers.rb
323
+ - spec/dummy-5.2/config/initializers/content_security_policy.rb
324
+ - spec/dummy-5.2/config/initializers/cookies_serializer.rb
325
+ - spec/dummy-5.2/config/initializers/filter_parameter_logging.rb
326
+ - spec/dummy-5.2/config/initializers/inflections.rb
327
+ - spec/dummy-5.2/config/initializers/mime_types.rb
328
+ - spec/dummy-5.2/config/initializers/wrap_parameters.rb
329
+ - spec/dummy-5.2/config/locales/en.yml
330
+ - spec/dummy-5.2/config/puma.rb
331
+ - spec/dummy-5.2/config/routes.rb
332
+ - spec/dummy-5.2/config/spring.rb
333
+ - spec/dummy-5.2/config/storage.yml
334
+ - spec/dummy-5.2/db/seeds.rb
335
+ - spec/dummy-5.2/package.json
247
336
  - spec/dummy_rails_app.rb
248
337
  - spec/dump/env/filter_spec.rb
249
338
  - spec/dump/env_spec.rb
@@ -260,24 +349,27 @@ files:
260
349
  homepage: http://github.com/toy/dump
261
350
  licenses:
262
351
  - MIT
263
- metadata: {}
352
+ metadata:
353
+ bug_tracker_uri: https://github.com/toy/dump/issues
354
+ documentation_uri: https://www.rubydoc.info/gems/dump/1.2.0
355
+ source_code_uri: https://github.com/toy/dump
264
356
  post_install_message:
265
357
  rdoc_options: []
266
358
  require_paths:
267
359
  - lib
268
360
  required_ruby_version: !ruby/object:Gem::Requirement
269
361
  requirements:
270
- - - ! '>='
362
+ - - ">="
271
363
  - !ruby/object:Gem::Version
272
364
  version: '0'
273
365
  required_rubygems_version: !ruby/object:Gem::Requirement
274
366
  requirements:
275
- - - ! '>='
367
+ - - ">="
276
368
  - !ruby/object:Gem::Version
277
369
  version: '0'
278
370
  requirements: []
279
371
  rubyforge_project: dump
280
- rubygems_version: 2.4.5
372
+ rubygems_version: 2.7.8
281
373
  signing_key:
282
374
  specification_version: 4
283
375
  summary: Rails app rake and capistrano tasks to create and restore dumps of database
@@ -418,6 +510,82 @@ test_files:
418
510
  - spec/dummy-4.2/config/secrets.yml
419
511
  - spec/dummy-4.2/db/seeds.rb
420
512
  - spec/dummy-4.2/log/.keep
513
+ - spec/dummy-5.0/.gitignore
514
+ - spec/dummy-5.0/config.ru
515
+ - spec/dummy-5.0/config/application.rb
516
+ - spec/dummy-5.0/config/boot.rb
517
+ - spec/dummy-5.0/config/cable.yml
518
+ - spec/dummy-5.0/config/database.yml
519
+ - spec/dummy-5.0/config/environment.rb
520
+ - spec/dummy-5.0/config/environments/development.rb
521
+ - spec/dummy-5.0/config/environments/production.rb
522
+ - spec/dummy-5.0/config/environments/test.rb
523
+ - spec/dummy-5.0/config/initializers/application_controller_renderer.rb
524
+ - spec/dummy-5.0/config/initializers/backtrace_silencers.rb
525
+ - spec/dummy-5.0/config/initializers/cookies_serializer.rb
526
+ - spec/dummy-5.0/config/initializers/filter_parameter_logging.rb
527
+ - spec/dummy-5.0/config/initializers/inflections.rb
528
+ - spec/dummy-5.0/config/initializers/mime_types.rb
529
+ - spec/dummy-5.0/config/initializers/new_framework_defaults.rb
530
+ - spec/dummy-5.0/config/initializers/session_store.rb
531
+ - spec/dummy-5.0/config/initializers/wrap_parameters.rb
532
+ - spec/dummy-5.0/config/locales/en.yml
533
+ - spec/dummy-5.0/config/puma.rb
534
+ - spec/dummy-5.0/config/routes.rb
535
+ - spec/dummy-5.0/config/secrets.yml
536
+ - spec/dummy-5.0/config/spring.rb
537
+ - spec/dummy-5.0/db/seeds.rb
538
+ - spec/dummy-5.0/log/.keep
539
+ - spec/dummy-5.1/.gitignore
540
+ - spec/dummy-5.1/config.ru
541
+ - spec/dummy-5.1/config/application.rb
542
+ - spec/dummy-5.1/config/boot.rb
543
+ - spec/dummy-5.1/config/cable.yml
544
+ - spec/dummy-5.1/config/database.yml
545
+ - spec/dummy-5.1/config/environment.rb
546
+ - spec/dummy-5.1/config/environments/development.rb
547
+ - spec/dummy-5.1/config/environments/production.rb
548
+ - spec/dummy-5.1/config/environments/test.rb
549
+ - spec/dummy-5.1/config/initializers/application_controller_renderer.rb
550
+ - spec/dummy-5.1/config/initializers/backtrace_silencers.rb
551
+ - spec/dummy-5.1/config/initializers/cookies_serializer.rb
552
+ - spec/dummy-5.1/config/initializers/filter_parameter_logging.rb
553
+ - spec/dummy-5.1/config/initializers/inflections.rb
554
+ - spec/dummy-5.1/config/initializers/mime_types.rb
555
+ - spec/dummy-5.1/config/initializers/wrap_parameters.rb
556
+ - spec/dummy-5.1/config/locales/en.yml
557
+ - spec/dummy-5.1/config/puma.rb
558
+ - spec/dummy-5.1/config/routes.rb
559
+ - spec/dummy-5.1/config/secrets.yml
560
+ - spec/dummy-5.1/config/spring.rb
561
+ - spec/dummy-5.1/db/seeds.rb
562
+ - spec/dummy-5.1/log/.keep
563
+ - spec/dummy-5.1/package.json
564
+ - spec/dummy-5.2/.gitignore
565
+ - spec/dummy-5.2/config.ru
566
+ - spec/dummy-5.2/config/application.rb
567
+ - spec/dummy-5.2/config/boot.rb
568
+ - spec/dummy-5.2/config/cable.yml
569
+ - spec/dummy-5.2/config/database.yml
570
+ - spec/dummy-5.2/config/environment.rb
571
+ - spec/dummy-5.2/config/environments/development.rb
572
+ - spec/dummy-5.2/config/environments/production.rb
573
+ - spec/dummy-5.2/config/environments/test.rb
574
+ - spec/dummy-5.2/config/initializers/application_controller_renderer.rb
575
+ - spec/dummy-5.2/config/initializers/backtrace_silencers.rb
576
+ - spec/dummy-5.2/config/initializers/content_security_policy.rb
577
+ - spec/dummy-5.2/config/initializers/cookies_serializer.rb
578
+ - spec/dummy-5.2/config/initializers/filter_parameter_logging.rb
579
+ - spec/dummy-5.2/config/initializers/inflections.rb
580
+ - spec/dummy-5.2/config/initializers/mime_types.rb
581
+ - spec/dummy-5.2/config/initializers/wrap_parameters.rb
582
+ - spec/dummy-5.2/config/locales/en.yml
583
+ - spec/dummy-5.2/config/puma.rb
584
+ - spec/dummy-5.2/config/routes.rb
585
+ - spec/dummy-5.2/config/spring.rb
586
+ - spec/dummy-5.2/config/storage.yml
587
+ - spec/dummy-5.2/db/seeds.rb
588
+ - spec/dummy-5.2/package.json
421
589
  - spec/dummy_rails_app.rb
422
590
  - spec/dump/env/filter_spec.rb
423
591
  - spec/dump/env_spec.rb