ruby on rails - Args not being passed through to Rake tasks -
i have rake task accepts argument, :scope (below). call rake task this:
rake podcast:generate_inventory["new"]
this task used pass :scope arg perfectly, however, noticed today arg no longer being passed. have idea why happening?
namespace :podcast task :itunes_top_300, [:scope] => :environment |t,args| podcast.podcast_logger.info("begin: #{time.now}") if args[:scope] == "new" podcast.podcast_logger.info("new podcasts only") end podcast.itunes_top_rss end task :itunes_genres_top_300 => :itunes_top_300 podcast.itunes_genre_rss end task :site_and_feed_discovery, [:scope] => :itunes_genres_top_300 |t,args| if args[:scope] == "new" podcast.site_and_feed_discovery(:new_podcasts_only => true) else podcast.site_and_feed_discovery end end task :social_discovery, [:scope] => :site_and_feed_discovery |t,args| if args[:scope] == "new" podcast.social_discovery(:new_podcasts_only => true) else podcast.social_discovery end end task :fetch_episodes => :social_discovery |t,args| episode.episode_logger.info("begin: #{time.now}") podcast.fetch_episodes episode.episode_logger.info("end: #{time.now}") end task :generate_inventory => :fetch_episodes |t,args| podcast.podcast_logger.info("successful rake") podcast.podcast_logger.info("end #{time.now}") rake::task['maintenance:daily'].invoke end end
looks you're missing [:scope]
bit in definition of task :generate_inventory
. suspect adding in take care of everything.
hope helps!
Comments
Post a Comment