dump 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +8 -8
  2. data/.rubocop.yml +53 -0
  3. data/.rubocop_todo.yml +33 -0
  4. data/.travis.yml +12 -3
  5. data/README.markdown +8 -0
  6. data/dump.gemspec +4 -1
  7. data/lib/dump.rb +1 -0
  8. data/lib/dump/capistrano.rb +7 -1
  9. data/lib/dump/capistrano/v2.rb +331 -0
  10. data/lib/dump/railtie.rb +1 -0
  11. data/lib/dump_rake.rb +17 -8
  12. data/lib/dump_rake/archive_tar_minitar_fix.rb +3 -1
  13. data/lib/dump_rake/assets.rb +1 -0
  14. data/lib/dump_rake/continious_timeout.rb +17 -17
  15. data/lib/dump_rake/dump.rb +27 -22
  16. data/lib/dump_rake/dump_reader.rb +62 -63
  17. data/lib/dump_rake/dump_writer.rb +20 -21
  18. data/lib/dump_rake/env.rb +12 -10
  19. data/lib/dump_rake/env/filter.rb +3 -0
  20. data/lib/dump_rake/rails_root.rb +1 -0
  21. data/lib/dump_rake/table_manipulation.rb +23 -20
  22. data/lib/generators/assets_config/assets_config_generator.rb +2 -0
  23. data/lib/tasks/assets.rake +1 -2
  24. data/lib/tasks/dump.rake +5 -6
  25. data/recipes/dump.rb +1 -343
  26. data/script/update_readme +5 -3
  27. data/spec/cycle_spec.rb +33 -30
  28. data/spec/dummy_rails_app.rb +42 -0
  29. data/spec/lib/dump_rake/dump_reader_spec.rb +80 -92
  30. data/spec/lib/dump_rake/dump_spec.rb +56 -58
  31. data/spec/lib/dump_rake/dump_writer_spec.rb +42 -43
  32. data/spec/lib/dump_rake/env/filter_spec.rb +9 -9
  33. data/spec/lib/dump_rake/env_spec.rb +21 -21
  34. data/spec/lib/dump_rake/rails_root_spec.rb +7 -7
  35. data/spec/lib/dump_rake/table_manipulation_spec.rb +57 -63
  36. data/spec/lib/dump_rake_spec.rb +76 -76
  37. data/spec/recipes/dump_spec.rb +241 -217
  38. data/spec/spec_helper.rb +1 -42
  39. data/spec/tasks/assets_spec.rb +18 -18
  40. data/spec/tasks/dump_spec.rb +18 -18
  41. metadata +21 -2
@@ -1,51 +1,10 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
2
 
3
- require 'rails/version'
4
-
5
- rails_version = Rails::VERSION::STRING.split('.')
6
-
7
- if rails_version[0].to_i < 3 && !Gem.respond_to?(:source_index)
8
- module Gem
9
- def self.source_index; sources; end
10
- SourceIndex = Specification
11
- end
12
- end
13
-
14
- environment_paths = (1..rails_version.length).map do |count|
15
- version_part = rails_version[0, count].join('.')
16
- File.expand_path("../dummy-#{version_part}/config/environment", __FILE__)
17
- end.reverse
18
-
19
- environment_paths.any? do |environment_path|
20
- if File.exist?("#{environment_path}.rb")
21
- require environment_path
22
- true
23
- end
24
- end || begin
25
- command = "RAILS_VERSION=#{rails_version.join('.')} bundle exec rails " + if rails_version[0].to_i < 3
26
- "spec/dummy-#{rails_version[0, 2].join('.')}"
27
- else
28
- "new spec/dummy-#{rails_version[0, 2].join('.')} -TSJ --skip-bundle"
29
- end
30
-
31
- abort [
32
- "No dummy app for rails version #{rails_version.join('.')}",
33
- "Create using `#{command}`",
34
- 'Tried:', *environment_paths
35
- ].join("\n")
36
- end
37
-
38
- $:.unshift '../lib/dump_rake'
3
+ require 'dummy_rails_app'
39
4
  require 'dump_rake'
40
5
 
41
- PLUGIN_SPEC_DIR = File.expand_path(File.dirname(__FILE__)) unless defined? PLUGIN_SPEC_DIR
42
6
  ActiveRecord::Base.logger = Logger.new(File.join(DumpRake::RailsRoot, 'log/dump.log'))
43
7
 
44
- DUMMY_SCHEMA_PATH = File.join(PLUGIN_SPEC_DIR, "db", "schema.rb") unless defined? DUMMY_SCHEMA_PATH
45
-
46
- class Chicken < ActiveRecord::Base
47
- end
48
-
49
8
  def grab_output
50
9
  real_stdout, $stdout = $stdout, StringIO.new
51
10
  real_stderr, $stderr = $stderr, StringIO.new
@@ -1,11 +1,11 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require "rake"
1
+ require 'spec_helper'
2
+ require 'rake'
3
3
 
4
- describe "rake assets" do
4
+ describe 'rake assets' do
5
5
  before do
6
6
  @rake = Rake::Application.new
7
7
  Rake.application = @rake
8
- load File.dirname(__FILE__) + '/../../lib/tasks/assets.rake'
8
+ load 'tasks/assets.rake'
9
9
  ENV['ASSETS'] = nil
10
10
  end
11
11
 
@@ -15,11 +15,11 @@ describe "rake assets" do
15
15
  public/images/b
16
16
  end_src
17
17
  expect(File).to receive(:readlines).with(File.join(DumpRake::RailsRoot, 'config/assets')).and_return(StringIO.new(data).readlines)
18
- @rake["assets"].invoke
18
+ @rake['assets'].invoke
19
19
  expect(ENV['ASSETS']).to eq('public/images/a:public/images/b')
20
20
  end
21
21
 
22
- it "should ignore comments in config/assets" do
22
+ it 'should ignore comments in config/assets' do
23
23
  data = <<-end_src
24
24
  #comment
25
25
  #comment
@@ -27,7 +27,7 @@ describe "rake assets" do
27
27
  public/images/b
28
28
  end_src
29
29
  allow(File).to receive(:readlines).and_return(StringIO.new(data).readlines)
30
- @rake["assets"].invoke
30
+ @rake['assets'].invoke
31
31
  expect(ENV['ASSETS']).to eq('public/images/a:public/images/b')
32
32
  end
33
33
 
@@ -38,31 +38,31 @@ describe "rake assets" do
38
38
  end_src
39
39
  allow(File).to receive(:readlines).and_return(StringIO.new(data).readlines)
40
40
  DumpRake::Env.with_env :assets => 'public/images' do
41
- @rake["assets"].invoke
41
+ @rake['assets'].invoke
42
42
  expect(ENV['ASSETS']).to eq('public/images')
43
43
  end
44
44
  end
45
45
 
46
- describe "delete" do
46
+ describe 'delete' do
47
47
  before do
48
48
  allow(FileUtils).to receive(:remove_entry)
49
49
  end
50
50
 
51
- it "should require assets task" do
52
- expect(@rake["assets:delete"].prerequisites).to include("assets")
51
+ it 'should require assets task' do
52
+ expect(@rake['assets:delete'].prerequisites).to include('assets')
53
53
  end
54
54
 
55
- describe "deleting existing assets" do
56
- it "should go through each asset from config" do
55
+ describe 'deleting existing assets' do
56
+ it 'should go through each asset from config' do
57
57
  allow(ENV).to receive(:[]).with('ASSETS').and_return('images:videos')
58
58
 
59
59
  expect(File).to receive(:expand_path).with('images', DumpRake::RailsRoot).and_return('')
60
60
  expect(File).to receive(:expand_path).with('videos', DumpRake::RailsRoot).and_return('')
61
61
 
62
- @rake["assets:delete"].invoke
62
+ @rake['assets:delete'].invoke
63
63
  end
64
64
 
65
- it "should glob all assets and delete content" do
65
+ it 'should glob all assets and delete content' do
66
66
  @assets = %w[images videos]
67
67
  allow(ENV).to receive(:[]).with('ASSETS').and_return(@assets.join(':'))
68
68
  @assets.each do |asset|
@@ -74,10 +74,10 @@ describe "rake assets" do
74
74
  end
75
75
  end
76
76
 
77
- @rake["assets:delete"].invoke
77
+ @rake['assets:delete'].invoke
78
78
  end
79
79
 
80
- it "should not glob risky paths" do
80
+ it 'should not glob risky paths' do
81
81
  @assets = %w[images / /private ../ ../.. ./../ dir/.. dir/../..]
82
82
  allow(ENV).to receive(:[]).with('ASSETS').and_return(@assets.join(':'))
83
83
 
@@ -85,7 +85,7 @@ describe "rake assets" do
85
85
  expect(Dir).to receive(:[]).with(File.join(DumpRake::RailsRoot, '*')).and_return([])
86
86
  expect(FileUtils).not_to receive(:remove_entry)
87
87
 
88
- @rake["assets:delete"].invoke
88
+ @rake['assets:delete'].invoke
89
89
  end
90
90
  end
91
91
  end
@@ -1,28 +1,28 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
- require "rake"
1
+ require 'spec_helper'
2
+ require 'rake'
3
3
 
4
- describe "rake dump" do
4
+ describe 'rake dump' do
5
5
  before do
6
6
  @rake = Rake::Application.new
7
7
  Rake.application = @rake
8
- load File.dirname(__FILE__) + '/../../lib/tasks/dump.rake'
8
+ load 'tasks/dump.rake'
9
9
  Rake::Task.define_task(:environment)
10
10
  end
11
11
 
12
12
  %w[versions create restore cleanup].each do |task|
13
13
  describe task do
14
- it "should require environment task" do
15
- expect(@rake["dump:#{task}"].prerequisites).to include("environment")
14
+ it 'should require environment task' do
15
+ expect(@rake["dump:#{task}"].prerequisites).to include('environment')
16
16
  end
17
17
  end
18
18
  end
19
19
 
20
- describe "versions" do
20
+ describe 'versions' do
21
21
  before do
22
- @task = @rake["dump:versions"]
22
+ @task = @rake['dump:versions']
23
23
  end
24
24
 
25
- it "should call DumpRake.versions" do
25
+ it 'should call DumpRake.versions' do
26
26
  expect(DumpRake).to receive(:versions)
27
27
  @task.invoke
28
28
  end
@@ -39,12 +39,12 @@ describe "rake dump" do
39
39
  end
40
40
  end
41
41
 
42
- describe "create" do
42
+ describe 'create' do
43
43
  before do
44
- @task = @rake["dump:create"]
44
+ @task = @rake['dump:create']
45
45
  end
46
46
 
47
- it "should call DumpRake.create" do
47
+ it 'should call DumpRake.create' do
48
48
  expect(DumpRake).to receive(:create)
49
49
  @task.invoke
50
50
  end
@@ -61,12 +61,12 @@ describe "rake dump" do
61
61
  end
62
62
  end
63
63
 
64
- describe "restore" do
64
+ describe 'restore' do
65
65
  before do
66
- @task = @rake["dump:restore"]
66
+ @task = @rake['dump:restore']
67
67
  end
68
68
 
69
- it "should call DumpRake.restore" do
69
+ it 'should call DumpRake.restore' do
70
70
  expect(DumpRake).to receive(:restore)
71
71
  @task.invoke
72
72
  end
@@ -83,12 +83,12 @@ describe "rake dump" do
83
83
  end
84
84
  end
85
85
 
86
- describe "cleanup" do
86
+ describe 'cleanup' do
87
87
  before do
88
- @task = @rake["dump:cleanup"]
88
+ @task = @rake['dump:cleanup']
89
89
  end
90
90
 
91
- it "should call DumpRake.cleanup" do
91
+ it 'should call DumpRake.cleanup' do
92
92
  expect(DumpRake).to receive(:cleanup)
93
93
  @task.invoke
94
94
  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
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Kuchin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: archive-tar-minitar
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.27'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0.27'
55
69
  description:
56
70
  email:
57
71
  executables: []
@@ -60,6 +74,8 @@ extra_rdoc_files: []
60
74
  files:
61
75
  - .autotest
62
76
  - .gitignore
77
+ - .rubocop.yml
78
+ - .rubocop_todo.yml
63
79
  - .travis.database.yml
64
80
  - .travis.yml
65
81
  - Gemfile
@@ -68,6 +84,7 @@ files:
68
84
  - dump.gemspec
69
85
  - lib/dump.rb
70
86
  - lib/dump/capistrano.rb
87
+ - lib/dump/capistrano/v2.rb
71
88
  - lib/dump/railtie.rb
72
89
  - lib/dump_rake.rb
73
90
  - lib/dump_rake/archive_tar_minitar_fix.rb
@@ -202,6 +219,7 @@ files:
202
219
  - spec/dummy-4.1/config/secrets.yml
203
220
  - spec/dummy-4.1/db/seeds.rb
204
221
  - spec/dummy-4.1/log/.keep
222
+ - spec/dummy_rails_app.rb
205
223
  - spec/lib/dump_rake/dump_reader_spec.rb
206
224
  - spec/lib/dump_rake/dump_spec.rb
207
225
  - spec/lib/dump_rake/dump_writer_spec.rb
@@ -355,6 +373,7 @@ test_files:
355
373
  - spec/dummy-4.1/config/secrets.yml
356
374
  - spec/dummy-4.1/db/seeds.rb
357
375
  - spec/dummy-4.1/log/.keep
376
+ - spec/dummy_rails_app.rb
358
377
  - spec/lib/dump_rake/dump_reader_spec.rb
359
378
  - spec/lib/dump_rake/dump_spec.rb
360
379
  - spec/lib/dump_rake/dump_writer_spec.rb