seed_migrations 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ Welcome to SeedMigrations
2
+ =========================
3
+
4
+ SeedMigrations is an extension for Ruby on Rails to make seeding behave like migrating.
5
+
6
+ Seeds are stored in db/seed and follow the naming convention of migrations (e.g. db/seed/20110630710959\_add\_bananas.rb).
7
+
8
+ All seeds are meant to be loaded once.
9
+
10
+ The default behaviour of the rake task db:seed is to load the db/seed.rb file every time you invoke it.
11
+ The rake task is just extended with additional behaviour, so the default behaviour still works.
12
+
13
+ Installation
14
+ ------------
15
+
16
+ Just add the gem to your Gemfile and:
17
+
18
+ $ bundle install
19
+
20
+ Usage
21
+ -----
22
+
23
+ **Create a seed**
24
+ To create a seed use the seed generator (**rails g seed_migration <name>**) and write your code in its method named 'up'.
25
+
26
+ **Load new seeds**
27
+ To load new seeds use the rake task **db:seed**.
28
+ A seed will be performed if there is no entry in the database table named seed\_migrations with the name of the seed (without ending).
29
+ After successful performance an entry is created.
30
+ Seeds are executed within a transaction (so if an exception occurs, the changes made by the seed are rolled back).
31
+ **Caution:** The default behaviour of the rake task still works. The file db/seeds.rb is loaded whenever you invoke it. Think about what fits you most (probably leave the file empty).
32
+
33
+ **Migrating from old behaviour**
34
+ If you used the default seeding behaviour but want your code to be executed just once, move it to an initial seed and keep db/seed.rb empty.
35
+
36
+ **Reload the last seed**
37
+ To **reload the last successfully performed seed** use the rake task **db:seed:last**. This seed will be performed even if it was performed before.
38
+
39
+ This project rocks and uses MIT-LICENSE.
@@ -1,4 +1,4 @@
1
- class <%= file_name.camelize %> < ActiveRecord::Seed
1
+ class <%= file_name.camelize %> < ActiveRecord::SeedMigration
2
2
 
3
3
  def self.up
4
4
 
@@ -1,3 +1,3 @@
1
1
  module SeedMigrations
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-12 00:00:00.000000000 Z
13
+ date: 2012-06-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2151927980 !ruby/object:Gem::Requirement
17
+ requirement: &2151916540 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.2.3
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2151927980
25
+ version_requirements: *2151916540
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: sqlite3
28
- requirement: &2151927480 !ruby/object:Gem::Requirement
28
+ requirement: &2151915820 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2151927480
36
+ version_requirements: *2151915820
37
37
  description: Handle seeding like migrating
38
38
  email:
39
39
  - admin@onrooby.com
@@ -50,7 +50,7 @@ files:
50
50
  - lib/tasks/seed_migrations_tasks.rake
51
51
  - MIT-LICENSE
52
52
  - Rakefile
53
- - README.rdoc
53
+ - README.md
54
54
  - test/dummy/app/assets/javascripts/application.js
55
55
  - test/dummy/app/assets/stylesheets/application.css
56
56
  - test/dummy/app/controllers/application_controller.rb
data/README.rdoc DELETED
@@ -1,3 +0,0 @@
1
- = Seeding
2
-
3
- This project rocks and uses MIT-LICENSE.