versioned_seeds 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.mdown CHANGED
@@ -8,23 +8,40 @@ Versioned Seeds provides a simple, conventions based, way to do that.
8
8
 
9
9
  ## Installation
10
10
 
11
+ Add this line to your `Gemfile` :
12
+
11
13
  gem 'versioned_seeds', :require => false
12
14
 
15
+ If you're using Git, as you should, be sure to call this in your shell :
16
+
17
+ $ echo ".versionned_seeds" >> .gitignore
18
+
13
19
  ## Usage
14
20
 
21
+ ### Get current version
22
+
15
23
  You can get the last imported seeds version :
16
24
 
17
25
  $ rake vs:status
18
26
  Last seeds: 0
19
27
 
28
+ ### Generate a seeding script
29
+
30
+ The generator will simply generate a timestamped file where you can put anything you want :
31
+
32
+ $ rails g versioned_seeds:seed_file some_seeding_script
33
+ create db/seeds/20111205155806_some_seeding_script.rb
34
+
35
+ ### Loading the scripts
36
+
20
37
  Given two seeds files :
21
38
 
22
39
  ``` ruby
23
- # db/seeds/001_create_users.rb
40
+ # db/seeds/20111205155801_create_users.rb
24
41
  User.create!(:username => 'admin', :password => 'password', :admin => true)
25
42
  User.create!(:username => 'user1', :password => 'password')
26
43
 
27
- # db/seeds/002_import_articles.rb
44
+ # db/seeds/20111205155802_import_articles.rb
28
45
  require 'csv'
29
46
 
30
47
  CSV.foreach('/some/file.csv') do |line|
@@ -35,18 +52,18 @@ end
35
52
  You can import only the first one by using the `vs:next` task :
36
53
 
37
54
  $ rake vs:next
38
- Loading: 001_create_users.rb
55
+ Loading: 20111205155801_create_users.rb
39
56
 
40
57
  $ rake vs:status
41
- Last seeds: 1
58
+ Last seeds: 20111205155801
42
59
 
43
60
  Or load all files using the `vs:all` task :
44
61
 
45
62
  $ rake vs:all
46
- Loading: 001_create_users.rb
47
- Loading: 002_import_articles.rb
63
+ Loading: 20111205155801_create_users.rb
64
+ Loading: 20111205155802_import_articles.rb
48
65
 
49
66
  $ rake vs:status
50
- Last seeds: 2
67
+ Last seeds: 20111205155802
51
68
 
52
69
  Once you're at some version, any file with a version equal or inferior to that version will not be imported next time.
@@ -1,3 +1,3 @@
1
1
  module VersionedSeeds
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versioned_seeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70330387431100 !ruby/object:Gem::Requirement
16
+ requirement: &70199370895400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70330387431100
24
+ version_requirements: *70199370895400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70330387428960 !ruby/object:Gem::Requirement
27
+ requirement: &70199370894860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '2'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70330387428960
35
+ version_requirements: *70199370894860
36
36
  description: Manage your seed scripts by versioning them
37
37
  email:
38
38
  - scourtois@cubyx.fr