rake

How do I run all rake tasks?

十年热恋 提交于 2019-12-08 04:24:00
问题 Have just installed whenever gem https://github.com/javan/whenever to run my rake tasks, which are nokogiri / feedzilla dependent scraping tasks. eg my tasks are called grab_bbc, grab_guardian etc My question - as I update my site, I keep add more tasks to scheduler.rake. What should I write in my config/schedule.rb to make all rake tasks run, no matter what they are called? Would something like this work? every 12.hours do rake:task.each do |task| runner task end end Am new to Cron, using

Coping with gitlab ssh key syncronization bug

浪子不回头ぞ 提交于 2019-12-08 03:45:07
问题 I attempted to use a solution posted here: GitLab v5.0 git push problems to fix the ssh keys getting out of sync problem. However, when I run the rake command as both root & git users on the repository server I get the following message: root@gitlab /home/git# rake gitlab:shell:setup RAILS_ENV=production --TRACE No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb) /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:495:in `raw_load_rakefile' /usr

How do I run a Rake task every time a file is saved in Visual Studio?

回眸只為那壹抹淺笑 提交于 2019-12-08 03:36:56
问题 How do I run a rake script automatically every time I save a file in Visual Studio? I can create a batch file that wraps the command. And I'd like to trigger it on CTRL + S . But, Visual Studio 2012 doesn't have macros. JP Boodhoo has done it in many of his screen casts, but hasn't shared the implementation. FYI, my rakefile looks like this require 'albacore' desc 'Build Solution' msbuild :Build do |msb| msb.properties :configuration => :Release msb.targets :Clean, :Build msb.solution =

How do I use a custom log for my rake tasks in Ruby on Rails?

梦想与她 提交于 2019-12-08 03:20:11
问题 I have a rake task that calls functions like this: namespace :blah do task :hello_world => :environment do logger.info("Hello World") helloworld2 end end def helloworld2 logger.info("Hello Again, World") end I want the log output to a custom log, and I really don't want to have to pass a log reference every time I make a function call. I found this somewhere (can't find it again): def logger @@logger ||= Logger.new("#{RAILS_HOME}/log/blah.log") end But this does not work for me and I am not

Rails: run rake tasks like migrations

大兔子大兔子 提交于 2019-12-08 03:00:32
问题 My dev team needs to more precisely run rake tasks. There are certain tasks that need to be only run once after a specific code change. Without getting too specific, it would be like needing to update certain existing users records after a new business rule for new users is implemented in the code. We like how migrations use a db table for logging. Is there a similar tool for rake tasks? Can we hack Rails'/ActiveRecord's migrations system for rake tasks? We'd prefer not to mix db-related

Ruby on rails error when running rails s

萝らか妹 提交于 2019-12-07 23:14:14
问题 Um quite new to rails and um getting an error when run the command rails s it says Could not find rake-0.9.2.2 in any of the sources Run bundle install to install missing gems. when I run bundle install nothing happened my gem list has rake 0.9.2.2 what can go wrong? my ruby version is 1.9.3 Thank you in advance 回答1: Remove all the versions of Rake ==> gem uninstall rake Remove your gemfile.lock => rm Gemfile.lock Remove gem 'rake' on your gemfile Run bundle install Install Rake manually :

How to pass different arguments in rake multitask

可紊 提交于 2019-12-07 18:46:01
问题 I want to pass different arguments to every method and need to run all methods parallel using rake task Here is rake task calling example Rake::Task['test:sync'].invoke(user.id, user.address) Rake::Task['test:sync'].invoke(user.id, user.address) Rake::Task['test:sync'].invoke(user.id, user.address) I have seen the multitask example like this multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do puts "All Copies Complete" end Here they are calling with the task name alone. But in my

ImageScience breaks on update to Rails 3

不想你离开。 提交于 2019-12-07 17:27:34
问题 I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and audio encoding as well), but the image_science require fails with a message like this, "require on /home//.ruby_inline/Inline_ImageScience_cdab.so failed" I've ruled out a duff

Rake build is operating in an incorrect context

拥有回忆 提交于 2019-12-07 16:18:30
问题 I have a gem that exists simply to collect several engines together for ease of implementation, as well as to provide a few utility methods to all of the included engines. One such utility method is a rake task to release new versions of all of the collected engines. My problem is that, when I run code that should execute in the context of one of the collected engines it all (git commands, file system manipulation, etc.) works, except for the rake build command. For some reason, that command

How to monkey patch a rake task shipped with Rails?

江枫思渺然 提交于 2019-12-07 12:43:12
问题 I just found a bug in one of the rake tasks shipped with Rails. Is there a way to monkey patch a rake task? 回答1: Yes. You can do something like this: Rake::Task['doc:app'].clear and then define your own task namespace :doc do task :app do # work your magic end end 来源: https://stackoverflow.com/questions/2412627/how-to-monkey-patch-a-rake-task-shipped-with-rails