Rake tasks

Witajcie,

Jak uniknac duplikowania kodu ? Tak zebym dalej mogl korzystac z tych task’ow oddzielnie.

[code]namespace :vic do
desc “Bootstrap RAILS_ROOT/config/enviroment.rb”
task :env do
@dir_task = File.dirname(FILE)
@dir_templates = @dir_task.gsub(/tasks/,‘templates’)
copy_entry(@dir_templates+’/config/environment.rb’, RAILS_ROOT+’/config/environment.rb’, :remove_destination => true)
end

desc “Bootstrap routes”
task :routes do
@dir_task = File.dirname(FILE)
@dir_templates = @dir_task.gsub(/tasks/,‘templates’)
copy_entry(@dir_templates+’/config/routes.rb’, RAILS_ROOT+’/config/routes.rb’, :remove_destination => true)
end
end[/code]
Pozdrowienia

To Ci chyba pomoże http://railscasts.com/episodes/66-custom-rake-tasks