Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QUIET option to the rake task #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 2.3.10
-------------

Features:

* Add `QUIET` option to the rake task.

Version 2.3.8
-------------

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ When loading lots of records, the above block-based syntax can be quite verbose.
Rake task
---------

Seed files can be run automatically using `rake db:seed_fu`. There are two options which you can pass:
Seed files can be run automatically using `rake db:seed_fu`. There are following options which you can pass:

* `rake db:seed_fu FIXTURE_PATH=path/to/fixtures` -- Where to find the fixtures
* `rake db:seed_fu FILTER=users,articles` -- Only run seed files with a filename matching the `FILTER`
* `rake db:seed_fu QUIET=true` -- Same effect as `SeedFu.quiet = true`

You can also do a similar thing in your code by calling `SeedFu.seed(fixture_paths, filter)`.

Expand Down
7 changes: 7 additions & 0 deletions lib/tasks/seed_fu.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace :db do

# to load files from RAILS_ROOT/features/fixtures
rake db:seed_fu FIXTURE_PATH=features/fixtures

# to disable output
rake db:seed_fu QUIET=true
EOS
task :seed_fu => :environment do
if ENV["FILTER"]
Expand All @@ -33,6 +36,10 @@ namespace :db do
fixture_paths = [ENV["FIXTURE_PATH"], ENV["FIXTURE_PATH"] + '/' + Rails.env]
end

if ENV["QUIET"] == "true"
SeedFu.quiet = true
end

SeedFu.seed(fixture_paths, filter)
end
end