Joe Van Dyk
2005-Nov-24  03:01 UTC
rake load_fixtures task doesn''t load fixtures in plugins?
I''ve got the login_engine plugin installed which has a fixtures for ''users''. When I load ''rake load_fixtures'', it doesn''t seem to load the login_engine''s fixtures into the development database. Should it? Or should it be another rake task? (i.e. rake load_plugin_fixtures) Joe
Joe Van Dyk
2005-Nov-24  03:10 UTC
Re: rake load_fixtures task doesn''t load fixtures in plugins?
On 11/23/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve got the login_engine plugin installed which has a fixtures for ''users''. > > When I load ''rake load_fixtures'', it doesn''t seem to load the > login_engine''s fixtures into the development database. > > Should it? Or should it be another rake task? (i.e. rake load_plugin_fixtures) > > JoeIn any event, here''s the additional rake task that will load all plugin fixtures: desc "Load plugin fixtures into the current environment''s database" task :load_plugin_fixtures => :environment do require ''active_record/fixtures'' ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) Dir.glob(File.join(RAILS_ROOT, ''vendor'', ''plugins'', ''*'', ''test'', ''fixtures'', ''*.yml'')).each do |fixture_file| Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, ''.*'')) end end Joe
James Adam
2005-Nov-24  10:08 UTC
Re: Re: rake load_fixtures task doesn''t load fixtures in plugins?
Since engines are a special-case plugin ''type'', it''s unlikely that the default rake tasks would support them. However, I can see it being a bit of a grey area, since testing plugins *is* supported. Regardless - I''ll add this task to the Engine plugin so it is available to everyone using engines, thanks Joe - james On 11/24/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 11/23/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''ve got the login_engine plugin installed which has a fixtures for ''users''. > > > > When I load ''rake load_fixtures'', it doesn''t seem to load the > > login_engine''s fixtures into the development database. > > > > Should it? Or should it be another rake task? (i.e. rake load_plugin_fixtures) > > > > Joe > > > In any event, here''s the additional rake task that will load all > plugin fixtures: > > desc "Load plugin fixtures into the current environment''s database" > task :load_plugin_fixtures => :environment do > require ''active_record/fixtures'' > ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) > Dir.glob(File.join(RAILS_ROOT, ''vendor'', ''plugins'', ''*'', ''test'', > ''fixtures'', ''*.yml'')).each do |fixture_file| > Fixtures.create_fixtures(File.dirname(fixture_file), > File.basename(fixture_file, ''.*'')) > end > end > > Joe > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Joe Van Dyk
2005-Nov-29  03:27 UTC
Re: Re: rake load_fixtures task doesn''t load fixtures in plugins?
On 11/24/05, James Adam <james.adam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Since engines are a special-case plugin ''type'', it''s unlikely that the > default rake tasks would support them. However, I can see it being a > bit of a grey area, since testing plugins *is* supported. > > Regardless - I''ll add this task to the Engine plugin so it is > available to everyone using engines, thanks JoeI think that task should work for all plugins that have fixtures, engines or no.> On 11/24/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 11/23/05, Joe Van Dyk <joevandyk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''ve got the login_engine plugin installed which has a fixtures for ''users''. > > > > > > When I load ''rake load_fixtures'', it doesn''t seem to load the > > > login_engine''s fixtures into the development database. > > > > > > Should it? Or should it be another rake task? (i.e. rake load_plugin_fixtures) > > > > > > Joe > > > > > > In any event, here''s the additional rake task that will load all > > plugin fixtures: > > > > desc "Load plugin fixtures into the current environment''s database" > > task :load_plugin_fixtures => :environment do > > require ''active_record/fixtures'' > > ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym) > > Dir.glob(File.join(RAILS_ROOT, ''vendor'', ''plugins'', ''*'', ''test'', > > ''fixtures'', ''*.yml'')).each do |fixture_file| > > Fixtures.create_fixtures(File.dirname(fixture_file), > > File.basename(fixture_file, ''.*'')) > > end > > end > > > > Joe > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >