seedbank 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/seedbank/dsl.rb CHANGED
@@ -13,7 +13,7 @@ module Seedbank
13
13
  def seed_task_from_file(seed_file)
14
14
  scopes = scope_from_seed_file(seed_file)
15
15
  fq_name = scopes.push(File.basename(seed_file, '.seeds.rb')).join(':')
16
- args = Rake::Task.task_defined?('db:abort_if_pending_migrations') ? { fq_name => 'db:abort_if_pending_migrations' } : fq_name
16
+ args = Rake::Task.task_defined?('db:abort_if_pending_migrations') ? { fq_name => 'db:abort_if_pending_migrations' } : { fq_name => :environment }
17
17
 
18
18
  define_seed_task(seed_file, args)
19
19
  end
@@ -24,7 +24,7 @@ module Seedbank
24
24
 
25
25
  def define_seed_task(seed_file, *args)
26
26
  task = Rake::Task.define_task(*args) do |seed_task|
27
- Seedbank::Runner.new(seed_task).module_eval(File.read(seed_file)) if File.exist?(seed_file)
27
+ Seedbank::Runner.new(seed_task).module_eval(File.read(seed_file), seed_file) if File.exist?(seed_file)
28
28
  end
29
29
  task.add_description "Load the seed data from #{seed_file}"
30
30
  task.name
@@ -1,3 +1,3 @@
1
1
  module Seedbank
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/tasks/seed.rake CHANGED
@@ -8,7 +8,7 @@ namespace :db do
8
8
  namespace :seed do
9
9
  # Create seed tasks for all the seeds in seeds_path and add them to the dependency
10
10
  # list along with the original db/seeds.rb.
11
- common_dependencies = glob_seed_files_matching('*.seeds.rb').map { |seed_file| seed_task_from_file(seed_file) }
11
+ common_dependencies = glob_seed_files_matching('*.seeds.rb').sort.map { |seed_file| seed_task_from_file(seed_file) }
12
12
 
13
13
  desc "Load the seed data from db/seeds.rb and db/seeds/*.seeds.rb."
14
14
  task 'common' => base_dependencies + common_dependencies
data/seedbank.gemspec CHANGED
@@ -9,6 +9,7 @@ Gem::Specification.new do |s|
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">=1.2.0") if s.respond_to?(:required_rubygems_version=)
11
11
  s.rubygems_version = %q{1.3.5}
12
+ s.license = "MIT"
12
13
 
13
14
  s.authors = ["James McCarthy"]
14
15
  s.email = %q{james2mccarthy@gmail.com}
@@ -21,6 +22,7 @@ Gem::Specification.new do |s|
21
22
  Extends Rails seeds to split out complex seeds into multiple
22
23
  files and lets each environment have it's own seeds.
23
24
  }
25
+ s.license = "MIT"
24
26
 
25
27
  s.files = `git ls-files`.split("\n")
26
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -36,7 +36,7 @@ describe 'Seedbank rake.task' do
36
36
  subject { Rake::Task['db:seed:common'] }
37
37
 
38
38
  it "is dependent on the common seeds and db:seed:original" do
39
- prerequisite_seeds = Dir[File.expand_path('../../../dummy/db/seeds/*.seeds.rb', __FILE__)].map do |seed_file|
39
+ prerequisite_seeds = Dir[File.expand_path('../../../dummy/db/seeds/*.seeds.rb', __FILE__)].sort.map do |seed_file|
40
40
  ['db', 'seed', File.basename(seed_file, '.seeds.rb')].join(':')
41
41
  end.unshift('db:seed:original')
42
42
 
@@ -90,7 +90,7 @@ describe 'Seedbank rake.task' do
90
90
  subject { Rake.application.lookup(environment, %w[db seed]) }
91
91
 
92
92
  it "is dependent on the seeds in the environment directory" do
93
- prerequisite_seeds = Dir[File.expand_path("../../../dummy/db/seeds/#{environment}/*.seeds.rb", __FILE__)].map do |seed_file|
93
+ prerequisite_seeds = Dir[File.expand_path("../../../dummy/db/seeds/#{environment}/*.seeds.rb", __FILE__)].sort.map do |seed_file|
94
94
  ['db', 'seed', environment, File.basename(seed_file, '.seeds.rb')].join(':')
95
95
  end.unshift('db:seed:common')
96
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seedbank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -119,7 +119,8 @@ files:
119
119
  - test/lib/tasks/seed_rake_test.rb
120
120
  - test/test_helper.rb
121
121
  homepage: http://github.com/james2m/seedbank
122
- licenses: []
122
+ licenses:
123
+ - MIT
123
124
  post_install_message: ! "\n ================================================================================\n\n
124
125
  \ Rails 2.x\n ---------\n If you are using Seedbank with Rails 2.x you will need
125
126
  to place the following at \n the end of your Rakefile so Rubygems can load the