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

Starting a rake task as daemon

I'm trying to daemonize a rake task by running the following command (on Ubuntu 12.04) start-stop-daemon -S --pidfile /home/dep/apps/fid/current/tmp/pids/que.pid -u dep -d /home/dep/apps/fid/current -b -m -a "bundle exec rake que:work…
Sig
  • 5,476
  • 10
  • 49
  • 89
0
votes
1 answer

Rails 4 task with Environment and database connection but no connection reported

I've got a simple little rake script that is supposed to populate the database with some data that I've already put together. However, even though it looks like it should work, I get an error telling me there is no database connection. I'm still at…
user632657
  • 473
  • 3
  • 10
0
votes
2 answers

How to write a method(common method) in ruby

I am new guy for write ruby file I have wrote a task in ruby script, but there is a lot of repeated code in that task. So i need write a common method for that. This is my task in ruby file install_projects = [ …
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
0
votes
1 answer

Calling functions from different ruby files in rake tasks

I m working in rails.i want to call a function(show) of class "twitter" in searcht1 which is in "lib" within a same directory from rake task. lib/task/search.rake: …
0
votes
1 answer

Rake abort tasks not executing in order

I have a Rakefile in which I use to configure an environment for an application, I am having an issue where the Rake task is aborting because a particular Gem is installed in a preciding task. Please see the Rakefile below, the Rake aborts on the…
Jacob Clark
  • 3,317
  • 5
  • 32
  • 61
0
votes
0 answers

Getting error while running rake task in production

When I run $bundle env got the result as: Bundler 1.5.2 Ruby 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux] Rubygems 2.2.1 rvm 1.25.15 (stable) GEM_HOME /usr/local/rvm/gems/ruby-2.1.0 GEM_PATH…
Debadatt
  • 5,935
  • 4
  • 27
  • 40
0
votes
1 answer

My first rake with errors

I am starting to learn how to use rake tasks my first rake task is to show "Hello World" tasks :greet do puts "Hello World" end But for some reason I have the following error $ rails -v Rails 3.2.12 $ ruby -v ruby 2.0.0p247 (2013-06-27 revision…
Joseph
  • 55
  • 2
  • 7
0
votes
3 answers

Rails Execute Cron Job or Rake task for specific time period

I want to execute some task for a specific time period. Lets say I want to execute cronjob or some rake task between 6am to 9am for every half an hour. So script will get execute 6, 6:30, 7, 7:30... and last at 9. Can you please give me some…
Vaibhav Rajput
  • 189
  • 1
  • 2
  • 14
0
votes
1 answer

rails state machine not working inside rake task

I am using the state_machine gem. I am already using the state_machine gem successfully on one of my models, but i can't get it to work on another. In my task model, here is the state machine: state_machine :state, :initial => :incomplete do …
Philip7899
  • 4,599
  • 4
  • 55
  • 114
0
votes
1 answer

how to create a rake task for use with rspec

I am trying to implement the following rake task from the CMS wiki namespace :test do task :prepare do ENV['FROM'] = 'folder-name' ENV['TO'] = 'site-identifier' Rake::Task['comfortable_mexican_sofa:fixtures:import'].invoke …
laertiades
  • 1,992
  • 2
  • 19
  • 26
0
votes
0 answers

Rake task can't find model on gem

My rake task can't find a model comes from a gem on a production environement but works on development. I read this topic a lot of times (and many others) : Rails 3 rake task can't find model in production But I can't solve the problem. Rake finds…
brcebn
  • 1,571
  • 1
  • 23
  • 46
0
votes
1 answer

rails3 thinking-sphinx and cron job

have a cron job that calls cd /Users/me/rails/current && bundle exec rake ts:rebuild >> /Users/me/log/sphinx_index.log the task calls up the proper release. Runs through all the indices, runs through all the scores, the declares 'Started…
Jerome
  • 5,583
  • 3
  • 33
  • 76
0
votes
3 answers

Mixing Rake tasks AND migrations (legacy to new Rails app)

I am currently re-designing a legacy (Rails) app data schema into a new Rails app. What I have to do is : 1 Migration : create new fields in several tables, add new ones 1 Rake task : dispatch legacy fields values into newly created tables fields 1…
gbarillot
  • 309
  • 1
  • 2
  • 13
0
votes
2 answers

run command from folder via cron

I wrote this task for cron: 0 * * * * cd ~/projects/stat-eprorok-rails4/current && rvm use 2.0.0 do bundle exec rake vk_posts:update_likes RAILS_ENV=production I do not understand why the task is not performed every hour, because this script…
Temur
  • 21
  • 3
0
votes
2 answers

How to write rake task to create data using excel in rails 3.2

I want to create data by importing excel. I have got the record of states in excel file and my state model has got only one field state_name. I want to make a rake task to create all the record of all the states present in the excel file but I…
Dev R
  • 1,892
  • 1
  • 25
  • 38