rails-data-migrations 1.0.5 → 1.0.6

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: 22ee18a3ab4b6485ef10ad1fa5c46b28b54db4f7
4
- data.tar.gz: 6ea85d2b16f7b5f1298c0132845ed5665760f295
3
+ metadata.gz: 3a6b25e007eef003d75b2953380781470b2a7bd3
4
+ data.tar.gz: 153dc99e165bac154d41f9787be7438703d7af42
5
5
  SHA512:
6
- metadata.gz: 17878d736176ba8adc80acdbc3f96b898d6293f01a29674bd30ab7294191e1bad299a5b207f20917ae88b2530e4ce64a5637563b9e12873b49b205cfd9d5087a
7
- data.tar.gz: 52852c2dcd20bc6c8e8e22452febab5eaaa4dfc352db5f22556643c34bcaf0c0699daa85385c3e30d9357d1822a1aa9fb3d9b2463ae90e14f3ad449655fe392e
6
+ metadata.gz: ccc415203e5b66c467a6d4635905e57d9b673426ba59cfd4dae1545fdf8753e096e77f49693b52fdd7ceb4d0a271871b8fc56d4e740d0f031df945fa73a36cc9
7
+ data.tar.gz: f82dd38e3df83a050b3d85e550593371bdce3ee8e46385ede74f7361d5724ba9a7e5f861ba162e86022d6594183dc008da01d4e37ff17fc42a6a3071bf0a7622
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ Layout/TrailingBlankLines:
2
+ Enabled: false
3
+ Metrics/BlockLength:
4
+ Enabled: false
5
+ Metrics/LineLength:
6
+ Max: 120
7
+ Style/Documentation:
8
+ Enabled: false
9
+ Style/NumericLiterals:
10
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.1
5
- before_install: gem install bundler -v 1.13.6
4
+ - 2.3.4
5
+ - 2.4.1
6
+ script: appraisal install && appraisal rake && rubocop --fail-level R
data/Appraisals CHANGED
@@ -1,9 +1,9 @@
1
1
  appraise 'rails-4.0' do
2
- gem 'rails', '~> 4.0'
2
+ gem 'rails', '4.0.13'
3
3
  end
4
4
 
5
5
  appraise 'rails-4.1' do
6
- gem 'rails', '~> 4.1'
6
+ gem 'rails', '~> 4.1.0'
7
7
  end
8
8
 
9
9
  appraise 'rails-4.2.5' do
@@ -11,9 +11,13 @@ appraise 'rails-4.2.5' do
11
11
  end
12
12
 
13
13
  appraise 'rails-4.2' do
14
- gem 'rails', '~> 4.2'
14
+ gem 'rails', '~> 4.2.0'
15
15
  end
16
16
 
17
17
  appraise 'rails-5.0' do
18
- gem 'rails', '~> 5.0'
19
- end
18
+ gem 'rails', '~> 5.0.0'
19
+ end
20
+
21
+ appraise 'rails-5.1' do
22
+ gem 'rails', '~> 5.1.0'
23
+ end
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Rails Data Migrations
2
2
 
3
+ [![Build Status](https://travis-ci.org/OffgridElectric/rails-data-migrations.svg?branch=master)](https://travis-ci.org/OffgridElectric/rails-data-migrations)
4
+ [![Gem Version](https://badge.fury.io/rb/rails-data-migrations.svg)](https://badge.fury.io/rb/rails-data-migrations)
5
+
3
6
  ## Why?
4
7
 
5
8
  Have you ever run into a problem when alongside with DB schema migrations (managed by `rake db:migrate` in Rails)
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -5,7 +5,8 @@ class DataMigrationGenerator < Rails::Generators::NamedBase
5
5
  source_root File.expand_path('../templates', __FILE__)
6
6
 
7
7
  def create_migration_file
8
- migration_file_name = "#{RailsDataMigrations::Migrator.migrations_path}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{file_name}.rb"
8
+ migration_file_name =
9
+ "#{RailsDataMigrations::Migrator.migrations_path}/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_#{file_name}.rb"
9
10
  copy_file 'data_migration_generator.rb', migration_file_name do |content|
10
11
  content.sub(/ClassName/, file_name.camelize)
11
12
  end
@@ -1,6 +1,9 @@
1
+ # rubocop:disable Naming/FileName
2
+ require 'rails'
1
3
  require 'active_record'
2
4
  require 'active_record/data_migration'
3
5
  require 'rails_data_migrations/version'
4
6
  require 'rails_data_migrations/log_entry'
5
7
  require 'rails_data_migrations/migrator'
6
- require 'rails_data_migrations/railtie'
8
+ require 'rails_data_migrations/railtie'
9
+ # rubocop:enable Naming/FileName
@@ -1,3 +1,3 @@
1
1
  module RailsDataMigrations
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'.freeze
3
3
  end
@@ -24,6 +24,16 @@ namespace :data do
24
24
  end
25
25
  end
26
26
 
27
+ desc 'Mark all pending data migrations complete'
28
+ task reset: :init_migration do
29
+ source_versions = RailsDataMigrations::Migrator.migrations(migrations_path).collect(&:version)
30
+ applied_versions = RailsDataMigrations::Migrator.get_all_versions
31
+
32
+ (source_versions - applied_versions).sort.each do |version|
33
+ RailsDataMigrations::LogEntry.create!(version: version.to_s)
34
+ end
35
+ end
36
+
27
37
  namespace :migrate do
28
38
  desc 'Apply single data migration using VERSION'
29
39
  task up: :init_migration do
@@ -49,12 +59,12 @@ namespace :data do
49
59
 
50
60
  desc 'List pending migrations'
51
61
  task pending: :init_migration do
52
- puts "#{'% 16s' % 'Migration ID'} Migration Name"
62
+ puts "#{format('% 16s', 'Migration ID')} Migration Name"
53
63
  puts '--------------------------------------------------'
54
64
  migrator = RailsDataMigrations::Migrator
55
65
  migrator.open(migrator.migrations_path).pending_migrations.each do |m|
56
- puts "#{'% 16i' % m.version} #{m.name.to_s.titleize}"
66
+ puts "#{format('% 16i', m.version)} #{m.name.to_s.titleize}"
57
67
  end
58
68
  end
59
69
  end
60
- end
70
+ end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Sergey Glukhov']
9
9
  spec.email = ['sergey.glukhov@gmail.com']
10
10
 
11
- spec.summary = %q{Run your data migration tasks in a db:migrate-like manner}
11
+ spec.summary = 'Run your data migration tasks in a db:migrate-like manner'
12
12
  spec.homepage = 'https://github.com/OffgridElectric/rails-data-migrations'
13
13
  spec.license = 'MIT'
14
14
 
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rspec', '3.5.0'
26
26
  spec.add_development_dependency 'sqlite3', '~> 1.3'
27
27
  spec.add_development_dependency 'appraisal', '~> 2.1'
28
- end
28
+ spec.add_development_dependency 'rubocop'
29
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-data-migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Glukhov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.1'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description:
98
112
  email:
99
113
  - sergey.glukhov@gmail.com
@@ -103,6 +117,7 @@ extra_rdoc_files: []
103
117
  files:
104
118
  - ".gitignore"
105
119
  - ".rspec"
120
+ - ".rubocop.yml"
106
121
  - ".travis.yml"
107
122
  - Appraisals
108
123
  - Gemfile
@@ -139,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
154
  version: '0'
140
155
  requirements: []
141
156
  rubyforge_project:
142
- rubygems_version: 2.6.8
157
+ rubygems_version: 2.6.13
143
158
  signing_key:
144
159
  specification_version: 4
145
160
  summary: Run your data migration tasks in a db:migrate-like manner