seed_migrator 0.4.1 → 0.7.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
- SHA1:
3
- metadata.gz: 0a3af50d4558939c15da3ac6a944670b669238f9
4
- data.tar.gz: 7a7c553bc0a3ed36c849aacc9d9be124ad801ae3
2
+ SHA256:
3
+ metadata.gz: 6f8d73e29f5bab51f3c9bd8d4b5e7c80948d8744a21012e590511a4a7689b626
4
+ data.tar.gz: 15a4ebfe6d675affe7b5d030dbda938ae0f932a6e403a29f517a5f08c7ef33ce
5
5
  SHA512:
6
- metadata.gz: d760a99929ae59627798fa6d3f4a114671c703d7feff67bd2f35b24f6cb4ef290ac3e8be26da3b0b99ecadfbb5c98b294986197df3d68b82d619a3a986cb6122
7
- data.tar.gz: 608b0e7ac3af0155cbc7773b721746e4d18b4068e89f248586f4b377d18ef84c2621ac606afa71bd37434d7e12768e356015d2866b237cbc2b9e4c79af15a4c0
6
+ metadata.gz: 6452b639a69d321b4bdf1a037a9477329fd324670cec105e9736cca7804a17a7662f7125aeea56b11a8a408378f80e37158e273438e8df69e98520fcf8e9fcda
7
+ data.tar.gz: 7799d4c17bc92b5e5d144d1a52fe3131d6805e9b4725bed2bfedc65ddab06fcc3b11b55fb45ea697b27ac128f0658508c61b69c56bfb5eadf622f35310ca8a68
data/README.md CHANGED
@@ -121,9 +121,9 @@ Two generators are added for your convenience:
121
121
 
122
122
  * install: Updates the seeds file as specified above and creates a custom
123
123
  data update module for engines. See
124
- {file:lib/generators/seed_migrator/create/USAGE} for examples
125
- * create: Creates new data\_update and migration files as specified above. See
126
124
  {file:lib/generators/seed_migrator/install/USAGE} for examples
125
+ * create: Creates new data\_update and migration files as specified above. See
126
+ {file:lib/generators/seed_migrator/create/USAGE} for examples
127
127
 
128
128
  NOTE: If you're using this from a Rails engine with Rails 3.2 and you're using
129
129
  RSpec to test, invoking the generator will likely put the generated files in
@@ -1,12 +1,12 @@
1
- require 'rails/generators/active_record'
2
- require 'generators/seed_migrator/helper'
1
+ require "rails/generators/active_record"
2
+ require "generators/seed_migrator/helper"
3
3
 
4
4
  # Generator to create a data update + associated migration
5
5
  class SeedMigrator::CreateGenerator < Rails::Generators::NamedBase
6
6
  include Generators::SeedMigrator::Helper
7
7
  include Rails::Generators::Migration
8
8
 
9
- source_root File.expand_path('../templates', __FILE__)
9
+ source_root File.expand_path("../templates", __FILE__)
10
10
 
11
11
  # Creates the data update file and the migration file.
12
12
  def create_helper_file
@@ -14,6 +14,7 @@ class SeedMigrator::CreateGenerator < Rails::Generators::NamedBase
14
14
  migration_template "data_update_migration.rb", "db/migrate/#{file_name}.rb"
15
15
  end
16
16
 
17
+ # The next available migration number for the given directory name.
17
18
  def self.next_migration_number dirname
18
19
  ActiveRecord::Generators::Base.next_migration_number dirname
19
20
  end
@@ -1,10 +1,10 @@
1
1
  class <%= data_update_class_name %> < SeedMigrator::Updater
2
2
  def perform_update
3
- # <%= class_name %>.create :type_code => 'very_shiny'
3
+ # <%= class_name %>.create :type_code => "very_shiny"
4
4
  end
5
5
 
6
6
  # Overridden in case we need to roll back this migration.
7
7
  def undo_update
8
- # <%= class_name %>.where(:type_code => 'very_shiny').first.delete
8
+ # <%= class_name %>.where(:type_code => "very_shiny").first.delete
9
9
  end
10
10
  end
@@ -1,11 +1,11 @@
1
- class <%= migration_class_name %> < ActiveRecord::Migration
1
+ class <%= migration_class_name %> < ActiveRecord::Migration<%= version_suffix %>
2
2
  include <%= application_class_name %>DataUpdate
3
3
 
4
4
  def up
5
- apply_update '<%= data_update_file_name %>'
5
+ apply_update "<%= data_update_file_name %>"
6
6
  end
7
7
 
8
8
  def down
9
- revert_update '<%= data_update_file_name %>'
9
+ revert_update "<%= data_update_file_name %>"
10
10
  end
11
11
  end
@@ -43,6 +43,17 @@ module Generators # :nodoc:
43
43
  def data_update_file_name
44
44
  "#{migration_number}_#{file_name}_data_update"
45
45
  end
46
+
47
+ # Version suffix for Rails 5 migrations.
48
+ #
49
+ # @return [String]
50
+ def version_suffix
51
+ major_version, minor_version, *_ = Rails.version.split(".")
52
+
53
+ return "" if major_version.to_i < 5
54
+
55
+ "[#{major_version}.#{minor_version}]"
56
+ end
46
57
  end
47
58
  end
48
59
  end
@@ -4,7 +4,7 @@ module <%= application_class_name %>DataUpdate
4
4
 
5
5
  # Returns the path where data updates are
6
6
  def root_updates_path
7
- <%= full_application_class_name %>.root.join('db','data_updates')
7
+ <%= full_application_class_name %>.root.join("db", "data_updates")
8
8
  end
9
9
 
10
10
  # Updates will run in production, but not in test an dev.
metadata CHANGED
@@ -1,44 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_migrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Shagall
8
8
  - Zach Belzer
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-29 00:00:00.000000000 Z
12
+ date: 2021-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.0'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '6.0'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '4.0'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '6.0'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: activerecord
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
- - - "~>"
38
+ - - ">="
33
39
  - !ruby/object:Gem::Version
34
40
  version: '4.0'
41
+ - - "<"
42
+ - !ruby/object:Gem::Version
43
+ version: '6.0'
35
44
  type: :runtime
36
45
  prerelease: false
37
46
  version_requirements: !ruby/object:Gem::Requirement
38
47
  requirements:
39
- - - "~>"
48
+ - - ">="
40
49
  - !ruby/object:Gem::Version
41
50
  version: '4.0'
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: '6.0'
42
54
  - !ruby/object:Gem::Dependency
43
55
  name: i18n
44
56
  requirement: !ruby/object:Gem::Requirement
@@ -122,7 +134,7 @@ files:
122
134
  homepage: https://github.com/HornsAndHooves
123
135
  licenses: []
124
136
  metadata: {}
125
- post_install_message:
137
+ post_install_message:
126
138
  rdoc_options: []
127
139
  require_paths:
128
140
  - lib
@@ -137,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
149
  - !ruby/object:Gem::Version
138
150
  version: '0'
139
151
  requirements: []
140
- rubyforge_project:
141
- rubygems_version: 2.2.2
142
- signing_key:
152
+ rubygems_version: 3.0.3
153
+ signing_key:
143
154
  specification_version: 4
144
155
  summary: Handle post-release data updates through migrations
145
156
  test_files: []