seed_migration 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -12
  3. data/lib/seed_migration/version.rb +1 -1
  4. metadata +11 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b54739a076acaa3fc85f4683abb4d40b4c2ecff
4
- data.tar.gz: f0f5e426abb6a780124c484ddd0ff93a233892f7
3
+ metadata.gz: 7e633de5d286622fde82f7ce04b6cc0c13e7637a
4
+ data.tar.gz: 373a4dc6630258bb1ae761e54705bece7f963e9d
5
5
  SHA512:
6
- metadata.gz: 48e288fcec4d8b6d6d683f8ef2915435bb0c31db0cc8ae03cf5434380d8c5da4c05778a5b0a65324c4b980e4e0d840fbf636f9fddb365856e7fcfa96bc1fb0d6
7
- data.tar.gz: 36a349a3aecc231a3374c27c153ddcc4809cae68de74f845a993c99561e6e382c145f5fb24185f4e3b8fb43d7135ada4a43d73e4115c4bc99c1f2f7f5877ac57
6
+ metadata.gz: 36591834e7513fedecb675524531a9d853ee10efefb2739f1c7733d58a6f82b17e1b1461c9300c4f92e4438b6055cf89fc0be4b8417ea55a2b30165adb1e248f
7
+ data.tar.gz: 806ca774600313498545b9ea06a0864a8e2f6e13ea05b85fa140380cd185b9d11f052d19fcbbb0333dfc723d08347467cc238bb6ecb1cd5fe6fcd4bea4d32bcf
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- TODO : Add travis configuration, and then badge, eventually gemfury badge too.
1
+ [![Build Status](https://travis-ci.org/harrystech/seed_migration.svg?branch=master)](https://travis-ci.org/harrystech/seed_migration) [![Gem Version](https://badge.fury.io/rb/seed_migration.svg)](http://badge.fury.io/rb/seed_migration)
2
2
 
3
3
  # SeedMigration
4
4
 
@@ -14,11 +14,9 @@ Using this auto generated seed file makes it quick and easy to setup new environ
14
14
  Add `gem 'seed_migration'` to your `Gemfile`:
15
15
 
16
16
  ```ruby
17
- gem 'seed_migration', :github => 'harrystech/seed_migration'
17
+ gem 'seed_migration'
18
18
  ```
19
19
 
20
- Note : It'll soon be released on rubygems.org.
21
-
22
20
  ## Usage
23
21
 
24
22
  ### Install and run the internal migrations
@@ -32,7 +30,7 @@ That will create the table to keep track of data migrations.
32
30
 
33
31
  ### Generate a new migration
34
32
 
35
- `SeedMigration` adds a new rails generator :
33
+ You can use the generator :
36
34
 
37
35
  ```ruby
38
36
  rails g seed_migration AddFoo
@@ -81,7 +79,8 @@ rake seed:rollback MIGRATION=20140407162007_add_foo.rb
81
79
 
82
80
  ### Registering models
83
81
 
84
- By default, `SeedMigration` won't seen any data after running `seed:migrate`. You have to manually register the models in the configuration file.
82
+ By default no models are registered, so running seed migrations won't update the seeds file.
83
+ You have to manually register the models in the configuration file.
85
84
 
86
85
  Simply register a model:
87
86
 
@@ -113,16 +112,26 @@ This will create a `seeds.rb` containing all User and Product in the database:
113
112
  # It's strongly recommended to check this file into your version control system.
114
113
 
115
114
  ActiveRecord::Base.transaction do
116
- Product.create("id"=>1, "name"=>"foo", "created_at"=>"2014-04-04T15:42:24Z", "updated_at"=>"2014-04-04T15:42:24Z")
117
- Product.create("id"=>2, "name"=>"bar", "created_at"=>"2014-04-04T15:42:24Z", "updated_at"=>"2014-04-04T15:42:24Z")
115
+ Product.create("created_at"=>"2014-04-04T15:42:24Z", "id"=>1, "name"=>"foo", "updated_at"=>"2014-04-04T15:42:24Z")
116
+ Product.create("created_at"=>"2014-04-04T15:42:24Z", "id"=>2, "name"=>"bar", "updated_at"=>"2014-04-04T15:42:24Z")
118
117
  # ...
119
- User.create("id"=>1, "name"=>"admin", "created_at"=>"2014-04-04T15:42:24Z", "updated_at"=>"2014-04-04T15:42:24Z")
118
+ User.create("created_at"=>"2014-04-04T15:42:24Z", "id"=>1, "name"=>"admin", "updated_at"=>"2014-04-04T15:42:24Z")
120
119
  # ...
121
120
  end
122
121
 
123
122
  SeedMigration::Migrator.bootstrap(20140404193326)
124
123
  ```
125
124
 
125
+ ### Adding seed_migrations to an existing app
126
+
127
+ If your app already contains seeds, using this gem could cause some issues.
128
+ Here is the basic process to follow to ensure a smooth transition:
129
+
130
+ - Clean your local database, and seed it, that can be done with `rake db:reset`
131
+ - register all the models that were created in the original seeds file
132
+ - run `rake seed:migrate`
133
+ - At this point, your seeds file will be rewritten with all the `create!` statements
134
+ - Commit/Push the updated seeds file
126
135
 
127
136
  ### Deployment notes
128
137
 
@@ -154,12 +163,11 @@ end
154
163
 
155
164
  ## Configuration
156
165
 
157
- `SeedMigration` can be configured using an initializer file.
166
+ Use an initializer file for configuration.
158
167
 
159
168
  ### List of available configurations :
160
169
 
161
170
  - `extend_native_migration_task (default=false)`
162
- - `pending_migrations_warning_level (default=:warn)`
163
171
  - `ignore_ids (default=false)`
164
172
  - `migration_table_name (default='seed_migration_data_migrations')`: Override the table name for the internal model that holds the migrations
165
173
 
@@ -171,7 +179,6 @@ end
171
179
  SeedMigration.config do |c|
172
180
  c.migration_table_name = 'data_migrations'
173
181
  c.extend_native_migration_task = true
174
- c.pending_migrations_warning_level = :error
175
182
  end
176
183
 
177
184
  SeedMigration.register User do
@@ -1,3 +1,3 @@
1
1
  module SeedMigration
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy O'Neill
@@ -9,22 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-29 00:00:00.000000000 Z
12
+ date: 2014-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - ~>
19
- - !ruby/object:Gem::Version
20
- version: 3.2.17
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- version: 3.2.17
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: sqlite3
30
16
  requirement: !ruby/object:Gem::Requirement
@@ -71,16 +57,16 @@ dependencies:
71
57
  name: rspec-rails
72
58
  requirement: !ruby/object:Gem::Requirement
73
59
  requirements:
74
- - - '>='
60
+ - - '='
75
61
  - !ruby/object:Gem::Version
76
- version: '0'
62
+ version: 2.14.2
77
63
  type: :development
78
64
  prerelease: false
79
65
  version_requirements: !ruby/object:Gem::Requirement
80
66
  requirements:
81
- - - '>='
67
+ - - '='
82
68
  - !ruby/object:Gem::Version
83
- version: '0'
69
+ version: 2.14.2
84
70
  - !ruby/object:Gem::Dependency
85
71
  name: rspec-mocks
86
72
  requirement: !ruby/object:Gem::Requirement
@@ -103,20 +89,20 @@ executables: []
103
89
  extensions: []
104
90
  extra_rdoc_files: []
105
91
  files:
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
106
95
  - app/models/seed_migration/data_migration.rb
107
96
  - db/migrate/20140310150145_create_data_migrations.rb
108
97
  - lib/extra_tasks.rb
109
98
  - lib/generators/seed_migration/seed_migration_generator.rb
99
+ - lib/seed_migration.rb
110
100
  - lib/seed_migration/engine.rb
111
101
  - lib/seed_migration/migration.rb
112
102
  - lib/seed_migration/migrator.rb
113
103
  - lib/seed_migration/register_entry.rb
114
104
  - lib/seed_migration/version.rb
115
- - lib/seed_migration.rb
116
105
  - lib/tasks/seed_migration_tasks.rake
117
- - LICENSE.txt
118
- - Rakefile
119
- - README.md
120
106
  homepage: http://github.com/harrystech/seed_migration
121
107
  licenses:
122
108
  - MIT
@@ -137,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
123
  version: '0'
138
124
  requirements: []
139
125
  rubyforge_project:
140
- rubygems_version: 2.0.14
126
+ rubygems_version: 2.2.2
141
127
  signing_key:
142
128
  specification_version: 4
143
129
  summary: Rails Data Migration