db-populator 0.1.3 → 0.1.4

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/db-populator.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{db-populator}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Umang Chouhan"]
12
- s.date = %q{2011-05-12}
12
+ s.date = %q{2011-05-17}
13
13
  s.description = %q{Populator is a utility to parse data files.}
14
14
  s.email = %q{uchouhan@optimiscorp.com}
15
15
  s.extra_rdoc_files = [
@@ -30,8 +30,10 @@ Gem::Specification.new do |s|
30
30
  "lib/populator/errors.rb",
31
31
  "lib/populator/fakes.rb",
32
32
  "lib/populator/logger.rb",
33
+ "lib/tasks/populate.rake",
33
34
  "populator.gemspec",
34
- "spec/populator_spec.rb",
35
+ "spec/lib/populator_spec.rb",
36
+ "spec/lib/tasks/populate_spec.rb",
35
37
  "spec/spec_helper.rb"
36
38
  ]
37
39
  s.homepage = %q{http://github.com/optimis/db-populator}
@@ -0,0 +1,24 @@
1
+ require 'rake'
2
+
3
+ namespace :db do
4
+ desc 'Runs the populators defined in the configuration file'
5
+
6
+ task :populate => :environment do
7
+ populators.each { |populator| Kernel.const_get(populator).run }
8
+ end
9
+
10
+ private
11
+ def path
12
+ defined?(Rails) ? "#{Rails.root}/config/populate.yml" : "populate.yml"
13
+ end
14
+
15
+ def configuration
16
+ @configuration ||= YAML.load_file(path)
17
+ rescue
18
+ raise Exception, 'Missing configuration file. Add a populate.yml in the project directory or in the config/ directory for rails projects.' unless File.exists?(path)
19
+ end
20
+
21
+ def populators
22
+ configuration[:populators]
23
+ end
24
+ end
File without changes
@@ -0,0 +1,13 @@
1
+ require 'spec/spec_helper'
2
+ require 'populator/fakes'
3
+ require 'rake'
4
+ load 'tasks/populate.rake'
5
+
6
+ describe 'db:populate' do
7
+ it 'should run the fake populator' do
8
+ Rake::Task.define_task :environment
9
+ YAML.stub(:load_file).and_return({ :populators => [ 'FakePopulator' ]})
10
+ FakePopulator.should_receive :run
11
+ Rake::Task['db:populate'].invoke
12
+ end
13
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db-populator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Umang Chouhan
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-12 00:00:00 -07:00
18
+ date: 2011-05-17 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -133,8 +133,10 @@ files:
133
133
  - lib/populator/errors.rb
134
134
  - lib/populator/fakes.rb
135
135
  - lib/populator/logger.rb
136
+ - lib/tasks/populate.rake
136
137
  - populator.gemspec
137
- - spec/populator_spec.rb
138
+ - spec/lib/populator_spec.rb
139
+ - spec/lib/tasks/populate_spec.rb
138
140
  - spec/spec_helper.rb
139
141
  has_rdoc: true
140
142
  homepage: http://github.com/optimis/db-populator