seedbank 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  Seedbank
2
2
  ========
3
3
 
4
- Seedbank allows you to structure your Rails seed data instead of having it all dumped into one large file.
4
+ Seedbank allows you to structure your Rails seed data instead of having it all dumped into one large file. I find my seed data tended to fall into two categories. 1. Stuff that the entire application requires. 2. Stuff to populate my development and staging environments.
5
5
 
6
- Seedbank renames the original db:seed rake task to db:seed:original and makes it a dependency for all the other seeds. A new db:seed task is created that is dependent on db:seed:original, all the seeds in db/seeds plus all the seeds in the current Rails environment.
6
+ Seedbank assumes common seed data is under db/seeds and any directories under db/seeds/ are specific to an environment, so db/seeds/development is contains all your development only seed data.
7
7
 
8
8
  Example
9
9
  =======
10
10
 
11
- Your Seedbank seeds follow this structure;
11
+ Seedbank seeds follow this structure;
12
12
 
13
13
  db/seeds/
14
14
  bar.seeds.rb
@@ -20,7 +20,7 @@ This would generate the following Rake tasks
20
20
 
21
21
  rake db:seed # Loads the original seeds in db/seeds.rb followed by db/seeds/*.seeds.rb then db/seeds/environment/*.seeds.rb
22
22
  rake db:seed:bar # Loads seeds from bar.seeds.rb
23
- rake db:seed:development # Load just the seeds for the development environment
23
+ rake db:seed:development # Loads db/seeds.rb, db/seeds/*.seeds.rb and any seeds in db/seeds/development/*.seeds.rb.
24
24
  rake db:seed:development:users # Loads seeds from development/users.seeds.rb
25
25
  rake db:seed:foo # Loads seeds from foo.seeds.rb
26
26
  rake db:seed:original # Load the seed data from db/seeds.rb
@@ -35,6 +35,12 @@ would load the seeds in db/seeds.rb, db/seeds/bar.seeds.rb, db/seeds/foo.seeds/r
35
35
 
36
36
  would load the seeds in db/seeds.rb, db/seeds/bar.seeds.rb and db/seeds/foo.seeds/rb
37
37
 
38
+ The reason behind Seedbank is laziness. When I checkout or re-visit a project I don't want to mess around getting my environment setup I just want the code and a database loaded with data in a known state. Since the Rails core team were good enough to give us rake db:setup it would be rude not to use it.
39
+
40
+ rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
41
+
42
+ To achieve this slothful aim Seedbank renames the original db:seed rake task to db:seed:original, makes it a dependency for all the Seedbank seeds and adds a new db:seed task that loads all the common seeds in db/seeds plus all the seeds for the current Rails environment.
43
+
38
44
  Installation
39
45
  ============
40
46
 
@@ -11,7 +11,10 @@ namespace :db do
11
11
  end
12
12
 
13
13
  # Change db:seed task to run all the base seeds tasks defined above.
14
- desc "Loads the original seeds in db/seeds.rb followed by db/seeds/*.seeds.rb then db/seeds/environment/*.seeds.rb"
14
+ desc <<-EOT
15
+ Loads the original seeds in db/seeds.rb followed by db/seeds/*.seeds.rb then
16
+ db/seeds/environment/*.seeds.rb
17
+ EOT
15
18
  override_task :seed => base_dependencies + ["db:seed:#{Rails.env}"]
16
19
 
17
20
  # Glob through the directories under seeds_path assuming they are all environments
@@ -25,7 +28,7 @@ namespace :db do
25
28
  environment_dependencies << define_seed_task(seed_file)
26
29
  end
27
30
 
28
- desc "Load just the seeds for the #{environment} environment"
31
+ desc "Loads db/seeds.rb, db/seeds/*.seeds.rb and any seeds in db/seeds/#{environment}/*.seeds.rb."
29
32
  task ['seed', environment] => base_dependencies + environment_dependencies
30
33
  end
31
34
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{seedbank}
3
- s.version = "0.0.1"
3
+ s.version = "0.0.2"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">=1.2.0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["James McCarthy"]
@@ -21,8 +21,7 @@ Gem::Specification.new do |s|
21
21
  and have different seeds per environment.}
22
22
  s.test_files = Dir.glob('test/**/*')
23
23
 
24
- s.add_runtime_dependency('rails', ">=2.3.5")
25
- s.add_development_dependency('rails', '>=2.3.5')
24
+ s.add_runtime_dependency('rails')
26
25
  s.add_development_dependency('test-unit')
27
26
  end
28
27
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: seedbank
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - James McCarthy
@@ -21,31 +21,20 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 2.3.5
24
+ version: "0"
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rails
29
- prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: 2.3.5
36
- type: :development
37
- version_requirements: *id002
38
27
  - !ruby/object:Gem::Dependency
39
28
  name: test-unit
40
29
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
42
31
  none: false
43
32
  requirements:
44
33
  - - ">="
45
34
  - !ruby/object:Gem::Version
46
35
  version: "0"
47
36
  type: :development
48
- version_requirements: *id003
37
+ version_requirements: *id002
49
38
  description: |-
50
39
  Extends Rails seeds to split out complex seeds into multiple
51
40
  seed files and lets each environment load it's own seeds.
@@ -67,7 +56,6 @@ files:
67
56
  - lib/seedbank.rb
68
57
  - lib/tasks/seed.rake
69
58
  - MIT-LICENSE
70
- - rails/init.rb
71
59
  - Rakefile
72
60
  - README.md
73
61
  - seedbank.gemspec
@@ -1,2 +0,0 @@
1
- puts 'RAILS INIT'
2
- Dir["lib/tasks/*.rake"].each { |ext| load ext }