data_migrate 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a61a9b037890457c24cc8cea7276360ae1fd56c
4
- data.tar.gz: f5f4fd95f631b962accb8c1709967ada6a771d22
3
+ metadata.gz: 6983740ef87afeb4aa83f557c1f42e5e4f062223
4
+ data.tar.gz: 91e0c313ec9ec3fed6b3483a94c35fefac8789f7
5
5
  SHA512:
6
- metadata.gz: 71d3e595a3ecc3e49b9509b6ae6250394c89514900d35b992480a609527d0a7413940c3ba06b274f74f5968d53a6b77bcf362c839e27c8f60d1352ff92c346a5
7
- data.tar.gz: b98a1f2a4ab114da88312dbfb56ef1710ecdc3aebf61c2f68d10240daa95eadafad8aa688611d3011aa32682134082635b2d78437bf6db091e5ececd72670c88
6
+ metadata.gz: abdb401fd44de7e22a1cb5b310cea84b147d95a4790f6b2b7dc6e33e878d9f42c8d94a4e73f7759d06550a2814f3133510c6a4bcfd43e6761366f2a045780775
7
+ data.tar.gz: 69c8dcef142680e1109d75ee2cced9b5179bb5dc6ba8216a0c62fca6926e6f63023644f98885981a372c065c9265162985874f5dbc989480d9a530c381fed945
data/Changelog.md CHANGED
@@ -1,6 +1,10 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## 2.2.0
5
+
6
+ ([bilby91](https://github.com/bilby91)) Capistrano support
7
+
4
8
  ## 2.1.0
5
9
 
6
10
  User `Rails.application.config.paths["db/migrate"]` instead of hard coded
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  Data Migrate
2
2
  ====
3
3
 
4
+ - [![Version](http://img.shields.io/gem/v/data_migrate.svg?style=flat-square)](https://rubygems.org/gems/data_migrate)
5
+ - [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://opensource.org/licenses/MIT)
6
+
4
7
  Run data migrations alongside schema migrations.
5
8
 
6
9
  Data migrations are stored in db/data. They act like schema
@@ -154,6 +157,20 @@ Going down instead of up would be the opposite.
154
157
 
155
158
  `rake db:migrate:status:with_data` provides and additional column to indicate which type of migration.
156
159
 
160
+ Capistrano Support
161
+ ------------------
162
+
163
+ The gem comes with a capistrano task that can be used instead of `capistrano/rails/migrations`.
164
+
165
+ Just add this line to your Capfile:
166
+
167
+ ```ruby
168
+ require 'capistrano/data_migrate'
169
+ ```
170
+
171
+ From now on capistrano will run `rake db:migrate:with_data` in every deploy.
172
+
173
+
157
174
  Thanks
158
175
  ------
159
176
  [Andrew J Vargo](http://github.com/ajvargo) Andrew was the original creator and maintainer of this project!
@@ -0,0 +1,3 @@
1
+ require 'capistrano'
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/data_migrate/migrate")
@@ -0,0 +1,41 @@
1
+ namespace :deploy do
2
+
3
+ desc 'Runs rake data:migrate if migrations are set'
4
+ task :migrate => [:set_rails_env] do
5
+ on fetch(:migration_servers) do
6
+ conditionally_migrate = fetch(:conditionally_migrate)
7
+ info '[deploy:migrate] Checking changes in db/migrate or db/data' if conditionally_migrate
8
+
9
+ if conditionally_migrate && (
10
+ test("diff -q #{release_path}/db/migrate #{current_path}/db/migrate") ||
11
+ test("diff -q #{release_path}/db/data #{current_path}/db/data")
12
+ )
13
+ info '[deploy:migrate] Skip `deploy:migrate` (nothing changed in db/migrate or db/data)'
14
+ else
15
+ info '[deploy:migrate] Run `rake db:migrate:with_data`'
16
+ invoke :'deploy:migrating_with_data'
17
+ end
18
+ end
19
+ end
20
+
21
+ desc 'Runs rake db:migrate:with_data'
22
+ task migrating_with_data: [:set_rails_env] do
23
+ on fetch(:migration_servers) do
24
+ within release_path do
25
+ with rails_env: fetch(:rails_env) do
26
+ execute :rake, 'db:migrate:with_data'
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ after 'deploy:updated', 'deploy:migrate'
33
+ end
34
+
35
+ namespace :load do
36
+ task :defaults do
37
+ set :conditionally_migrate, fetch(:conditionally_migrate, false)
38
+ set :migration_role, fetch(:migration_role, :db)
39
+ set :migration_servers, -> { primary(fetch(:migration_role)) }
40
+ end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "2.1.0"
2
+ VERSION = '2.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew J Vargo
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-28 00:00:00.000000000 Z
12
+ date: 2016-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4.0'
28
28
  description: Rake tasks to migrate data alongside schema changes.
@@ -33,13 +33,15 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
- - .gitignore
36
+ - ".gitignore"
37
37
  - Changelog.md
38
38
  - Gemfile
39
39
  - LICENSE
40
40
  - README.md
41
41
  - Rakefile
42
42
  - data_migrate.gemspec
43
+ - lib/capistrano/data_migrate.rb
44
+ - lib/capistrano/data_migrate/migrate.rb
43
45
  - lib/data_migrate.rb
44
46
  - lib/data_migrate/data_migrator.rb
45
47
  - lib/data_migrate/data_schema_migration.rb
@@ -62,17 +64,17 @@ require_paths:
62
64
  - lib
63
65
  required_ruby_version: !ruby/object:Gem::Requirement
64
66
  requirements:
65
- - - '>='
67
+ - - ">="
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
70
  required_rubygems_version: !ruby/object:Gem::Requirement
69
71
  requirements:
70
- - - '>='
72
+ - - ">="
71
73
  - !ruby/object:Gem::Version
72
74
  version: '0'
73
75
  requirements: []
74
76
  rubyforge_project: data_migrate
75
- rubygems_version: 2.0.14.1
77
+ rubygems_version: 2.2.3
76
78
  signing_key:
77
79
  specification_version: 4
78
80
  summary: Rake tasks to migrate data alongside schema changes.