Hello all, I have a rails app using legacy MSSQL db that is 1.5Gb... so running :prepare_test_database on every test run is very very painful on front-loaded processing time. In 0.13.1 I edited the rake tasks to make :test_units and :test_functional depend only on :environment... I am responsible for running :clone_to_test_db on my own. How can I override the 0.14.2 rake tasks :test_units and :test_functional in only my one project? Thanks. -- Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Peter Fitzgibbons wrote:> Hello all, > > I have a rails app using legacy MSSQL db that is 1.5Gb... so running > :prepare_test_database on every test run is very very painful on > front-loaded processing time. > In 0.13.1 I edited the rake tasks to make :test_units and > :test_functional depend only on :environment... I am responsible for > running :clone_to_test_db on my own. > > How can I override the 0.14.2 rake tasks :test_units and > :test_functional in only my one project? > > Thanks.Hello, I put the code at the bottom of this message into a new file named ''lib/tasks/000_redefine_task.rake'' and then I would create another file named ''lib/tasks/my_tests.rake'' or something like that and does this: redefine_task :test_units => :environment Rake::TestTask.new(:test_units) do |t| t.libs << "test" t.pattern = ''test/unit/**/*_test.rb'' t.verbose = true end redefine_task :test_units => ::environment Rake::TestTask.new(:test_functional) do |t| t.libs << "test" t.pattern = ''test/functional/**/*_test.rb'' t.verbose = true end BTW, if this doesn''t work, you may need to apply this patch to RoR, which is now in trunk: $ svn diff -r 2739:2740 Index: railties/lib/tasks/rails.rb ==================================================================--- railties/lib/tasks/rails.rb (revision 2739) +++ railties/lib/tasks/rails.rb (revision 2740) @@ -4,5 +4,5 @@ Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } # Load any custom rakefile extensions -Dir["./lib/tasks/**/*.rake"].each { |ext| load ext } -Dir["./vendor/plugins/*/tasks/**/*.rake"].each { |ext| load ext } \ No newline at end of file +Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext } +Dir["./vendor/plugins/*/tasks/**/*.rake"].sort.each { |ext| load ext } \ No newline at end of file Regards, Blair -- Blair Zajac, Ph.D. <blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org> Subversion and Orca training and consulting http://www.orcaware.com/svn/ # Rake allows the same task name to be specified multiple times, where # each successive task definition appends to a list of actions to # perform. Therefore, an application specific task cannot redefine a # previously defined task. These methods here allow tasks to be # redefined and renamed. module Rake class Task # Clear all existing actions for the given task and then set the # action for the task to the given block. def self.redefine_task(args, &block) task_name, deps = resolve_args(args) TASKS.delete(task_name.to_s) define_task(args, &block) end end end # Clear all existing actions for the given task and then set the # action for the task to the given block. def redefine_task(args, &block) Rake::Task.redefine_task(args, &block) end # Alias one task name to another task name. This let''s a following # task rename the original task and still depend upon it. def alias_task(new_name, old_name) Rake::Task::TASKS[new_name.to_s] = Rake::Task::TASKS.delete(old_name.to_s) end
I have documented a similar workaround to remove database initialization when running a specific target here: http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag e-control The key to this is to take out the pre-requisite for cloning the database from the test tasks. This allows the rest of the task chain to remain undisturbed, and reduces the amount of code you have to copy from the Rails .rake files. In Peter''s case, you could unconditionally remove the prepare_test_database tasks. Here''s the entire code: module Rake class Task def remove_prerequisite(task_name) name = task_name.to_s @prerequisites.delete(name) end end end Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa se) -----Original Message----- From: Blair Zajac [mailto:blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org] Sent: Sunday, October 30, 2005 9:26 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] 0.14.2 Rake task override ? Peter Fitzgibbons wrote:> Hello all, > > I have a rails app using legacy MSSQL db that is 1.5Gb... so running > :prepare_test_database on every test run is very very painful on > front-loaded processing time. > In 0.13.1 I edited the rake tasks to make :test_units and > :test_functional depend only on :environment... I am responsible for > running :clone_to_test_db on my own. > > How can I override the 0.14.2 rake tasks :test_units and > :test_functional in only my one project? > > Thanks.Hello, I put the code at the bottom of this message into a new file named ''lib/tasks/000_redefine_task.rake'' and then I would create another file named ''lib/tasks/my_tests.rake'' or something like that and does this: redefine_task :test_units => :environment Rake::TestTask.new(:test_units) do |t| t.libs << "test" t.pattern = ''test/unit/**/*_test.rb'' t.verbose = true end redefine_task :test_units => ::environment Rake::TestTask.new(:test_functional) do |t| t.libs << "test" t.pattern = ''test/functional/**/*_test.rb'' t.verbose = true end BTW, if this doesn''t work, you may need to apply this patch to RoR, which is now in trunk: $ svn diff -r 2739:2740 Index: railties/lib/tasks/rails.rb ==================================================================--- railties/lib/tasks/rails.rb (revision 2739) +++ railties/lib/tasks/rails.rb (revision 2740) @@ -4,5 +4,5 @@ Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } # Load any custom rakefile extensions -Dir["./lib/tasks/**/*.rake"].each { |ext| load ext } -Dir["./vendor/plugins/*/tasks/**/*.rake"].each { |ext| load ext } \ No newline at end of file +Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext } +Dir["./vendor/plugins/*/tasks/**/*.rake"].sort.each { |ext| load ext } \ No newline at end of file Regards, Blair -- Blair Zajac, Ph.D. <blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org> Subversion and Orca training and consulting http://www.orcaware.com/svn/ # Rake allows the same task name to be specified multiple times, where # each successive task definition appends to a list of actions to # perform. Therefore, an application specific task cannot redefine a # previously defined task. These methods here allow tasks to be # redefined and renamed. module Rake class Task # Clear all existing actions for the given task and then set the # action for the task to the given block. def self.redefine_task(args, &block) task_name, deps = resolve_args(args) TASKS.delete(task_name.to_s) define_task(args, &block) end end end # Clear all existing actions for the given task and then set the # action for the task to the given block. def redefine_task(args, &block) Rake::Task.redefine_task(args, &block) end # Alias one task name to another task name. This let''s a following # task rename the original task and still depend upon it. def alias_task(new_name, old_name) Rake::Task::TASKS[new_name.to_s] = Rake::Task::TASKS.delete(old_name.to_s) end _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 10/31/05, Tom Fakes <tom-3mLyhfhPcFMAvxtiuMwx3w@public.gmane.org> wrote:> > I have documented a similar workaround to remove database initialization > when running a specific target here: > > > http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag > e-control > > The key to this is to take out the pre-requisite for cloning the database > from the test tasks. This allows the rest of the task chain to remain > undisturbed, and reduces the amount of code you have to copy from the > Rails > .rake files. > > In Peter''s case, you could unconditionally remove the > prepare_test_database > tasks. Here''s the entire code: > > module Rake > class Task > def remove_prerequisite(task_name) > name = task_name.to_s > @prerequisites.delete(name) > end > end > end > > Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) > Rake::Task.lookup > (:test_functional).remove_prerequisite(:prepare_test_databa > se) > > > -----Original Message----- > From: Blair Zajac [mailto:blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org] > Sent: Sunday, October 30, 2005 9:26 PM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] 0.14.2 Rake task override ? > > Peter Fitzgibbons wrote: > > Hello all, > > > > I have a rails app using legacy MSSQL db that is 1.5Gb... so running > > :prepare_test_database on every test run is very very painful on > > front-loaded processing time. > > In 0.13.1 I edited the rake tasks to make :test_units and > > :test_functional depend only on :environment... I am responsible for > > running :clone_to_test_db on my own. > > > > How can I override the 0.14.2 rake tasks :test_units and > > :test_functional in only my one project? > > > > Thanks. > > Hello, > > I put the code at the bottom of this message into a new file named > ''lib/tasks/000_redefine_task.rake'' and then I would create another file > named ''lib/tasks/my_tests.rake'' or something like that and does this: > > > redefine_task :test_units => :environment > Rake::TestTask.new(:test_units) do |t| > t.libs << "test" > t.pattern = ''test/unit/**/*_test.rb'' > t.verbose = true > end > > redefine_task :test_units => ::environment > Rake::TestTask.new(:test_functional) do |t| > t.libs << "test" > t.pattern = ''test/functional/**/*_test.rb'' > t.verbose = true > end > > BTW, if this doesn''t work, you may need to apply this patch to RoR, > which is now in trunk: > > $ svn diff -r 2739:2740 > Index: railties/lib/tasks/rails.rb > ==================================================================> --- railties/lib/tasks/rails.rb (revision 2739) > +++ railties/lib/tasks/rails.rb (revision 2740) > @@ -4,5 +4,5 @@ > Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } > > # Load any custom rakefile extensions > -Dir["./lib/tasks/**/*.rake"].each { |ext| load ext } > -Dir["./vendor/plugins/*/tasks/**/*.rake"].each { |ext| load ext } > \ No newline at end of file > +Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext } > +Dir["./vendor/plugins/*/tasks/**/*.rake"].sort.each { |ext| load ext } > \ No newline at end of file > > > Regards, > Blair > > -- > Blair Zajac, Ph.D. > <blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org> > Subversion and Orca training and consulting > http://www.orcaware.com/svn/ > > > > > > # Rake allows the same task name to be specified multiple times, where > # each successive task definition appends to a list of actions to > # perform. Therefore, an application specific task cannot redefine a > # previously defined task. These methods here allow tasks to be > # redefined and renamed. > > module Rake > class Task > > # Clear all existing actions for the given task and then set the > # action for the task to the given block. > def self.redefine_task(args, &block) > task_name, deps = resolve_args(args) > TASKS.delete(task_name.to_s) > define_task(args, &block) > end > end > end > > # Clear all existing actions for the given task and then set the > # action for the task to the given block. > def redefine_task(args, &block) > Rake::Task.redefine_task(args, &block) > end > > # Alias one task name to another task name. This let''s a following > # task rename the original task and still depend upon it. > def alias_task(new_name, old_name) > Rake::Task::TASKS[new_name.to_s] > Rake::Task::TASKS.delete(old_name.to_s) > end > > _______________________________________________ > 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 >Tom, I liked your solution. I couldn''t figure how to make it work for my scenario. If possible, I''d like to change the prerequisites for :recent, :test_units, :test_functional by removing prerequisite :prepare_test_database and leaving prerequisite :environment. I''m being dense today.. can you lead the way for me ? Thanks. -- Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
I think that all you need is this code: module Rake class Task def remove_prerequisite(task_name) name = task_name.to_s @prerequisites.delete(name) end end end Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa se) Rake::Task.lookup(:recent).remove_prerequisite(:prepare_test_database) All existing pre-requisites and task definitions are untouched by this code. _____ From: Peter Fitzgibbons [mailto:peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] Sent: Monday, October 31, 2005 10:14 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] 0.14.2 Rake task override ? On 10/31/05, Tom Fakes <tom-3mLyhfhPcFMAvxtiuMwx3w@public.gmane.org> wrote: I have documented a similar workaround to remove database initialization when running a specific target here: http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag e-control The key to this is to take out the pre-requisite for cloning the database from the test tasks. This allows the rest of the task chain to remain undisturbed, and reduces the amount of code you have to copy from the Rails .rake files. In Peter''s case, you could unconditionally remove the prepare_test_database tasks. Here''s the entire code: module Rake class Task def remove_prerequisite(task_name) name = task_name.to_s @prerequisites.delete(name) end end end Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa se) -----Original Message----- From: Blair Zajac [mailto:blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org] Sent: Sunday, October 30, 2005 9:26 PM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails] 0.14.2 Rake task override ? Peter Fitzgibbons wrote:> Hello all, > > I have a rails app using legacy MSSQL db that is 1.5Gb... so running > :prepare_test_database on every test run is very very painful on > front-loaded processing time. > In 0.13.1 I edited the rake tasks to make :test_units and > :test_functional depend only on :environment... I am responsible for > running :clone_to_test_db on my own. > > How can I override the 0.14.2 rake tasks :test_units and > :test_functional in only my one project? > > Thanks.Hello, I put the code at the bottom of this message into a new file named ''lib/tasks/000_redefine_task.rake'' and then I would create another file named ''lib/tasks/my_tests.rake'' or something like that and does this: redefine_task :test_units => :environment Rake::TestTask.new (:test_units) do |t| t.libs << "test" t.pattern = ''test/unit/**/*_test.rb'' t.verbose = true end redefine_task :test_units => ::environment Rake::TestTask.new(:test_functional) do |t| t.libs << "test" t.pattern = ''test/functional/**/*_test.rb'' t.verbose = true end BTW, if this doesn''t work, you may need to apply this patch to RoR, which is now in trunk: $ svn diff -r 2739:2740 Index: railties/lib/tasks/rails.rb ==================================================================--- railties/lib/tasks/rails.rb (revision 2739) +++ railties/lib/tasks/rails.rb (revision 2740) @@ -4,5 +4,5 @@ Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } # Load any custom rakefile extensions -Dir["./lib/tasks/**/*.rake"].each { |ext| load ext } -Dir["./vendor/plugins/*/tasks/**/*.rake"].each { |ext| load ext } \ No newline at end of file +Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext } +Dir["./vendor/plugins/*/tasks/**/*.rake"].sort.each { |ext| load ext } \ No newline at end of file Regards, Blair -- Blair Zajac, Ph.D. <blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org> Subversion and Orca training and consulting http://www.orcaware.com/svn/ <http://www.orcaware.com/svn/> # Rake allows the same task name to be specified multiple times, where # each successive task definition appends to a list of actions to # perform. Therefore, an application specific task cannot redefine a # previously defined task. These methods here allow tasks to be # redefined and renamed. module Rake class Task # Clear all existing actions for the given task and then set the # action for the task to the given block. def self.redefine_task(args, &block) task_name, deps = resolve_args(args) TASKS.delete(task_name.to_s) define_task(args, &block) end end end # Clear all existing actions for the given task and then set the # action for the task to the given block. def redefine_task(args, &block) Rake::Task.redefine_task(args, &block) end # Alias one task name to another task name. This let''s a following # task rename the original task and still depend upon it. def alias_task(new_name, old_name) Rake::Task::TASKS[new_name.to_s] Rake::Task::TASKS.delete(old_name.to_s) end _______________________________________________ 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 Tom, I liked your solution. I couldn''t figure how to make it work for my scenario. If possible, I''d like to change the prerequisites for :recent, :test_units, :test_functional by removing prerequisite :prepare_test_database and leaving prerequisite :environment. I''m being dense today.. can you lead the way for me ? Thanks. -- Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Tom Fakes wrote:> I have documented a similar workaround to remove database initialization > when running a specific target here: > > http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag > e-control > > The key to this is to take out the pre-requisite for cloning the database > from the test tasks. This allows the rest of the task chain to remain > undisturbed, and reduces the amount of code you have to copy from the Rails > .rake files. > > In Peter''s case, you could unconditionally remove the prepare_test_database > tasks. Here''s the entire code: > > module Rake > class Task > def remove_prerequisite(task_name) > name = task_name.to_s > @prerequisites.delete(name) > end > end > end > > Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) > Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa > se)That''s a good one. I''ll hang onto it. The one place where the redefine_task is useful is when I want to redefine the :default task to run another test. Regards, Blair
On 10/31/05, Tom Fakes <tom-3mLyhfhPcFMAvxtiuMwx3w@public.gmane.org> wrote:> > I think that all you need is this code: > > module Rake > class Task > def remove_prerequisite(task_name) > name = task_name.to_s > @prerequisites.delete(name) > end > end > end > > Rake::Task.lookup > (:test_units).remove_prerequisite(:prepare_test_database) > Rake::Task.lookup > (:test_functional).remove_prerequisite(:prepare_test_database) > Rake::Task.lookup(:recent).remove_prerequisite(:prepare_test_database) > > All existing pre-requisites and task definitions are untouched by this > code. > > ------------------------------ > > *From:* Peter Fitzgibbons [mailto:peter.fitzgibbons-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] > *Sent:* Monday, October 31, 2005 10:14 AM > *To:* rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > *Subject:* Re: [Rails] 0.14.2 Rake task override ? > > On 10/31/05, *Tom Fakes* <tom-3mLyhfhPcFMAvxtiuMwx3w@public.gmane.org> wrote: > > I have documented a similar workaround to remove database initialization > when running a specific target here: > > http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag > > e-control > > The key to this is to take out the pre-requisite for cloning the database > from the test tasks. This allows the rest of the task chain to remain > undisturbed, and reduces the amount of code you have to copy from the > Rails > .rake files. > > In Peter''s case, you could unconditionally remove the > prepare_test_database > tasks. Here''s the entire code: > > module Rake > class Task > def remove_prerequisite(task_name) > name = task_name.to_s > @prerequisites.delete(name) > end > end > end > > Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) > Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa > > se) > > > -----Original Message----- > From: Blair Zajac [mailto:blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org] > Sent: Sunday, October 30, 2005 9:26 PM > To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails] 0.14.2 Rake task override ? > > Peter Fitzgibbons wrote: > > Hello all, > > > > I have a rails app using legacy MSSQL db that is 1.5Gb... so running > > :prepare_test_database on every test run is very very painful on > > front-loaded processing time. > > In 0.13.1 I edited the rake tasks to make :test_units and > > :test_functional depend only on :environment... I am responsible for > > running :clone_to_test_db on my own. > > > > How can I override the 0.14.2 rake tasks :test_units and > > :test_functional in only my one project? > > > > Thanks. > > Hello, > > I put the code at the bottom of this message into a new file named > ''lib/tasks/000_redefine_task.rake'' and then I would create another file > named ''lib/tasks/my_tests.rake'' or something like that and does this: > > > redefine_task :test_units => :environment > Rake::TestTask.new (:test_units) do |t| > t.libs << "test" > t.pattern = ''test/unit/**/*_test.rb'' > t.verbose = true > end > > redefine_task :test_units => ::environment > Rake::TestTask.new(:test_functional) do |t| > t.libs << "test" > t.pattern = ''test/functional/**/*_test.rb'' > t.verbose = true > end > > BTW, if this doesn''t work, you may need to apply this patch to RoR, > which is now in trunk: > > $ svn diff -r 2739:2740 > Index: railties/lib/tasks/rails.rb > ==================================================================> --- railties/lib/tasks/rails.rb (revision 2739) > +++ railties/lib/tasks/rails.rb (revision 2740) > @@ -4,5 +4,5 @@ > Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext } > > # Load any custom rakefile extensions > -Dir["./lib/tasks/**/*.rake"].each { |ext| load ext } > -Dir["./vendor/plugins/*/tasks/**/*.rake"].each { |ext| load ext } > \ No newline at end of file > +Dir["./lib/tasks/**/*.rake"].sort.each { |ext| load ext } > +Dir["./vendor/plugins/*/tasks/**/*.rake"].sort.each { |ext| load ext } > \ No newline at end of file > > > Regards, > Blair > > -- > Blair Zajac, Ph.D. > <blair-szbw9MROnEZWk0Htik3J/w@public.gmane.org> > Subversion and Orca training and consulting > http://www.orcaware.com/svn/ > > > > > > # Rake allows the same task name to be specified multiple times, where > # each successive task definition appends to a list of actions to > # perform. Therefore, an application specific task cannot redefine a > # previously defined task. These methods here allow tasks to be > # redefined and renamed. > > module Rake > class Task > > # Clear all existing actions for the given task and then set the > # action for the task to the given block. > def self.redefine_task(args, &block) > task_name, deps = resolve_args(args) > TASKS.delete(task_name.to_s) > define_task(args, &block) > end > end > end > > # Clear all existing actions for the given task and then set the > # action for the task to the given block. > def redefine_task(args, &block) > Rake::Task.redefine_task(args, &block) > end > > # Alias one task name to another task name. This let''s a following > # task rename the original task and still depend upon it. > def alias_task(new_name, old_name) > Rake::Task::TASKS[new_name.to_s] > Rake::Task::TASKS.delete(old_name.to_s) > end > > _______________________________________________ > 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 > > > Tom, > I liked your solution. I couldn''t figure how to make it work for my > scenario. If possible, I''d like to change the prerequisites for :recent, > :test_units, :test_functional by removing prerequisite > :prepare_test_database and leaving prerequisite :environment. > > I''m being dense today.. can you lead the way for me ? > > Thanks. > -- > Peter Fitzgibbons > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >Excellent Tom! That worked. Thank you, thank you, thank you! -- Peter Fitzgibbons _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Hey Blair, Following up on an old-old-old thread. If you have the code handy, exactly how do you use #redefine_task ? Thanks. -- ------------------------------ Apple MacBook. Black. It''s the new White! ------------------------------ Peter Fitzgibbons On 10/31/05, Blair Zajac <blair@orcaware.com> wrote:> Tom Fakes wrote: > > I have documented a similar workaround to remove database initialization > > when running a specific target here: > > > > http://blog.craz8.com/articles/2005/10/25/rails-application-testing-in-damag > > e-control > > > > The key to this is to take out the pre-requisite for cloning the database > > from the test tasks. This allows the rest of the task chain to remain > > undisturbed, and reduces the amount of code you have to copy from the Rails > > .rake files. > > > > In Peter''s case, you could unconditionally remove the prepare_test_database > > tasks. Here''s the entire code: > > > > module Rake > > class Task > > def remove_prerequisite(task_name) > > name = task_name.to_s > > @prerequisites.delete(name) > > end > > end > > end > > > > Rake::Task.lookup(:test_units).remove_prerequisite(:prepare_test_database) > > Rake::Task.lookup(:test_functional).remove_prerequisite(:prepare_test_databa > > se) > > That''s a good one. I''ll hang onto it. > > The one place where the redefine_task is useful is when I want to > redefine the :default task to run another test. > > Regards, > Blair > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >