Questions tagged [rake-task]

Task is the basic unit of work in a Rakefile.

Tasks have associated actions (possibly more than one) and a list of prerequisites. When invoked, a task will first ensure that all of its prerequisites have an opportunity to run and then it will execute its own actions.

Tasks are not usually created directly using the new method, but rather use the file and task convenience methods.

689 questions
0
votes
1 answer

RakeTask returns "Don't know how to build task" in Rails project

I am a newb and when running the below rake task keep getting the error message "Don't know how to build task 'create_postgis_template'". My rake file looks as follows: require(File.join(File.dirname(__FILE__), 'config', 'boot')) require…
BC00
  • 1,589
  • 3
  • 29
  • 47
0
votes
1 answer

Rake Tagging from CSV task to much for SQLite?

I have a rake task that foreach through a CSV file of IDs. I then query the database to see if that id exists in my database. if it exists i use act_as_taggable to add a tag. the script runs fine until it gets to the first match and attempts to…
0
votes
1 answer

Are there Mongo Admin fsync + lock commands available in Mongoid?

If I wanted to call the fsync + lock methods on my database, is there a way to do this with Mongoid in a Rails app? Is there also a way to only specify the replica node that I want to perform this operation on? I'm trying to create a rake task to…
Pam
  • 347
  • 4
  • 11
0
votes
1 answer

Rake task runs twice on Heroku

I have an app on heroku which scrapes pricing data off a website and saves it periodically. For some reason whenever I run the rake task locally, it acts as expected, but when I run the task on heroku it adds extra output and is saving the object…
user1071182
  • 1,609
  • 3
  • 20
  • 28
0
votes
1 answer

rake aborted! rake not loading environment models

Have already looked at this stack question, at which point I looked at all of the links in the answer. Created custom rake task, code looks like this: task :seeding do op_a = CoverageDetail.create(option: 'a', privacy_and_website_media:…
Ryan
  • 5,644
  • 3
  • 38
  • 66
0
votes
1 answer

Rails Rake Task Email Notifier

I'm new to writing Rails rake tasks. I want to write a rake task that looks for calls that are within 30.minutes of being due and executing a mailer. Below is the code I would use out of the controller, how can I adapt this to my rake task? @call…
nulltek
  • 3,247
  • 9
  • 44
  • 94
0
votes
2 answers

Simplify multiple if-then rake task

I got the below Rake Task, that runs one a day to settle some bets in my application. But I'm pretty sure it can be simplyfied, so the IF-THEN statements can b replaced with s CASE stement. I assume the multiple IF statements takes longer to run…
Twiddr
  • 297
  • 1
  • 4
  • 18
0
votes
1 answer

rake db:migrate error Don't know how to build task 'rails_env'

I am getting am error when running rake db:migrate. I have recently added a gem gcm_on_rails after this only I am getting the error. rake aborted! Don't know how to build task 'rails_env' Tasks: TOP => db:migrate => db:load_config Please help …
Amal Kumar S
  • 15,555
  • 19
  • 56
  • 88
0
votes
1 answer

How generate pdf in rake task using cron job rails 3

Hi i am using rails 3 and wicked pdf gem to generate pdf in my controllers.But now i want to generate pdf in rake task which will run through cron jobs.After creating this PDF i will send it in email. this is my normal controller method to…
Kashiftufail
  • 10,815
  • 11
  • 45
  • 79
0
votes
2 answers

Custom rake task can't access ActiveRecord data immediately after rake db tasks?

I have a batch of rake tasks that run sequentially: task :batch_tasks => :environment do Rake::Task["db:drop"].execute Rake::Task["db:create"].execute Rake::Task["db:migrate"].execute Rake::Task["db:seed"].execute …
Randy Burgess
  • 4,835
  • 6
  • 41
  • 59
0
votes
1 answer

Modifying RakeFile to allow varied targets

I am working on an HTML5/JavaScript app with Ruby packaging to be used on multiple platforms including a dash display unit on a car. The code base is the same across platforms except for a single wrapper file that houses all of the API-specific…
Danny
  • 3,615
  • 6
  • 43
  • 58
0
votes
1 answer

Cannot run rake with cron tasks

I am unable to run rake tasks with cron. The error it throws up is:- /Library/Ruby/Gems/1.8/gems/bundler-1.2.0/lib/bundler/runtime.rb:199: warning: Insecure world writable dir /Library/Ruby/Gems/1.8 in PATH, mode 040777…
Gyanendra Singh
  • 895
  • 2
  • 13
  • 30
0
votes
2 answers

EDIT:How to make go out from cycle and make task recall?

I'm using task to make Mass Pay API call to PayPal. EDIT: If there are more than 250 recepients I need to go out from cycle and call it again after finishing. Here is my task: task :pay => :environment do clnt = HTTPClient.new i = 0; …
MID
  • 1,815
  • 4
  • 29
  • 40
0
votes
1 answer

Custom rake tasks are running when I run 'rake db:migrate'. How do I prevent this?

I'm running rails on ubuntu 12.04. When I run the code below I get an error from one of my custom tasks. Problem is I didn't want my custom tasks to run in the first place. Just the db migrations. rake db:migrate --trace rake aborted! cannot load…
Jason Stokes
  • 707
  • 2
  • 6
  • 23
0
votes
2 answers

Writing hard coded data in populate file in rails

In my lib/tasks/populate.rake file I have to write some hard coded data in proper html format with proper alignment. How can I write it in the populate file? Is there any way to parse the HTML tags after writing?For random data I know there is…
Sneha Kachroo
  • 583
  • 2
  • 6
  • 12